haima
Multi-framework x402 payment SDK for AI agents. Add payments to your LangChain, LangGraph, or CrewAI agent in 5 minutes.
Install
pip install haima # Core SDK
pip install haima[langchain] # + LangChain/LangGraph
pip install haima[crewai] # + CrewAI
pip install haima[all] # Everything
Quick Start
from haima import HaimaClient
async with HaimaClient(facilitator_url="https://haima.broomva.tech") as client:
receipt = await client.pay(
recipient="0x742d35Cc6634C0532925a3b844Bc9e7595916Da2",
amount_micro_usd=100,
task_id="translate-doc",
)
print(f"Settled: {receipt.receipt.tx_hash}")
LangChain / LangGraph
from haima.integrations.langchain import haima_pay_tool
from langgraph.prebuilt import create_react_agent
tool = haima_pay_tool(facilitator_url="https://haima.broomva.tech")
agent = create_react_agent(llm, [tool])
CrewAI
from haima.integrations.crewai import HaimaPayTool
from crewai import Agent
tool = HaimaPayTool(facilitator_url="https://haima.broomva.tech")
agent = Agent(role="Payment Processor", tools=[tool])
x402 Middleware
Transparent payment handling for any HTTP request:
from haima import HaimaWallet, X402Middleware
middleware = X402Middleware(wallet=HaimaWallet.generate())
response = await middleware.get("https://api.example.com/premium-data")
# 402 responses are auto-signed and retried
Configuration
| Env Var | Description |
|---|---|
HAIMA_PRIVATE_KEY |
Wallet private key (hex) |
HAIMA_FACILITATOR_URL |
Facilitator endpoint |
How It Works
- Agent makes a payment request via
client.pay() - SDK signs the payment with the agent's secp256k1 wallet
- Signed payment submitted to Haima facilitator
- Facilitator settles on-chain via USDC (Base L2)
- Receipt returned with transaction hash
All amounts in micro-USD (1 USD = 1,000,000 μc).
Metadata
Release files for life-haima 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| life_haima-0.1.0.tar.gz | 11.8 kB | Without provenance | Details for life_haima-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| life_haima-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for life_haima-0.1.0-py3-none-any.whl |
Total release size: 24.1 kB
Release files / life_haima-0.1.0.tar.gz
| Download URL | life_haima-0.1.0.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5cf4caca7d70cbb1f956c3be6829378680a204bdc65968b06083f0c398fe3049
|
|
BLAKE2b-256 checksum How to use checksums |
cf36ad6bb767da3175aac7518ae77be72b48cc394e8914430ae6d8f1424afe8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.8
|
Release files / life_haima-0.1.0-py3-none-any.whl
| Download URL | life_haima-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e954733ac6e4a37e5092885dbafc70776246b43a5b713128ad281dcfee18a89e
|
|
BLAKE2b-256 checksum How to use checksums |
0e8f317a481e7f408e0d695829cc76de7d6ec7b706c19101cab0c51e18af2c6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.8
|
Security for life-haima 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.