Python SDK: suede-ai
suede-ai is the Python client for Suede's x402 endpoints. It reads the 402 challenge, signs the EIP-3009 USDC authorization on Base with your key, and replays the request, so your code sends prompts and gets back a job to collect. Version 0.4.0 was released on PyPI on 2026-08-29 under the MIT license.
Install
pip install suede-ai
Requires Python 3.10 or later. It installs httpx (0.27 or later), eth-account (0.10 or later) and pydantic (2.6 or later).
Generate an image and collect it
import os
import time
import httpx
from suede_ai import SuedeClient
with SuedeClient(wallet_private_key=os.environ["SUEDE_WALLET_KEY"]) as suede:
job = suede.agent_image(
prompt="Album cover, neon city at night, rain on glass",
aspect_ratio="1:1",
output_format="png",
)
# A paid call is queued, so the SDK returns the 202 body with a pollUrl.
while True:
state = httpx.get(job["pollUrl"]).json()
if state["status"] in ("completed", "failed"):
break
time.sleep(5)
print(state.get("imageUrl"))
The key signs real USDC transfers on Base mainnet. Keep it in an environment variable or a secret store, and use a wallet funded with what you plan to spend. The SDK sends PAYMENT-SIGNATURE on the retry, which makes the call asynchronous by default, so every typed method returns a job to poll. Polling is free; the endpoint reference lists each poll route and its finished state.
Client options
| Argument | Default | Use |
|---|---|---|
wallet_private_key | Required | Hex private key, with or without 0x. Signs the EIP-3009 authorizations. |
base_url | https://app.suedeai.ai | API host. |
http_client | None | Your own httpx.Client. |
timeout | 60 s read, 10 s connect | Per-request timeout. |
max_payment_attempts | 1 | Paid retries after a 402: one challenge, one paid retry. |
Methods for the live endpoints
| Method | Calls | Body it sends |
|---|---|---|
create_music(prompt, duration_seconds=30, style=None) | POST /create-music | prompt, durationSeconds, style |
agent_video(prompt, duration_seconds=8, aspect_ratio=None, resolution=None) | POST /agent/video | prompt, durationSeconds, aspectRatio, resolution |
agent_image(prompt, aspect_ratio=None, output_format=None) | POST /agent/image | prompt, aspectRatio, outputFormat |
manifest() | GET /.well-known/x402.json | None. Free; read prices before you sign. |
request(method, path, json=None, params=None) | Any path | Your JSON. Handles the 402 the same way. |
The typed methods take keyword arguments only. For /create-music fields the typed method does not expose, such as lyrics, custom_mode, make_instrumental, vocal_gender or tags, call request():
job = suede.request("POST", "/create-music", json={
"prompt": "A melancholic acoustic guitar ballad about rain",
"make_instrumental": True,
})
# Poll job["pollUrl"] until model_version is no longer "pending".
How the SDK pays
- It sends your request with no payment.
- On a 402 it reads the
PAYMENT-REQUIREDheader, falling back to the JSON body. - It picks the
acceptsentry with schemeexact, networkeip155:8453and the USDC contract0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913. - It signs
TransferWithAuthorizationforamounttopayTo, with a random 32-byte nonce,validAfter60 seconds in the past andvalidBeforeat now plus the larger of 600 seconds andmaxTimeoutSecondsplus 60. - It base64-encodes an x402 version 2
PaymentPayload(x402Version,resource,accepted,extensions,payload) and replays the request withPAYMENT-SIGNATURE. - It returns the JSON of the first response that is not a 402.
The quickstart shows the same exchange with curl, field by field.
Exceptions
| Exception | Raised when |
|---|---|
suede_ai.PaymentRequired | The 402 offers no exact USDC-on-Base entry to sign. |
suede_ai.X402Error | The response is still 402 after max_payment_attempts paid retries. PaymentRequired is a subclass. |
httpx.HTTPStatusError | Any other non-2xx response, such as a 422 or 429. See the errors page. |
Releases
| Version | Released |
|---|---|
| 0.4.0 | 2026-08-29 |
| 0.3.1 | 2026-07-09 |
| 0.3.0 | 2026-06-17 |
| 0.2.0 | 2026-06-17 |
| 0.1.0 | 2026-06-05 |
The package also ships helpers for older /v1/* routes, such as extend, cover and stems_pro. Those routes are not in the live x402 manifest; the three typed methods above cover the current catalog.
Sources
- suede-ai on PyPI: version, release dates, Python requirement, dependencies and license.
- Suede-AI/suede-sdk-python: the SDK repository. The client and payment behavior on this page was read from the 0.4.0 wheel on PyPI on 2026-10-11.
- app.suedeai.ai/.well-known/x402: the manifest the SDK reads.