← all repositories
songquanpeng/one-api

One API: the universal adapter for China's LLM chaos

A single OpenAI-compatible endpoint that fronts two dozen Chinese and Western model providers, complete with key management and billing.

34.7k stars JavaScript Inference · ServingLLMOps · Eval
one-api
Velocity · 7d
+30
★ / day
Trend
steady
star history

What it does

One API is a self-hosted gateway that translates the standard OpenAI API format to 20+ LLM backends—everything from GPT-4 and Claude to DeepSeek, ByteDance Doubao, Baidu Ernie, Alibaba Tongyi, and a parade of other domestic Chinese models. You deploy it as a single binary or Docker container, point your existing OpenAI client at it, and stop rewriting integrations every time a new provider launches.

The interesting bit

The real work isn’t the protocol translation—it’s the operational plumbing around it. One API bundles token-based access control, quota management, load balancing across multiple upstream channels, and even a redemption-code system for charging users. It’s essentially a miniature SaaS platform for reselling API access, which explains its popularity in markets where direct provider access is fragmented or restricted.

Key highlights

  • Supports 20+ providers including OpenAI, Azure, Anthropic, Google Gemini, Mistral, Groq, Ollama, and a who’s-who of Chinese models (DeepSeek, ByteDance, Baidu, Alibaba, iFlytek, Zhipu, 360, Tencent, Moonshot, Baichuan, MiniMax, 01.AI, StepFun)
  • Single binary or Docker deployment with SQLite for small setups, MySQL for production
  • Built-in token management with expiration, IP restrictions, and model allowlists
  • User grouping with custom rate multipliers and channel load balancing
  • Stream mode support, automatic retry on failure, and Cloudflare AI Gateway integration
  • Multiple auth methods: email, GitHub OAuth, Feishu (Lark), and WeChat (via separate server)
  • Management API for extending functionality without forking the codebase

Caveats

  • Default root password is 123456 with an explicit warning to change it immediately
  • Model mapping feature reconstructs request bodies rather than passing them through, which can drop unsupported fields
  • README notes that high-concurrency deployments must use MySQL over SQLite
  • Some features like WeChat login require deploying additional companion services

Verdict

Worth a look if you’re running LLM infrastructure in China or reselling API access to end users. Skip it if you just need a simple reverse proxy—nginx with a few location blocks will do less and complain less.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.