Python SDK
Async-first Python SDK for Custena. Works with FastAPI, async agent frameworks, and any `httpx`-compatible client.
custenav0.1.0~2 min
Installation
pip install custenaFor buyers — agent client
import os
from custena import Custena
pp = Custena(api_key=os.environ["CUSTENA_API_KEY"])
data = await pp.invoke(
"https://seller.example.com/tools/search",
{"q": "hello world"},
)The client is built on httpx.AsyncClient. Payments are attached as headers
and settled against your Custena balance — top up with a card in the
dashboard.
For sellers — wrap an MCP server
import os
from custena.server import create_proxy
app = create_proxy(
api_key=os.environ["CUSTENA_SECRET_KEY"],
upstream="http://localhost:5000",
price_per_call={"currency": "USD", "amount": 0.01},
)Mount the resulting ASGI app directly under FastAPI, Starlette, or run it
standalone with uvicorn.
Environment variables
| Variable | Purpose |
|---|---|
CUSTENA_API_KEY | Buyer-side key |
CUSTENA_SECRET_KEY | Seller-side key |
CUSTENA_BASE_URL | Override for preview / self-hosted |
Next steps
- Grab a key from the dashboard
- Learn about payment protocols