Official Python SDK for the Anoman AI LLM gateway — secure every AI call
Project description
anoman-ai
Official Python SDK for the Anoman AI gateway. Async-first, OpenAI-compatible, with batch polling and streaming support.
Installation
pip install anoman-ai
Quick Start
from anoman_ai import AnomanAI
async with AnomanAI(api_key="anm-sk-your-key-here") as client:
response = await client.chat_completion(
model="claude-sonnet",
messages=[{"role": "user", "content": "Explain quantum computing in one sentence."}],
)
print(response.choices[0].message.content)
Streaming
async for chunk in client.chat_completion_stream(
model="claude-sonnet",
messages=[{"role": "user", "content": "Write a haiku about AI safety."}],
):
print(chunk.choices[0].delta.content, end="")
Batch Routing
Anoman can batch-route non-interactive requests for lower cost:
# If the gateway returns a 202, you get a batch job
# Use poll_batch() to wait for the result
result = await client.poll_batch("job_abc123", max_wait_seconds=300)
print(result.result.choices[0].message.content)
print(f"Saved ${result.savings_usd}")
Embeddings
response = await client.create_embedding(
model="text-embedding-3-small",
input="Hello world",
)
print(response.data[0].embedding)
Models
models = await client.list_models()
for model in models.data:
print(f"{model.id} ({model.owned_by})")
Error Handling
import httpx
try:
response = await client.chat_completion(
model="claude-sonnet",
messages=[{"role": "user", "content": "Hello"}],
)
except httpx.HTTPStatusError as e:
if e.response.status_code == 401:
print("Invalid API key")
elif e.response.status_code == 403:
print("Blocked by guardrail")
elif e.response.status_code == 429:
print("Rate limited")
Configuration
client = AnomanAI(
api_key="anm-sk-...",
base_url="https://api.anoman.io", # default
timeout=60.0, # 60s default
)
Documentation
Full API documentation: https://docs.anoman.io
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file anoman_ai-0.1.0.tar.gz.
File metadata
- Download URL: anoman_ai-0.1.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca20a167d70672cd8854089f4595c49fde0a3aea37d203e2f3afc102b5a06fd2
|
|
| MD5 |
1ece990f62b87f0e38fb168638432a84
|
|
| BLAKE2b-256 |
293efbfc453208cada134a32d733735d3e70218d872100abac2103bf3484897b
|
Provenance
The following attestation bundles were made for anoman_ai-0.1.0.tar.gz:
Publisher:
publish-python-sdk.yml on c0denician88/anoman-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
anoman_ai-0.1.0.tar.gz -
Subject digest:
ca20a167d70672cd8854089f4595c49fde0a3aea37d203e2f3afc102b5a06fd2 - Sigstore transparency entry: 1522865777
- Sigstore integration time:
-
Permalink:
c0denician88/anoman-core@3e4ce8a12f1d124c75169af0c144c265b18381cc -
Branch / Tag:
refs/tags/sdk-v0.1.0 - Owner: https://github.com/c0denician88
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python-sdk.yml@3e4ce8a12f1d124c75169af0c144c265b18381cc -
Trigger Event:
push
-
Statement type:
File details
Details for the file anoman_ai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: anoman_ai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04cfade8fe846b9f06537cb1a80190faeeaf385b20515780c9a6f55de6d83028
|
|
| MD5 |
218bb70aaac3ec2b578e56d38ddbc806
|
|
| BLAKE2b-256 |
96f5e03bee9215d2103963880645d70b0c031a0aa192772bc97d9e12fd5848fd
|
Provenance
The following attestation bundles were made for anoman_ai-0.1.0-py3-none-any.whl:
Publisher:
publish-python-sdk.yml on c0denician88/anoman-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
anoman_ai-0.1.0-py3-none-any.whl -
Subject digest:
04cfade8fe846b9f06537cb1a80190faeeaf385b20515780c9a6f55de6d83028 - Sigstore transparency entry: 1522865790
- Sigstore integration time:
-
Permalink:
c0denician88/anoman-core@3e4ce8a12f1d124c75169af0c144c265b18381cc -
Branch / Tag:
refs/tags/sdk-v0.1.0 - Owner: https://github.com/c0denician88
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python-sdk.yml@3e4ce8a12f1d124c75169af0c144c265b18381cc -
Trigger Event:
push
-
Statement type: