Sign inSign up

xtravisions/one-router

By xtravisions

•Updated 6 days ago

A high-performance Rust API gateway use **a single endpoint** to access multiple LLM providers.

Image
Integration & delivery
API management
Machine learning & AI
0

9.1K

xtravisions/one-router repository overview

⁠One Router

One Router is a high-performance API gateway written in Rust that gives you a single endpoint for multiple LLM providers. Point your existing OpenAI or Anthropic SDK at it — requests are automatically translated and routed to AWS Bedrock, Google Gemini, Anthropic, or OpenAI.

Full documentation: https://github.com/XtraVisionsAI/one-router⁠

⁠Features

  • Dual protocol — accepts both OpenAI (/v1/chat/completions) and Anthropic (/v1/messages) request formats
  • Multi-backend routing — AWS Bedrock, Google Gemini, Anthropic API, and OpenAI API, with automatic protocol conversion and full SSE streaming
  • OpenAI Responses API — /v1/responses compatible with the Codex CLI: named-event SSE streaming and stateful multi-turn via previous_response_id
  • Bedrock GPT-5.x (Mantle) — Responses-only GPT-5.x models on Bedrock work from all three chat endpoints (native passthrough on /v1/responses, one-hop conversion on /v1/messages and /v1/chat/completions)
  • Embeddings, Rerank & Images — OpenAI-compatible /v1/embeddings and /v1/images/generations, Cohere-compatible /v1/rerank, backed by Bedrock / OpenAI / Gemini
  • Smart model mapping — map model names across providers (e.g. gpt-4o → Claude Sonnet) with exact match, wildcards, and priorities
  • Load balancing & failover — multiple credentials per backend (round-robin / weighted / random / failover), per-backend model filters (["*", "!openai.*"]), and model-level failover chains
  • Per-model capabilities — extended thinking (Claude / Nova 2 / Kimi / GPT effort), tool use, documents, Programmatic Tool Calling with sandboxed execution
  • Web search & fetch — proxy-side web tools (Tavily / Brave) with agentic loop, streaming, and citations
  • API key management — per-key rate limits, budget caps, and service shed, backend credentials AES-256-GCM encrypted at rest
  • Admin Web UI — manage keys, backends, mappings, settings, and usage stats at /admin; changes hot-reload without restart
  • Usage & metrics — GET /v1/usage query API and an unauthenticated oint
  • Automatic pricing sync — optionally sync per-model pricing from the LiteLLM price table; import new models from the catalog in the Admin UI
  • Pluggable storage — SQLite (zero-config), PostgreSQL, or DynamoDB —
  • Multi-arch images — linux/amd64 and linux/arm64; self-update support on bare metal

⁠Quick Start

docker run -d -p 8000:8000 \
  -e MASTER_API_KEY=sk-your-secret \
  -e ENCRYPTION_KEY=your-64-char-hex-key \
  -v one-router-data:/app/data \
  xtravisions/one-router:latest

Then open http://localhost:8000/admin, sign in with your master key, add backend credentials, and create API keys for the /v1/* endpoints.

⁠Usage

Point your existing SDK at One Router — no code changes needed.

from openai import OpenAI

client = OpenAI(api_key="sk-...", base_url="http://localhost:8000/v1")
response = client.chat.completions.create(
    model="gpt-4o",  # automatically routed to Claude on Bedrock
    messages=[{"role": "user", "content": "Hello!"}],
)
import anthropic

client = anthropic.Anthropic(api_key="sk-...", base_url="http://localhost
message = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
)

The Codex CLI works too: set its base URL to http://localhost:8000/v1.

Claude Code works too: set ANTHROPIC_BASE_URL=http://localhost:8000 and ANTHROPIC_AUTH_TOKEN=sk-....

⁠Configuration

Infrastructure config comes from environment variables; all runtime settind are managed via the Admin UI.

VariableDefaultDescription
DATABASEsqlite://./data/gateway.dbsqlite://, postgres://,
PORT8000HTTP listen port
HOST0.0.0.0HTTP bind host
LOG_LEVELinfotrace / debug / info / warn / error
MASTER_API_KEY(required in Docker)Admin-only key for /admin
ENCRYPTION_KEY(required in Docker)AES-256 key for credential encryption and API key HMAC
SEED_DEFAULTSemptySeed default model mappings: off / `empty

The container refuses to start without MASTER_API_KEY and `ENCRYPTION_Kpersist the SQLite database.

⁠Endpoints

EndpointDescription
POST /v1/chat/completionsOpenAI protocol chat
POST /v1/messagesAnthropic protocol chat
POST /v1/responsesOpenAI Responses API (Codex CLI)
POST /v1/embeddingsOpenAI-compatible embeddings
POST /v1/rerankCohere-compatible rerank
POST /v1/images/generationsImage generation
GET /v1/usageUsage & cost statistics
GET /metricsPrometheus metrics
GET /adminAdmin Web UI
GET /healthHealth check

Tag summary

Content type

Image

Digest

sha256:5b8fa7774…

Size

48.1 MB

Last updated

6 days ago

docker pull xtravisions/one-router