# One API — Unified LLM API Gateway (Docker) > One API is a self-hosted LLM API gateway: unify OpenAI/Claude/Gemini/DeepSeek endpoints, manage keys, and deploy via Docker in minutes (33.7k★). ## Install Save as a script file and run: ## Quick Use ```bash docker run --name one-api -d --restart always -p 3000:3000 -e TZ=Asia/Shanghai -v /home/ubuntu/data/one-api:/data justsong/one-api # Optional MySQL: add SQL_DSN env var (see README) docker-compose up -d # alternative compose deployment ``` ## Intro One API is a self-hosted LLM API gateway: unify OpenAI/Claude/Gemini/DeepSeek endpoints, manage keys, and deploy via Docker in minutes (33.7k★). **Best for:** Developers who want one endpoint for multiple providers, with centralized key management and predictable routing for agents **Works with:** Docker (recommended), optional MySQL, and downstream clients that can point to a single OpenAI-compatible base URL **Setup time:** 10-30 minutes ## Main - **Multi-provider gateway**: positioned as a unified API layer for many model providers, so agents can talk to “one base URL” instead of custom clients per vendor. - **Docker-first deployment**: the README provides runnable `docker run` commands (SQLite and MySQL variants) and a Compose option. - **Operational knobs**: documents env vars and multi-node notes (session secret, sync frequency, Redis) for production-ish usage. - **Good for agent fleets**: centralizes key/quotas so you can rotate credentials without touching every agent or tool. ### FAQ - **Do I need MySQL?**: No. The README shows an SQLite-based docker run; use MySQL when you need multi-node or stronger persistence. - **How do I upgrade safely?**: The README suggests a watchtower-based update command; test on a staging instance first. - **What is the first integration?**: Point one client at the gateway base URL and verify a single model call before migrating everything. ## Source & Thanks > Source: https://github.com/songquanpeng/one-api > License: MIT > GitHub stars: 33663 · forks: 6429 --- ## Quick Use ```bash docker run --name one-api -d --restart always -p 3000:3000 -e TZ=Asia/Shanghai -v /home/ubuntu/data/one-api:/data justsong/one-api # 可选 MySQL:按 README 加 SQL_DSN 环境变量 docker-compose up -d # 也可用 compose 部署 ``` ## Intro One API 是自建 LLM API 网关:统一 OpenAI/Claude/Gemini/DeepSeek 等接口,集中管理 key/额度,并可用 Docker 快速部署(33663★)。 **Best for:** 想把多个供应商收敛成一个统一入口,并集中管理 key/配额,让 agent 调用更可控的开发者 **Works with:** Docker(推荐)、可选 MySQL,以及能配置统一 OpenAI-compatible base URL 的下游客户端/应用 **Setup time:** 10-30 minutes ## Main - **多供应商统一入口**:把多家模型提供方收敛成一个 API 层,让 agent 只需要配置一个 base URL。 - **Docker 优先**:README 给出可直接运行的 `docker run`(SQLite/MySQL)与 Compose 部署方式。 - **生产化参数**:文档包含环境变量、多机部署注意事项(SESSION_SECRET、同步、Redis 等)。 - **适合 agent fleet**:集中管理 key/额度,轮换凭据不用逐个改每个 agent/工具。 ### FAQ - **必须用 MySQL 吗?**: 不必。README 有 SQLite 的 docker run;需要多机/更强持久化时再上 MySQL。 - **怎么安全升级?**: README 给出 watchtower 更新命令;建议先在 staging 验证再升级生产。 - **先集成哪一步?**: 先让一个客户端指向 gateway base URL,跑通一次调用,再逐步迁移。 ## Source & Thanks > Source: https://github.com/songquanpeng/one-api > License: MIT > GitHub stars: 33663 · forks: 6429 --- Source: https://tokrepo.com/en/workflows/one-api-unified-llm-api-gateway-docker Author: AI Open Source