Unified AI API Gateway — Multi-provider routing, token saving, semantic cache, and intelligent fallback.
Connect all your AI coding tools (Claude Code, Cursor, Codex, Cline) to 40+ providers through a single OpenAI-compatible endpoint.
- Why OninOneProxy?
- Features
- Feature Comparison
- Quick Start
- Supported CLI Tools
- Environment Variables
- Architecture
- Relationship with 9Router
- Contributing
- Development
- License
- Acknowledgments
OninOneProxy is a unified AI gateway and LLM proxy that turns a tangle of API keys, OAuth tokens, and incompatible request formats into one clean, OpenAI-compatible endpoint. Below are the differentiators that set it apart from generic multi-provider routers.
Stop wrestling with provider-specific SDKs. OninOneProxy translates between OpenAI, Anthropic (Claude), and Gemini request formats transparently, so your Claude Code proxy, Cursor proxy, and Codex setup all speak the same /v1/* API. Whether your tool emits messages (Anthropic), contents (Gemini), or chat/completions (OpenAI), the gateway normalizes it on the fly and translates the response back to the format your client expects.
Every request passes through an RTK (Result Token Kit) pipeline that compresses verbose tool_result payloads, plus optional Headroom, Caveman, and Ponytail savers. Combined, these cut token consumption by 20–40% without altering the semantic content your model sees — lowering latency and subscription burn on every call.
A vector-based semantic cache (HNSW index) serves repeated and near-duplicate prompts from cache, slashing cost on reruns. Two guards keep correctness intact:
- Temperature bucket guard — caches only within strict temperature buckets, so
temperature=0.2andtemperature=0.9never collide. - Tools detection — when a request contains
tools, the cache is automatically bypassed, so tool-calling turns are always fresh.
The smart router picks the cheapest healthy provider per request, with tiered fallback from subscription → cheap → free. OninOneProxy also introduces Fusion multi-model collaboration: a single request can be dispatched across multiple models in parallel, then synthesized and reviewed by a judge model — giving you consensus-style answers without orchestrating multiple clients.
Pool multiple API keys per provider and aggregate their rate limits. Seven accounts at 5 RPM each become a single 35 RPM budget — ideal for bursty workloads that would otherwise hit per-key ceilings. OAuth credential rotation and anti-ban logic keep multi-account setups stable over long sessions.
- 40+ Provider Support — OpenRouter, GLM, Kimi, DeepSeek, GitHub Copilot, Claude Code, Codex, Cursor OAuth, and more
- OpenAI-Compatible API — Single
/v1/*endpoint serves all AI tools - Format Translation — Automatic OpenAI ↔ Claude ↔ Gemini conversion
- Multi-Account Fallback — Round-robin between accounts per provider
- OAuth Credential Management — Claude Code, Codex, Cursor, GitHub OAuth support
- Token Refresh — Automatic OAuth token refresh
- Quota & Usage Tracking — Per-provider / per-account quota tracking
- HNSW Semantic Cache — Vector-based response caching with HNSW indexing for cache hit rate optimization
- Temperature Bucket Guard — Temperature-bucketed cache to protect output correctness
- Tools Detection — Smart cache bypass when tools are detected in requests
- Multi-APIKEY Aggregation — Aggregate multiple API keys per provider for higher rate limits
- Rate Limit Pooling — Combine rate limits across accounts (e.g., 7×5RPM = 35RPM)
- Fusion Multi-Model Collaboration — Parallel multi-model dispatch + synthesized review
- RTK Token Saver — Auto-compress tool_result content, save 20-40% tokens
- LRU Memory Management — O(1) eviction with memory monitoring and
--max-old-space-size=1024
- Docker Support —
docker-compose up -done-command deploy - Dashboard Web UI — Provider management, usage stats, model testing
- SQLite Persistence — Reliable data storage with adapter fallback chain
- Automatic Data Cleanup — 24-hour cleanup timer with Dashboard UI control
- Domestic Direct Connection — Direct connection bypass for China mainland providers
- Provider Naming Validation —
normalizeProviderIdwith HTTP 400 error for invalid names
| Feature | OninOneProxy | 9Router | One API | New API |
|---|---|---|---|---|
| Multi-provider routing | ✅ | ✅ | ✅ | ✅ |
| OpenAI-compatible API | ✅ | ✅ | ✅ | ✅ |
| Format translation (OpenAI↔Claude↔Gemini) | ✅ | ✅ | ❌ | ❌ |
| Semantic cache (HNSW) | ✅ | ❌ | ❌ | ❌ |
| Temperature bucket guard | ✅ | ❌ | ❌ | ❌ |
| Tools detection (cache bypass) | ✅ | ❌ | ❌ | ❌ |
| Multi-APIKEY aggregation | ✅ | ❌ | ❌ | ❌ |
| Rate limit pooling | ✅ | ❌ | ❌ | ❌ |
| RTK token saver | ✅ | ✅ | ❌ | ❌ |
| Fusion multi-model collaboration | ✅ | ❌ | ❌ | ❌ |
| OAuth credential management | ✅ | ✅ | ❌ | ❌ |
| Domestic direct connection (China) | ✅ | ❌ | ❌ | ❌ |
| Dashboard Web UI | ✅ | ✅ | ✅ | ✅ |
# 1. Clone
git clone https://github.com/Vincent-A-Yang/OninOneProxy.git
cd OninOneProxy
# 2. Configure
cp .env.example .env
# Edit .env: set JWT_SECRET, INITIAL_PASSWORD, API_KEY_SECRET
# 3. Build and run
docker-compose up -d
# 4. Access Dashboard
# Open http://localhost:20130/dashboard
# 5. Connect your AI tool
# Endpoint: http://localhost:20130/v1
# API Key: [copy from dashboard]git clone https://github.com/Vincent-A-Yang/OninOneProxy.git
cd OninOneProxy
cp .env.example .env
npm install
# Development mode
PORT=20130 NEXT_PUBLIC_BASE_URL=http://localhost:20130 npm run dev
# Production mode
npm run build
PORT=20130 HOSTNAME=0.0.0.0 NEXT_PUBLIC_BASE_URL=http://localhost:20130 npm run start- Dashboard: http://localhost:20130/dashboard
- OpenAI-Compatible API: http://localhost:20130/v1
Configure your AI coding tool (Claude Code, Codex, Cursor, etc.):
Endpoint: http://localhost:20130/v1
API Key: [copy from dashboard]
Model: [select from dashboard provider list]
OninOneProxy works as a universal API router with all major AI coding tools:
| Tool | Status |
|---|---|
| Claude Code | ✅ Supported |
| Codex | ✅ Supported |
| Cursor | ✅ Supported |
| OpenCode | ✅ Supported |
| Cline | ✅ Supported |
| Copilot | ✅ Supported |
| Antigravity | ✅ Supported |
| OpenClaw | ✅ Supported |
| Continue | ✅ Supported |
| Roo / Kilo Code | ✅ Supported |
Copy .env.example to .env and configure.
| Variable | Description | Default |
|---|---|---|
JWT_SECRET |
Session cookie signing secret | Generate your own |
INITIAL_PASSWORD |
Initial admin password | Override required |
API_KEY_SECRET |
API key generation secret | Generate your own |
MACHINE_ID_SALT |
Machine ID generation salt | Generate your own |
| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 20130 |
HOSTNAME |
Server hostname | 0.0.0.0 |
DATA_DIR |
Data directory path | ~/.oninoneproxy/ |
DEBUG |
Debug mode | false |
HEADROOM_URL |
Headroom token saver URL | (disabled) |
NEXT_PUBLIC_BASE_URL |
Public base URL | http://localhost:20130 |
Security: Never commit your
.envfile. The.gitignorealready excludes.env*files (except.env.example).
┌─────────────┐
│ Your CLI │ (Claude Code, Codex, Cursor, Cline...)
│ Tool │
└──────┬──────┘
│ http://localhost:20130/v1
↓
┌─────────────────────────────────────────────────────┐
│ OninOneProxy (Smart Router) │
│ • RTK Token Saver (cut tool_result tokens) │
│ • HNSW Semantic Cache (vector-based caching) │
│ • Format translation (OpenAI ↔ Claude ↔ Gemini) │
│ • Multi-APIKEY aggregation │
│ • Quota tracking + auto fallback │
│ • Auto token refresh │
└──────┬──────────────────────────────────────────────┘
│
├─→ [Tier 1: SUBSCRIPTION] Claude Code, Codex, GitHub Copilot
│ ↓ quota exhausted
├─→ [Tier 2: CHEAP] GLM ($0.6/1M), MiniMax ($0.2/1M)
│ ↓ budget limit
└─→ [Tier 3: FREE] Kiro, OpenCode Free, Vertex ($300 credits)
For full architecture details, see docs/ARCHITECTURE.md.
OninOneProxy is a derivative distribution of 9Router:
- Not an official fork — This project is independently maintained
- Preserves attribution — Original 9Router copyright (
decolua and contributors) is retained in the LICENSE - Adds operational extensions — Multi-APIKEY aggregation, HNSW caching, memory management, etc.
- Shares upstream improvements — General improvements may be contributed back to 9Router
General improvements that benefit both projects are welcome to be contributed back to the upstream 9Router repository via Pull Requests. OninOneProxy-specific extensions (caching, aggregation) may remain in this distribution.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
To report a security vulnerability, please see SECURITY.md.
- Node.js ≥ 18
- npm or bun
npm install
npm run build# Install test dependencies
cd tests && npm install && cd ..
# Run tests (from repo root)
npx vitest runThe test suite is not expected to be all-green on a plain checkout. See
tests/__baseline__/for regression baselines.
npx eslint .PORT=20130 NEXT_PUBLIC_BASE_URL=http://localhost:20130 npm run devMIT License — Copyright (c) 2024-2026 decolua and contributors