# Installation

## Caishen SDK – Plug & Play SDK Python

The Caishen SDK enables Python developers to easily connect to wallets, agents, and cash accounts across multiple chains including Ethereum, Solana, Bitcoin, Sui, and XRP. With just a few lines of code, you can automate balance checks, initiate transfers, and power AI-driven finance tools — all without managing seed phrases or wallet infrastructure.

Caishen's Python SDK is designed for backend services, bots, agents, and batch automation tasks. Whether you're building a DeFi app, running AI finance agents, or integrating payments into your backend, Caishen makes it simple and secure.

***

### Requirements

**For Python (Backend/Automation)**

* [Python 3.8 or newer](https://www.python.org/downloads/)
* `httpx`, `requests`, or a similar HTTP client
* Familiarity with environment variables and JWT authentication
* Access to your [Caishen project key and secret](https://dashboard.caishen.tech/auth)
  * `PROJECT_KEY`: from your Caishen dashboard
  * `PROJECT_SECRET`: used to generate JWTs
  * `USER_ID`: can be any string that uniquely identifies your user in your system

***

### Resources

* [**Example Applications**](/build-spotlight.md): View working wallet + cash agent integrations.
* [**Troubleshooting**](/support/faq.md): Common setup issues and sandbox tips.
* [**Source Code**](https://github.com/CaishenTech/caishen-sdk): Full SDK code and dev toolkits.
* [**Support Portal**:](https://discord.gg/tybyS3xSDz) Get help directly from the Caishen team or join the community.

***

### Features

* 🔗 Multi-chain wallet support
* 🌐 Supports major blockchains:
  * Ethereum
  * Bitcoin
  * Solana
  * Cardano
  * Sui, NEAR, Ripple, Tron, TON, Aptos
* 🔒 Secure wallet management
* 🐍 Typed Python API interfaces
* 💸 Token operations: Send, Balance, Swap, Deposit, Withdraw

***

### 🛠️ Install Caishen SDK (Latest Version)

```
pip install --upgrade caishen_sdk_python
> ⚠️ Requires Python ≥ 3.8
```

{% hint style="info" %}
We recommend using `--upgrade` to ensure you're always using the latest stable version with full hosted API support and bug fixes.
{% endhint %}

Having trouble with finding the package? Another option is to install it from Git. You'll need to [install Git](https://git-scm.com/downloads).&#x20;

```
pip install git+https://github.com/CaishenTech/caishen_sdk_python.git@dev
```

```
pip install pyjwt python-dotenv
```

***

### 🚀 Quick Start

```
from caishen_sdk_python import CaishenSDK

sdk = CaishenSDK("your-project-key")
```

***

### 🔑 Authentication

You can authenticate as either a **user** or an **agent**.

#### Connect as User

```
await sdk.connect_as_user(
  'USER PROVIDER',
  'USER TOKEN'
)
```

#### Connect as Agent

```
await sdk.connect_as_agent(
  'AGENT_ID',
  'USER_ID'
)

```

<details>

<summary>Example: Authenticate as a User</summary>

```
import jwt
import asyncio
from caishen_sdk_python import CaishenSDK

# 🔧 Replace with your actual credentials
PROJECT_KEY = "your-project-key"
PROJECT_SECRET = "your-project-secret"
USER_ID = "user-123"

# 🔐 Generate a JWT for the user
token = jwt.encode({ "id": USER_ID }, PROJECT_SECRET, algorithm="HS256")

# 🚀 Initialize the Caishen SDK
sdk = CaishenSDK(PROJECT_KEY)

# 👤 Connect as user with token
async def main():
    await sdk.connect_as_user("custom", token)
    print(f"✅ Connected as {USER_ID}")

asyncio.run(main())

```

</details>

Once connected, you can create wallets, check balances, send payments, and more.

***

### 🧱 Build from Source

```
# Clone & install
pip install setuptools wheel twine

# Build SDK
python setup.py sdist bdist_wheel

# Install locally for development
pip install .
```

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.caishen.tech/python-sdk/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
