Python SDK.
OpenAI-shaped client with typed access to the _anoman extension. Sync + async, full streaming, batch poll helper, every error class subclasses AnomanError.
Install
Pick your tool
pip
Poetry
uv
Requires Python ≥ 3.10. PyPI ↗
Client init
Sync or async
Sync client
Async client
Chat completions
Same shape as OpenAI + typed _anoman
Basic completion
With tools
Vision input
Full endpoint reference at /docs/endpoints/chat-completions.
Streaming
SSE with native iteration
Sync stream
Async stream
Cancel mid-stream
Batch
Enqueue + poll in one call
Enqueue + poll helper
Cancel a queued job
Full batch lifecycle at /docs/endpoints/batch.
Errors
Typed exception hierarchy
Every error subclasses AnomanError. Branch on the specific subclass to decide whether to retry, escalate, or surface to the end user.
Error handling
Anoman-specific options
SDK shortcuts for headers
Common x-anoman-* headers are exposed as typed kwargs so you don't have to remember the header name.
Per-request session + agent ID
Force realtime when batch is the key default
Bypass response cache
TypeScript instead?
Same surface area, native types, async iterators.