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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anoman_ai-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anoman_ai-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

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

Hashes for anoman_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ca20a167d70672cd8854089f4595c49fde0a3aea37d203e2f3afc102b5a06fd2
MD5 1ece990f62b87f0e38fb168638432a84
BLAKE2b-256 293efbfc453208cada134a32d733735d3e70218d872100abac2103bf3484897b

See more details on using hashes here.

Provenance

The following attestation bundles were made for anoman_ai-0.1.0.tar.gz:

Publisher: publish-python-sdk.yml on c0denician88/anoman-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for anoman_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 04cfade8fe846b9f06537cb1a80190faeeaf385b20515780c9a6f55de6d83028
MD5 218bb70aaac3ec2b578e56d38ddbc806
BLAKE2b-256 96f5e03bee9215d2103963880645d70b0c031a0aa192772bc97d9e12fd5848fd

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page