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 gateway —
chat/stream(SSE) /structured(typed output) /embed, over a stable msgspec contract and oneAiErrortaxonomy. 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 fakes —
AI.fake()tests AI code with no network, the same way you test mail. - A health-checked resource — the gateway reports on
/healthand the startup log via a real probe: a wrong or missing key shows asfailed, not a falseok.
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 needsarvel[jwt]
License
MIT — see LICENSE.
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fed3f846ecd86bec7364a3be33b9bbb88872da6be10e7cf6ac612623a585d140
|
|
| MD5 |
c5a86cbabba2c583f53f2eb3c06315a1
|
|
| BLAKE2b-256 |
91b1adfa80aaf1cfb179d2a7690af2e1a645f40d72468db3559332e52ad3b364
|
Provenance
The following attestation bundles were made for arvel_ai-0.2.0.tar.gz:
Publisher:
publish.yml on mohamed-rekiba/arvel-ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arvel_ai-0.2.0.tar.gz -
Subject digest:
fed3f846ecd86bec7364a3be33b9bbb88872da6be10e7cf6ac612623a585d140 - Sigstore transparency entry: 2192245249
- Sigstore integration time:
-
Permalink:
mohamed-rekiba/arvel-ai@e4e765094f091477d94cf8db5197951113eb42ef -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/mohamed-rekiba
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e4e765094f091477d94cf8db5197951113eb42ef -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5938ff82f229e977ce5a01c83731ea5db0e400715702e1b23dc15106d30574b1
|
|
| MD5 |
6ca437b6160d93a6859de00ac5615619
|
|
| BLAKE2b-256 |
785edf3a9cfe3eaf96d4ef14192c869ab6c464394046d1472562504733650074
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arvel_ai-0.2.0-py3-none-any.whl -
Subject digest:
5938ff82f229e977ce5a01c83731ea5db0e400715702e1b23dc15106d30574b1 - Sigstore transparency entry: 2192245258
- Sigstore integration time:
-
Permalink:
mohamed-rekiba/arvel-ai@e4e765094f091477d94cf8db5197951113eb42ef -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/mohamed-rekiba
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e4e765094f091477d94cf8db5197951113eb42ef -
Trigger Event:
workflow_dispatch
-
Statement type: