Skip to main content

One stable, typed, async API over many AI providers — plus an MCP server — for the arvel framework.

Project description

arvel-ai

One stable API over many AI providers — plus a secured MCP server — for the arvel framework.

Your app talks to one contract: AI.chat, AI.stream, AI.structured, AI.embed. Which provider actually serves the request — Anthropic, OpenAI, a LiteLLM proxy, a local vLLM or Ollama — is a config choice, not a code change. No provider SDK type (httpx, any_llm) ever crosses into your code; the boundary is enforced by the import-linter, not just intended.

uv add arvel-ai                 # gateway (openai_compatible + fake) + MCP server
uv add 'arvel-ai[anthropic]'    # + the any-llm driver and your provider's SDK, one extra

One extra per provider — anthropic, openai, gemini, bedrock, mistral, ollama, groq, … (full list); arvel-ai[all] installs every provider.

Need durable, multi-step orchestration? That's a separate package — arvel-workflow (Temporal-backed) — not part of the gateway.

Installing registers the provider automatically — app.make("ai") and the AI facade work with zero wiring.

from arvel_ai import AI

reply = await AI.chat("Summarize this review in one line", model="fast")
print(reply.text)

async for delta in AI.stream("Write a product description"):
    ...                                        # TextDelta / ToolCallDelta / StreamEnd

copy = await AI.structured(ProductCopy, "Write copy for red wool socks")
#      a typed, validated ProductCopy — not a dict

What's in the box

  • The gatewaychat / stream (SSE) / structured (typed output) / embed, over a stable msgspec contract and one AiError taxonomy. Swap providers in config; your code never changes.
  • Model aliases — code says model="fast"/"smart"; ops maps those to real ids, so a retired model is a one-line config edit, not a code hunt.
  • A secured MCP server — expose your app's functions to AI agents over the Model Context Protocol, with token or OIDC auth (RFC 8707 audience binding). Off by default.
  • First-class fakesAI.fake() tests AI code with no network, the same way you test mail.
  • A health-checked resource — the gateway reports on /health and the startup log via a real probe: a wrong or missing key shows as failed, not a false ok.

Point it at a provider

The gateway speaks the OpenAI HTTP format, and both Anthropic and OpenAI expose OpenAI-compatible endpoints — so you need no proxy in front:

# config/ai.py
from arvel import env

ai = {
    "default": "openai_compatible",
    "models": {"fast": "claude-haiku-4-5", "smart": "claude-opus-4-8"},
    "drivers": {
        "openai_compatible": {
            "base_url": env("AI_GATEWAY_URL", "https://api.anthropic.com/v1"),
            "api_key_env": "AI_API_KEY",       # the NAME of the env var, never the key itself
            "model": env("AI_MODEL_FAST", "claude-haiku-4-5"),
        },
    },
}

Keys live in environment variables only — config holds the env var name, never the secret.

Documentation

Guide What's in it
Getting Started install → configure → first call → first test, end to end
The Gateway chat/stream/structured/embed, tools, drivers, aliases, errors, observability, testing
MCP Server expose tools to agents, token & OIDC auth, the security model
Configuration the complete config("ai") reference — every key and default

Requirements

  • Python 3.14+
  • arvel (installed with the package)
  • Optional engines: arvel-ai[<provider>] (the any-llm driver — one extra per provider, see Getting Started); OIDC MCP auth needs arvel[jwt]

License

MIT — see LICENSE.

Project details


Download files

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

Source Distribution

arvel_ai-0.2.0.tar.gz (173.1 kB view details)

Uploaded Source

Built Distribution

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

arvel_ai-0.2.0-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

File details

Details for the file arvel_ai-0.2.0.tar.gz.

File metadata

  • Download URL: arvel_ai-0.2.0.tar.gz
  • Upload date:
  • Size: 173.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for arvel_ai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fed3f846ecd86bec7364a3be33b9bbb88872da6be10e7cf6ac612623a585d140
MD5 c5a86cbabba2c583f53f2eb3c06315a1
BLAKE2b-256 91b1adfa80aaf1cfb179d2a7690af2e1a645f40d72468db3559332e52ad3b364

See more details on using hashes here.

Provenance

The following attestation bundles were made for arvel_ai-0.2.0.tar.gz:

Publisher: publish.yml on mohamed-rekiba/arvel-ai

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

File details

Details for the file arvel_ai-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: arvel_ai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 33.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for arvel_ai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5938ff82f229e977ce5a01c83731ea5db0e400715702e1b23dc15106d30574b1
MD5 6ca437b6160d93a6859de00ac5615619
BLAKE2b-256 785edf3a9cfe3eaf96d4ef14192c869ab6c464394046d1472562504733650074

See more details on using hashes here.

Provenance

The following attestation bundles were made for arvel_ai-0.2.0-py3-none-any.whl:

Publisher: publish.yml on mohamed-rekiba/arvel-ai

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

Supported by

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