Skip to main content

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

Metadata

Release files for anoman-ai 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anoman-ai 0.1.0
File Size Uploaded
anoman_ai-0.1.0.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for anoman-ai 0.1.0
File Interpreter ABI Platform
anoman_ai-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.6 kB

Release files / anoman_ai-0.1.0.tar.gz

Download URL anoman_ai-0.1.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ca20a167d70672cd8854089f4595c49fde0a3aea37d203e2f3afc102b5a06fd2
BLAKE2b-256 checksum
How to use checksums
293efbfc453208cada134a32d733735d3e70218d872100abac2103bf3484897b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 13, 2026.

Transparency log

Release files / anoman_ai-0.1.0-py3-none-any.whl

Download URL anoman_ai-0.1.0-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04cfade8fe846b9f06537cb1a80190faeeaf385b20515780c9a6f55de6d83028
BLAKE2b-256 checksum
How to use checksums
96f5e03bee9215d2103963880645d70b0c031a0aa192772bc97d9e12fd5848fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page