Local and cloud runner for open models such as Gemma, Qwen, DeepSeek and gpt-oss, with a CLI, REST API and Python/JavaScript libraries.
QuantumNous/new-api
A self-hosted AI gateway that exposes OpenAI, Claude and Gemini compatible APIs in front of many upstream model providers, with routing, keys, quotas and cost tracking.
Open-source alternative to:OpenRouter
- Stars
- 50,277
- Forks
- 12,136
- Open issues
- 1,380
- Last commit
- 18 hours ago
What is it?
New API is a self-hosted gateway that sits between your applications and upstream model services such as OpenAI, Anthropic, Google Gemini, Azure OpenAI, AWS Bedrock, Vertex AI and DeepSeek. Clients call one consistent API, and the gateway handles conversion between OpenAI Chat/Responses, Anthropic Messages and Gemini request formats.
The console lets administrators add channels with upstream keys, map model names, set priorities and weights, configure retries, and assign users and groups. API keys can be restricted by group and model, and usage logs, quotas, subscriptions and expression-based pricing track consumption and cost per user.
The project includes a web console available in several languages, OAuth/OIDC and two-factor login, and JavaScript plugins for asynchronous image, video and other task APIs. It supports SQLite, MySQL and PostgreSQL for the main database, optional Redis, and ships with a Docker Compose setup.
Key features
- 01Exposes OpenAI, Anthropic Messages and Gemini compatible endpoints over the same upstream models
- 02Routes requests across multiple channels with model mappings, priorities, weights and retries
- 03Manages users, groups, API keys and quotas with usage logs and cost accounting
- 04Supports OAuth/OIDC, passkeys and two-factor authentication for console login
- 05Extends asynchronous image, video and other task APIs through JavaScript plugins
Use cases
- Sharing authorized model access across a team with per-user quotas and usage tracking
- Switching upstream providers without reconfiguring every client application
- Running a private multi-model service with a web console for administrators
Quick start
- 1
Start a local instance with Docker (SQLite, bound to localhost)
mkdir -p data docker 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:latest - 2
Open http://localhost:3000 and complete the setup wizard to create the admin account
- 3
Add a channel with your upstream API key, configure models and pricing, then create a New API key
- 4
List available models with your key
curl --fail-with-body http://localhost:3000/v1/models \ -H "Authorization: Bearer ${NEW_API_KEY}"
Things to know
- Requires you to supply your own upstream API keys and accounts, and to comply with upstream terms.
- Public generative AI or API resale use carries substantial legal, filing and compliance obligations.
- Licensed under AGPL-3.0, a copyleft license with network-use source disclosure requirements.
Topics
FAQ
- What is new-api?
- A self-hosted AI gateway that exposes OpenAI, Claude and Gemini compatible APIs in front of many upstream model providers, with routing, keys, quotas and cost tracking. New API is a self-hosted gateway that sits between your applications and upstream model services such as OpenAI, Anthropic, Google Gemini, Azure OpenAI, AWS Bedrock, Vertex AI and DeepSeek. Clients call one consistent API, and the gateway handles conversion between OpenAI Chat/Responses, Anthropic Messages and Gemini request formats.
- Is new-api free to use? What license does it have?
- new-api is open source under the AGPL-3.0 license. Check the license terms before using it in commercial products.
- Is new-api still maintained?
- Actively maintained. The last commit to new-api was on Oct 19, 2026.
- What can I use new-api for?
- Sharing authorized model access across a team with per-user quotas and usage tracking Switching upstream providers without reconfiguring every client application Running a private multi-model service with a web console for administrators
- How do I install new-api?
- Start a local instance with Docker (SQLite, bound to localhost): mkdir -p data docker 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:latest Open http://localhost:3000 and complete the setup wizard to create the admin account Add a channel with your upstream API key, configure models and pricing, then create a New API key List available models with your key: curl --fail-with-body http://localhost:3000/v1/models \ -H "Authorization: Bearer ${NEW_API_KEY}"
- Where can I get new-api?
- The source code and installation instructions are on GitHub: https://github.com/QuantumNous/new-api
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
Self-hostable MIT AI gateway that exposes one OpenAI-compatible endpoint to hundreds of model providers, with quota-aware auto-fallback and token compression.
A self-hosted, OpenAI-compatible AI engine that runs LLMs, vision, voice, image and video models on any hardware, including CPU-only machines.
Local inference engine that runs the large Qwen3.8-Flash-Next model on consumer NVIDIA or AMD GPUs under Windows or Linux, with OpenAI and Anthropic compatible APIs.
A local gateway and menu bar app that lets Claude Code, Codex, Gemini CLI and other coding agents use any model from any provider or subscription.
A CLI and web dashboard that benchmarks free coding LLM models across providers and installs the chosen one into your coding tool.