new-api
Open-source AI gateway. Self-hosted LLM gateway with OpenAI-, Claude- and Gemini-compatible APIs, model routing, access control, usage tracking and cost account
What is new-api?
Open-source AI gateway. Self-hosted LLM gateway with OpenAI-, Claude- and Gemini-compatible APIs, model routing, access control, usage tracking and cost accounting.
Overview of new-api
What it is
New API is an open-source, self-hosted AI gateway designed for models, applications, and agents. It aggregates and distributes access to upstream AI model services by exposing a consistent API to clients. The project can convert various large language models (LLMs) into OpenAI-compatible, Claude-compatible, or Gemini-compatible formats, acting as a centralized gateway for personal and enterprise model management.
Key features
- Supports model access via OpenAI Chat Completions, Responses, Anthropic Messages, and Gemini APIs, including streaming, tools, reasoning, and multimodal inputs.
- Provides routing capabilities such as model mappings, channel priorities and weights, retries, channel affinity, and multiple upstream keys.
- Manages usage and costs with quotas, subscriptions, usage logs, cache accounting, and expression-based pricing for different usage tiers.
- Offers access control through users, groups, fine-grained permissions, API key restrictions, OAuth/OIDC, passkeys, two-factor authentication, and login session management.
- Includes a web console for configuring channels and models, inspecting usage and audit logs, and trying models in a playground; supports multiple languages including English, Simplified Chinese, Traditional Chinese, French, Japanese, Russian, and Vietnamese.
Use cases
New API is suitable for sharing authorized model access across a team, switching providers without reconfiguring every client, or operating a private multi-model service with a web console. It can serve as an internal gateway for organizations needing unified model management and cost accounting.
Getting started
To try locally with Docker:bashmkdir -p datadocker run --name new-api -d --restart unless-stopped -p 127.0.0.1:3000:3000 -e TZ=Asia/Shanghai -v $(pwd)/data:/data calciumion/new-api:latestOpen http://localhost:3000 and complete the setup wizard. For Docker Compose deployment, clone the repository and follow the instructions in the README. For production use, configure environment variables such as SQL_DSN, SESSION_SECRET, and REDIS_CONN_STRING as documented.
License and pricing
The project is open source under the AGPL-3.0 license.
Based on the project's public README and repository metadata.