需要设置对应厂商的 API key,只有设置了 key 的厂商才会成为可用 provider;默认只监听本机回环地址,对外监听时必须配置 client key;Docker 运行时需额外传入 RESPAN_CLIENT_KEYS。

respan-gateway
respanaiApache-2.0活跃维护用 Rust 写的开源 LLM 网关,把 OpenAI、Anthropic、Gemini 等各家模型统一到一个接口,任意 SDK 和工具都能直接接入,省去多厂商适配的麻烦。
Open-source LLM gateway in Rust. One endpoint for OpenAI, Anthropic, Gemini and every other vendor. Any SDK, any model, any tool.
pip install respan-gateway
export OPENAI_API_KEY=sk-...
respan-gatewayREADME 未说明硬件要求,仅说明是单个 Rust 二进制,内存占用约 31 MB
Rust 写的开源 LLM 网关,一个端点接入 OpenAI、Anthropic、Gemini 等所有厂商
用 Rust 写的开源 LLM 网关,把 OpenAI、Anthropic、Gemini 等各家模型统一到一个接口,任意 SDK 和工具都能直接接入,省去多厂商适配的麻烦。
核心能力
- 用 OpenAI、Anthropic、Gemini 任一 SDK 调用任意厂商模型,自动翻译格式
- 支持实时语音、图像、语音合成、转写、嵌入和视频等多模态能力
- 把 MCP 服务器和内置工具接入普通聊天请求,任意模型都能用
- 命名路由支持回退、重试、按最便宜或最快选择,以及对冲请求
- 内置实时请求日志,记录成本、延迟和 token,并可接入 Respan 追踪
容易踩的坑
- v0.3.0最新正式版2026-10-25 · 2026-10-25 06:27 UTC
Highlights
- New vendors: EmpirioLabs AI, DeepInfra, Perplexity, Cerebras; Mistral transcriptions, speech and realtime; Gemini image clients; the Exa tool vendor.
- Multimodal embeddings: an embedding input can be parts (texts, images, videos).
- Install on common Linux: the Linux wheels are
manylinux_2_28, so pip on Ubuntu 20.04+, Debian 11+ and Amazon Linux 2023 gets a wheel. - Docker:
ghcr.io/respanai/respan-gateway:latest(amd64 and arm64). Listening beyond localhost, it needs a client key:-e RESPAN_CLIENT_KEYS=....
Breaking
- The
systemoneformat is nowdecisions: a config naming it must change. - Library crates: a vendor's dialect now lives in
respan-gateway-http(Dialect,Dialected), replacing those of conversation-http, media-http and decision-http.
What's Changed
- New README banner and a link to the demo video by @fran3cc in https://github.com/respanai/respan-gateway/pull/1
- Community files: templates, security policy, code of conduct, plugin list by @fran3cc in https://github.com/respanai/respan-gateway/pull/2
- feat(tool-vendors): add Exa search and contents by @hellosatyajit in https://github.com/respanai/respan-gateway/pull/10
- Add the license line to the README banner by @fran3cc in https://github.com/respanai/respan-gateway/pull/9
- feat(vendors): add Cerebras as a model vendor by @sahilPadmani in https://github.com/respanai/respan-gateway/pull/12
- vendors: add Mistral transcriptions and speech by @lihe07 in https://github.com/respanai/respan-gateway/pull/14
- media: multimodal embedding parts by @Leo-rq-yu in https://github.com/respanai/respan-gateway/pull/13
- decision-http, vendors: rename System One to decisions, add Respan by @lihe07 in https://github.com/respanai/respan-gateway/pull/18
- vendors: add Perplexity as a model vendor by @sahilPadmani in https://github.com/respanai/respan-gateway/pull/34
- docs: add readme badges by @Leo-rq-yu in https://github.com/respanai/respan-gateway/pull/36
- docs: add a branded readme header by @Leo-rq-yu in https://github.com/respanai/respan-gateway/pull/37
- realtime-ws, vendors, gateway, ui: add Mistral realtime by @lihe07 in https://github.com/respanai/respan-gateway/pull/35
- vendors, gateway: take a model's kind from its vendor's list by @lihe07 in https://github.com/respanai/respan-gateway/pull/39
- ci: Add Dockerfile by @steren in https://github.com/respanai/respan-gateway/pull/32
- media-http, gateway, vendors, ui: add Gemini image clients by @lihe07 in https://github.com/respanai/respan-gateway/pull/43
- docs: rework the README by @fran3cc in https://github.com/respanai/respan-gateway/pull/41
- deps: update tokio to 1.54.1 for RUSTSEC-2026-0386 by @lihe07 in https://github.com/respanai/respan-gateway/pull/57
- vendors, gateway, ui: add DeepInfra by @Leo-rq-yu in https://github.com/respanai/respan-gateway/pull/31
- http, formats, vendors: lay a vendor's dialect over any format by @lihe07 in https://github.com/respanai/respan-gateway/pull/58
- media-http, vendors: add EmpirioLabs AI by @Leo-rq-yu in https://github.com/respanai/respan-gateway/pull/28
- http, media-http: share path escaping by @Leo-rq-yu in https://github.com/respanai/respan-gateway/pull/54
- docker, python: install on common Linux, tag only main and versions by @lihe07 in https://github.com/respanai/respan-gateway/pull/59
- release: 0.3.0 by @lihe07 in https://github.com/respanai/respan-gateway/pull/60
New Contributors
- @fran3cc made their first contribution in https://github.com/respanai/respan-gateway/pull/1
- @hellosatyajit made their first contribution in https://github.com/respanai/respan-gateway/pull/10
- @sahilPadmani made their first contribution in https://github.com/respanai/respan-gateway/pull/12
- @lihe07 made their first contribution in https://github.com/respanai/respan-gateway/pull/14
- @Leo-rq-yu made their first contribution in https://github.com/respanai/respan-gateway/pull/13
- @steren made their first contribution in https:/
- v0.2.02026-10-20 · 2026-10-20 06:53 UTC
查看更新说明
- v0.1.02026-10-19 · 2026-10-19 23:10 UTC
查看更新说明
Full Changelog: https://github.com/respanai/respan-gateway/commits/v0.1.0
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Respan Gateway is a single Rust binary that sits between your code and every AI API. Point the SDK you already use at it, and it connects you to everything: chat models, images, video and voice from every major provider; tools for any model, from web search and memory to code sandboxes and any MCP server; and traffic control (format translation, fallback, retries and hedged requests), with a live log of every call. ▶ Watch the demo
Key features
-
Any client, any model OpenAI Chat Completions, OpenAI Responses, Anthropic Messages and Gemini API clients can all call any model, with streaming, tools, images and reasoning translated.
-
Multimodal Realtime voice across vendors (an OpenAI Realtime client talks to Gemini Live, and back), plus images, speech, transcription, embeddings and video through OpenAI's or Gemini's APIs, to any vendor that has them.
-
MCP tools for every model Put MCP servers or built-in tool vendors behind the gateway, from web search to code sandboxes. It runs their tools inside chat requests, so a plain chat call can use them, whatever the client or model.
-
Traffic control Named routes, globs and
provider/model; fallback, retries, cheapest or fastest; and hedged requests that race a slow call against a second provider. -
Observability A live request log with cost, latency and tokens for every call, and traces in Respan, where span-02 analyzes how your agents behave.
-
Best-in-class performance 0.07 ms of added latency, 56,000 requests per second and 31 MB of memory in our benchmarks: about 3× the throughput of the next fastest gateway we tested.
-
Write your own plugin in minutes Every feature above is a plugin, built on the same public Rust API you can use: one trait with four hooks. Start from the plugin guide or an example such as guardrails, PII masking or billing.
Quickstart
1. Install
pip install respan-gateway
Or cargo install respan-gateway, or a
GitHub release.
2. Run it with your keys
export OPENAI_API_KEY=sk-...
respan-gateway
No config file needed: every vendor whose key is set becomes a provider.
3. Call any model from any SDK
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 from the Anthropic SDK"}])
print(reply.content[0].text)
The web UI is at localhost:8080/ui/. Next: configuration and MCP tools.
Other ways to run it
- Python, in-process — Run the gateway inside your Python app, with no server.
- Embed in Rust — Mount the gateway in your own Rust service.
- Docker —
docker run -p 8080:8080 -e OPENAI_API_KEY -e RESPAN_CLIENT_KEYS=<a key of yours> ghcr.io/respanai/respan-gatewayon any container host; listening beyond localhost, it needs a client key.
Performance
| 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% |
| 1k streams, memory | 128 MB | 688 MB | — | 493 MB |
| p99, 5% slow calls | 105 ms | 2,002 ms | 2,003 ms | 2,024 ms |
Configuration
You don't need a config file to start. When you want more, run
respan-gateway init for a commented gateway.toml. One file sets up keys,
providers, traffic control, tools and tracing:
client_keys = [{ name = "app", key = "env:APP_KEY" }] # who may call the gateway
[providers.openai] # a built-in vendor: just add a key
vendor = "openai"
key = "env:OPENAI_API_KEY"
[providers.anthropic]
vendor = "anthropic"
key = "env:ANTHROPIC_API_KEY"
[providers.local] # any OpenAI-compatible endpoint
formats = ["openai-chat"]
base_url = "http://localhost:8000/v1"
[routes.smart] # clients ask for "model": "smart"
to = ["anthropic/claude-haiku-5-5", "openai/gpt-6-luna"]
hedge = "800ms" # race the second if the first is slow
[tools.search] # web search as MCP tools
vendor = "linkup"
key = "env:LINKUP_API_KEY"
[plugins.tool_loop] # every model can use them
servers = ["search"]
[plugins.respan] # trace every call in Respan
key = "env:RESPAN_API_KEY"
respan-gateway check validates it, and --watch or SIGHUP reloads it
without a restart. Without client keys, the gateway answers only on loopback
and refuses to start on a public address.
Reference: configuration ·
vendors · tool vendors ·
MCP and tools · gateway.example.toml
Supported API formats
Call the gateway in any format on the left, and it reaches every provider on the right, translating between them.
| Your code calls | It can reach | |
|---|---|---|
| Chat | OpenAI Chat CompletionsOpenAI ResponsesAnthropic MessagesGemini API | any chat model, whichever of the four formats it speaks |
| Realtime voice | OpenAI RealtimeGemini Live | OpenAI ⇄ Gemini voice; Mistral for transcription |
| Images | OpenAI ImagesGemini Images | |
| Speech, transcription | OpenAI SpeechOpenAI Transcriptions | |
| Embeddings | OpenAI Embeddings | |
| Video | OpenAI VideosGemini Veo | Google Veo |
| Decisions | Respan DecisionsTypeSafe System One | |
| Tools | MCP | your MCP servers and tool vendors |
| Anything else | A vendor's own API | Relayed to that vendor untouched |
Each vendor's formats are in vendors, and the translation details in each format's README: chat, media, realtime and decisions.
Plugins
Everything the gateway does is a plugin on one public Rust API.
Models · 16 providers and any compatible endpoint, each reachable from any client format. All vendors →
Tools · any MCP server, plus built-in tools for search, browsing, code, documents and memory, usable from any model. All tool vendors →
Traffic control · named routes, fallback, retries, hedged requests, and the cheapest or fastest provider.
Observability · a live request log, the cost of every call, and traces in Respan.
Your framework · anything with a base URL. Guides for the OpenAI SDK, Anthropic SDK, Google GenAI, Vercel AI SDK, LangChain, Pydantic AI, Pi, OpenCode and more.
Your own plugin · start from the plugin guide or an example: guardrails, PII masking, billing, an LLM judge.
Built in: routing · tool-loop · mcp-router · pricing · respan · responses · credentials
Community
Contributions are welcome. CONTRIBUTING.md covers the architecture, building and tests, and a new vendor is usually one file. Start with a good first issue, ask in Discussions or Discord, and report security issues as SECURITY.md describes.
Roadmap: what we're building next is in issues. Missing a vendor, format or feature? Ask for it.
Want it managed? Respan runs the gateway for you, with dashboards, evals and span-02.
License
Dual-licensed under MIT or Apache-2.0, at your option.