Quickstart · Docs · Hosted models · Endpoints · ▶ Demo
Respan Gateway is an open-source AI gateway: a single Rust binary between your code and every AI API. Not just LLMs: chat, realtime voice, images, video, speech, embeddings and tools, from every major provider. Point the SDK you already use at it, and call any of them, with fallback, tools and a live log of every call built in.
|
OpenAI, Anthropic and Gemini clients can all call any chat model. Streaming, tools, images and reasoning are translated both ways. |
![]() |
|
Realtime voice (OpenAI Realtime ⇄ Gemini Live), images, video, speech, transcription and embeddings, through the same gateway and the SDKs you already use. |
![]() |
|
Put MCP servers or built-in tools (web search, browsers, code sandboxes, memory) behind the gateway. It runs the tool loop server side, so any model can use them from a plain chat call. |
![]() |
|
A failed call falls back to the next provider, with retries and backoff. Hedged requests race a slow provider against the next one. Pick the first, cheapest or fastest. |
![]() |
|
One trait, four hooks: a plugin is a few lines of Rust, on the same API every built-in feature uses. Start from a recipe: guardrails, PII masking, billing or an LLM judge. |
![]() |
|
Telemetry is built in: the web UI logs every call's cost, latency and tokens, and with a Respan key every request is traced in Respan. |
![]() |
1. Install
pip install respan-gatewayOther ways to install
| Shell script | curl -fsSL https://raw.githubusercontent.com/respanai/respan-gateway/main/install.sh | sh |
| Cargo | cargo install respan-gateway |
| Docker | docker run -p 8080:8080 -e OPENAI_API_KEY -e RESPAN_CLIENT_KEYS=<your key> ghcr.io/respanai/respan-gateway |
| Binaries | GitHub releases for macOS, Linux and Windows |
| Inside Python | Run it in-process, with no server |
| Inside Rust | Mount it in your own service |
2. Run it with a provider key
export OPENAI_API_KEY=sk-...
respan-gatewayNo config file needed: every provider whose key is set is ready. No provider
keys? One Respan key (RESPAN_API_KEY) reaches
every hosted model. The web UI is at localhost:8080/ui/.
3. Call any model from the SDK you already use
from anthropic import Anthropic
client = Anthropic(base_url="http://localhost:8080", api_key="unused")
reply = client.messages.create(
model="gpt-6-luna",
max_tokens=256,
messages=[{"role": "user", "content": "Hello!"}],
)
print(reply.content[0].text)The real provider keys stay in the gateway, so api_key can be anything.
No config file is needed to start. When you want more, one gateway.toml sets
up keys, providers, routing, tools and tracing (respan-gateway init writes a
starter one):
# ── Client keys ───────────────────────────────────────────────────
client_keys = [{ name = "app", key = "env:APP_KEY" }] # who may call the gateway
# ── Providers ─────────────────────────────────────────────────────
[providers.anthropic] # a built-in vendor: just add its key
vendor = "anthropic"
key = "env:ANTHROPIC_API_KEY"
[providers.openai]
vendor = "openai"
key = "env:OPENAI_API_KEY"
# ── Routes ────────────────────────────────────────────────────────
[routes.smart] # fallback: Claude, then GPT, each tried twice
to = ["anthropic/claude-haiku-5-5", "openai/gpt-6-luna"]
tries = 2
# ── Tools ─────────────────────────────────────────────────────────
[tools.web] # search and browse as MCP tools, for any model
vendor = "tinyfish"
key = "env:TINYFISH_API_KEY"
# ── Observability ─────────────────────────────────────────────────
[plugins.respan] # a trace per request in Respan
key = "env:RESPAN_API_KEY"Hedge a slow provider
[routes.fast] # start GPT if Claude is 200ms late
to = ["anthropic/claude-haiku-5-5", "openai/gpt-6-luna"]
hedge = "200ms"Pick the cheapest model
[routes.cheap] # the cheapest candidate that can call tools
to = ["openai/gpt-6-luna", "anthropic/claude-haiku-5-5"]
pick = "cheapest" # or first, fastest, weighted, random
needs = ["tools"]Any OpenAI-compatible endpoint
[providers.local] # vLLM, LM Studio, your own server...
formats = ["openai-chat"]
base_url = "http://localhost:8000/v1"An MCP server, with the tool loop
[tools.github] # any MCP server over HTTP
url = "https://api.githubcopilot.com/mcp/"
auth = { bearer = "env:GITHUB_TOKEN" }
[plugins.tool_loop] # the gateway runs the tool calls for any model
allow = ["github__search_*"]
max_steps = 8Every option: configuration docs and the commented gateway.example.toml.
Every SDK, agent framework and coding agent that lets you set a base URL works with the gateway: point it at the gateway and keep your code. How to set it in each one is in one place, so you don't have to dig through each tool's docs.
| Client | Base URL |
|---|---|
| OpenAI SDK (Chat Completions, Responses) | http://localhost:8080/v1 |
| Anthropic SDK | http://localhost:8080 |
| Google GenAI | http://localhost:8080 |
LLM SDKs: OpenAI SDK · Anthropic SDK · Google GenAI · LiteLLM
Agent frameworks: Vercel AI SDK · LangChain · OpenAI Agents · Claude Agent SDK · Pydantic AI
Coding agents: Claude Code · Codex CLI · Cursor · Gemini CLI · OpenCode
Guides: Use GPT, Gemini and any other model in Claude Desktop
Model providers: 31 built in, plus any OpenAI-compatible endpoint. What each supports →
Tools: any MCP server, plus 14 built-in tool vendors any model can use. All tools →
Your own: anything missing is a plugin away, on the same Rust API every built-in feature uses. Start from the plugin guide or a recipe: guardrails · PII masking · billing · LLM judge · fallback · MCP proxy · all examples →
| Respan Gateway | Bifrost | Portkey | LiteLLM (1 worker) | |
|---|---|---|---|---|
| Added latency (p50) | 0.07 ms | 0.16 ms | 0.17 ms | 4.34 ms |
| Throughput | 56,734/s | 18,182/s | 4,187/s | 268/s |
| Memory | 31 MB | 488 MB | 350 MB | 418 MB |
| 1k streams, success | 100% | 92–100% | — | 79% |
| p99 with 5% slow calls | 105 ms | 2,002 ms | 2,003 ms | 2,024 ms |
- Questions and ideas: Discord or Discussions
- Missing a provider or feature? Open an issue
- Want to contribute? Read CONTRIBUTING.md and pick a good first issue. A new provider is usually one file.
- Security issues: see SECURITY.md
Thank you to everyone who has contributed to Respan Gateway:
Respan runs the same gateway for you at gateway.respan.ai.
- One key for every hosted model
- Up to 55% off tokens, 0% fee
- Get an API key →
MIT or Apache-2.0, at your option.








