New API
New API is a self-hosted AI gateway and model hub that unifies access to multiple AI providers through OpenAI-, Claude-, and Gemini-compatible APIs, with routing, access, usage, and cost management in one console.
Visit QuantumNous/new-apiOverview
New API is a self-hosted AI gateway for applications, agents, and teams. It connects upstream model services such as OpenAI, Anthropic, Google Gemini, Azure OpenAI, AWS Bedrock, Vertex AI, DeepSeek, and Qwen, then exposes consistent APIs to clients while centralizing routing, access control, usage tracking, and cost accounting.
Key Features
- Unified access to 30+ AI providers and 100+ models through a single endpoint.
- Support for OpenAI Chat Completions and Responses, Anthropic Messages, and Gemini APIs, with streaming, tools, reasoning, and multimodal inputs where supported.
- Routing controls including model mappings, channel priorities and weights, retries, channel affinity, and multiple upstream keys.
- Usage and cost management with quotas, subscriptions, usage logs, cache accounting, and expression-based pricing for different usage tiers.
- Access control with users, groups, fine-grained permissions, API key restrictions, OAuth/OIDC, passkeys, two-factor authentication, and login session management.
- A web console for configuring channels and models, inspecting usage and audit logs, and trying models in the playground, available in multiple languages.
Use Cases
- Share authorized model access across a team while switching upstream providers without reconfiguring every client.
- Operate a private multi-model service with a web console for channels, models, usage, and costs.
- Centralize organization-level authentication, multi-model management, usage analytics, cost accounting, and private deployment.
Getting Started
- Start a single local instance with Docker and SQLite, persist data in a mounted data directory, then open the console on port 3000 and complete the setup wizard to create the administrator account.
- Add a channel with an upstream API key, available models, and group assignment, then run a channel test.
- Configure model pricing and ensure the user has quota or a valid subscription, then create an API key in the console for the same group and models.
- Point OpenAI-compatible clients at the local /v1 base URL with the New API-issued key; list accessible models through GET /v1/models and call supported endpoints such as /v1/responses.
Deployment & Requirements
- Main database options are SQLite, MySQL 5.7.8 or later, or PostgreSQL 9.6 or later; a separate log database can be configured with LOG_SQL_DSN, including ClickHouse.
- Redis is optional for caching; application nodes that need shared rate limits must use shared Redis.
- The repository Docker Compose configuration starts New API with PostgreSQL and Redis by default and includes examples for MySQL and a separate ClickHouse log database.
- Before starting Docker Compose, replace database and Redis example passwords and set a persistent random SESSION_SECRET.
- For an HTTPS console, set SESSION_COOKIE_SECURE=true and SESSION_COOKIE_TRUSTED_URL to exact public HTTPS origins without paths or wildcards.
Before You Adopt
- License: AGPL-3.0. Review its terms before using, modifying, or distributing the project.
- Operating as a public generative AI service or API resale service requires completing filing, licensing, content safety, real-name verification, log retention, tax, payment, and upstream authorization obligations.
- Users must lawfully obtain upstream API keys, accounts, model services, and interface permissions and comply with upstream terms and applicable laws.
- Feature availability depends on the channel, upstream model, and conversion path; protocol-specific tools and fields may not map exactly, and WebSocket support requires a compatible upstream and channel configuration.
- Production operation requires HTTPS behind a reverse proxy configured for streaming and WebSocket upgrades, plus persistent backups; multi-node deployments must share the main database and authentication secrets.