# One API — Unified LLM Gateway for OpenAI, Claude, and Gemini > A self-hosted API management and distribution system that aggregates multiple LLM providers behind a single OpenAI-compatible interface with load balancing, rate limiting, and token quota management. ## Install Save in your project root: # One API — Unified LLM Gateway for OpenAI, Claude, and Gemini ## Quick Use ```bash # Run with Docker docker run -d --restart always --name one-api -p 3000:3000 -e TZ=UTC -v /home/ubuntu/data/one-api:/data justsong/one-api # Then configure channels and tokens via the web UI at http://localhost:3000 ``` ## Introduction One API is a self-hosted LLM API gateway that lets you access OpenAI, Anthropic Claude, Google Gemini, and dozens of other providers through a single OpenAI-compatible endpoint. Teams use it to centralize API key management, enforce usage quotas, and switch between providers without changing application code. ## What One API Does - Aggregates 30+ LLM providers behind one unified API endpoint compatible with the OpenAI format - Manages API keys, user tokens, and per-user quota limits through a web dashboard - Load-balances requests across multiple provider channels with automatic failover - Tracks token usage and costs per user, per channel, and per model - Supports streaming responses, function calling, and vision models across providers ## Architecture Overview One API is a Go application backed by SQLite or MySQL. The web dashboard is built with React. Incoming requests are routed through a channel selection layer that picks the best available provider based on priority, weight, and health status. Each channel wraps a specific provider adapter that translates between the OpenAI format and the native API format. ## Self-Hosting & Configuration - Deploy via Docker, Docker Compose, or a single binary on Linux, macOS, or Windows - Set the database with `SQL_DSN` for MySQL or use the default embedded SQLite - Add provider channels through the admin UI with API keys and model mappings - Create user tokens with optional rate limits, expiration, and quota caps - Enable Redis for distributed rate limiting in multi-instance deployments ## Key Features - OpenAI-compatible endpoint means zero code changes for existing applications - Built-in billing system tracks token consumption and supports recharge codes - Channel priority and weight system for cost optimization across providers - Automatic retry and failover when a provider returns errors or timeouts - Model mapping lets you expose custom model names that route to any backend ## Comparison with Similar Tools - **LiteLLM** — Python-based proxy; One API offers a full admin UI with quota management - **OpenRouter** — Managed service; One API is fully self-hosted with no third-party dependency - **Portkey AI Gateway** — Focused on observability; One API emphasizes multi-tenant billing - **API Gateway (Kong/APISIX)** — General-purpose; One API is purpose-built for LLM token economics - **Helicone** — Logging-focused proxy; One API adds load balancing and provider aggregation ## FAQ **Q: Which LLM providers does One API support?** A: OpenAI, Azure OpenAI, Anthropic Claude, Google Gemini, AWS Bedrock, Mistral, DeepSeek, Ollama, and many more. New providers are added regularly. **Q: Can I use One API with existing OpenAI SDK code?** A: Yes. Point the `base_url` to your One API instance and use the issued token as the API key. No other changes are needed. **Q: Does it support streaming?** A: Yes. Streaming, function calling, and multimodal (vision) requests are fully supported across compatible providers. **Q: How does quota management work?** A: Admins set token quotas per user. Each request deducts from the quota based on actual token usage reported by the provider. ## Sources - https://github.com/songquanpeng/one-api - https://openai.justsong.cn/ --- Source: https://tokrepo.com/en/workflows/asset-1039cfd7 Author: AI Open Source