Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
N

new-api

> AI 编程
Open source

A unified AI model hub for aggregation & distribution. It supports cross-converting various LLMs into OpenAI-compatible, Claude-compatible, or Gemini-compatible

44.1K stars0 likes5 views
WebsiteGitHub

About

A unified AI model hub for aggregation & distribution. It supports cross-converting various LLMs into OpenAI-compatible, Claude-compatible, or Gemini-compatible

📝 Project Description

[!IMPORTANT]

  • This project is intended solely for lawful and authorized AI API gateway, organization-level authentication, multi-model management, usage analytics, cost accounting, and private deployment scenarios.
  • Users must lawfully obtain upstream API keys, accounts, model services, and interface permissions, and must comply with upstream terms of service and applicable laws and regulations.
  • Users should ensure their use complies with upstream terms of service and applicable laws and regulations.
  • When providing generative AI services to the public, users should comply with applicable regulatory requirements and fulfill all filing, licensing, content safety, real-name verification, log retention, tax, and upstream authorization obligations required by their jurisdiction.

🤝 Trusted Partners

No particular order


🙏 Special Thanks

Thanks to JetBrains for providing free open-source development license for this project


🚀 Quick Start

Using Docker Compose (Recommended)

bash
# Clone the project
git clone https://github.com/QuantumNous/new-api.git
cd new-api

# Edit docker-compose.yml configuration
nano docker-compose.yml

# Start the service
docker-compose up -d
Using Docker Commands
bash
# Pull the latest image
docker pull calciumion/new-api:latest

# Using SQLite (default)
docker run --name new-api -d --restart always \
  -p 3000:3000 \
  -e TZ=Asia/Shanghai \
  -v ./data:/data \
  calciumion/new-api:latest

# Using MySQL
docker run --name new-api -d --restart always \
  -p 3000:3000 \
  -e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" \
  -e TZ=Asia/Shanghai \
  -v ./data:/data \
  calciumion/new-api:latest

💡 Tip: -v ./data:/data will save data in the data folder of the current directory, you can also change it to an absolute path like -v /your/custom/path:/data


🎉 After deployment is complete, visit http://localhost:3000 to start using!

[!WARNING] When operating this project as a public generative AI service or API resale service, users should first complete all required filing, licensing, content safety, real-name verification, log retention, tax, payment, and upstream authorization obligations.

📖 For more deployment methods, please refer to Deployment Guide


📚 Documentation

Quick Navigation:

Category Link
🚀 Deployment Guide Installation Documentation
⚙️ Environment Configuration Environment Variables
📡 API Documentation API Documentation
❓ FAQ FAQ
💬 Community Interaction Communication Channels

✨ Key Features

For detailed features, please refer to Features Introduction

🎨 Core Functions

Feature Description
🎨 New UI Modern user interface design
🌍 Multi-language Supports Simplified Chinese, Traditional Chinese, English, French, Japanese
🔄 Data Compatibility Fully compatible with the original One API database
📈 Data Dashboard Visual console and statistical analysis
🔒 Permission Management Token grouping, model restrictions, user management

💰 Authorized Usage Accounting and Billing

  • ✅ Internal top-up and quota allocation for lawful authorized scenarios (EPay, Stripe)
  • ✅ Organization-level per-request, usage-based, and cache-hit cost accounting
  • ✅ Cache billing statistics for OpenAI, Azure, DeepSeek, Claude, Qwen, and supported models
  • ✅ Flexible billing policies for internal management or authorized enterprise customers

🔐 Authorization and Security

  • 😈 Discord authorization login
  • 🤖 LinuxDO authorization login
  • 📱 Telegram authorization login
  • 🔑 OIDC unified authentication
  • 🔍 Key quota query usage (with new-api-key-tool)

🚀 Advanced Features

API Format Support:

  • ⚡ OpenAI Responses
  • ⚡ OpenAI Realtime API (including Azure)
  • ⚡ Claude Messages
  • ⚡ Google Gemini
  • 🔄 Rerank Models (Cohere, Jina)

Intelligent Routing:

  • ⚖️ Channel weighted random
  • 🔄 Automatic retry on failure
  • 🚦 User-level model rate limiting

Format Conversion:

  • 🔄 OpenAI Compatible ⇄ Claude Messages
  • 🔄 OpenAI Compatible → Google Gemini
  • 🔄 Google Gemini → OpenAI Compatible - Text only, function calling not supported yet
  • 🚧 OpenAI Compatible ⇄ OpenAI Responses - In development
  • 🔄 Thinking-to-content functionality

Reasoning Effort Support:

View detailed configuration

OpenAI series models:

  • o3-mini-high - High reasoning effort
  • o3-mini-medium - Medium reasoning effort
  • o3-mini-low - Low reasoning effort
  • gpt-5-high - High reasoning effort
  • gpt-5-medium - Medium reasoning effort
  • gpt-5-low - Low reasoning effort

Claude thinking models:

  • claude-3-7-sonnet-20250219-thinking - Enable thinking mode

Google Gemini series models:

  • gemini-2.5-flash-thinking - Enable thinking mode
  • gemini-2.5-flash-nothinking - Disable thinking mode
  • gemini-2.5-pro-thinking - Enable thinking mode
  • gemini-2.5-pro-thinking-128 - Enable thinking mode with thinking budget of 128 tokens
  • You can also append -low, -medium, or -high to any Gemini model name to request the corresponding reasoning effort (no extra thinking-budget suffix needed).

🤖 Model Support

For details, please refer to API Documentation - Gateway Interface

Model Type Description Documentation
🤖 OpenAI-Compatible OpenAI compatible models Documentation
🤖 OpenAI Responses OpenAI Responses format Documentation
🎨 Midjourney-Proxy Midjourney-Proxy(Plus) Documentation
🎵 Suno-API Suno API Documentation
🔄 Rerank Cohere, Jina Documentation
💬 Claude Messages format Documentation
🌐 Gemini Google Gemini format Documentation
🔧 Dify ChatFlow mode -
🎯 Custom upstream Supports configuring legally authorized upstream endpoints -

📡 Supported Interfaces

View complete interface list
  • Chat Interface (Chat Completions)
  • Response Interface (Responses)
  • Image Interface (Image)
  • Audio Interface (Audio)
  • Video Interface (Video)
  • Embedding Interface (Embeddings)
  • Rerank Interface (Rerank)
  • Realtime Conversation (Realtime)
  • Claude Chat
  • Google Gemini Chat

🚢 Deployment

[!TIP] Latest Docker image: calciumion/new-api:latest

📋 Deployment Requirements

Component Requirement
Local database SQLite (Docker must mount /data directory)
Remote database MySQL ≥ 5.7.8 or PostgreSQL ≥ 9.6
Container engine Docker / Docker Compose
System architecture 64-bit only (amd64 / arm64); 32-bit systems are not supported

⚙️ Environment Variable Configuration

Common environment variable configuration
Variable Name Description Default Value
SESSION_SECRET Authentication signing secret; must be identical on every node -
SESSION_COOKIE_SECURE false/unset disables the refresh/logout OriginGuard for local HTTP dev proxies; true enables the Secure cookie and strict Origin checks false
SESSION_COOKIE_TRUSTED_URL Required with Secure mode: comma-separated exact HTTPS Origins allowed to call refresh/logout; not a relay CORS allowlist -
TRUSTED_PROXIES Unset/blank trusts loopback, RFC 1918 and IPv6 ULA with a startup warning; none trusts no proxies; an explicit proxy IP/CIDR list replaces the defaults 127.0.0.0/8, ::1, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, fc00::/7
USER_SESSION_ACTIVE_LIMIT Maximum active login Sessions per user 50
USER_SESSION_ISSUANCE_LIMIT Maximum Sessions created per user within the issuance window, including revoked Sessions 100
USER_SESSION_ISSUANCE_WINDOW_SECONDS Per-user Session issuance window; clamped to the revoked retention period when configured higher 86400
USER_SESSION_REVOKED_RETENTION_DAYS Days to retain revoked Session rows for audit and issuance accounting 7
USER_SESSION_HOURLY_ALERT_THRESHOLD Global Sessions created per hour that triggers an alert only; it never blocks login 5000
CRYPTO_SECRET HMAC secret for cache keys; nodes sharing Redis must use the same effective value Defaults to SESSION_SECRET
SQL_DSN Database connection string -
REDIS_CONN_STRING Redis connection string -
RELAY_IDLE_CONN_TIMEOUT Idle keep-alive timeout for relay HTTP clients, seconds. Defaults to Go standard library behavior; set 0 to disable 90
RELAY_RESPONSE_HEADER_TIMEOUT How long the relay waits for upstream response headers, seconds; set 0 to disable. Only bounds the header wait -- streaming after the headers arrive is unaffected. Note that non-streaming upstreams usually send headers only once generation finishes, so leave headroom 1800
STREAMING_TIMEOUT Streaming timeout (seconds) 300
`STREAM_SCANNER_MAX_BU

Issues· 1364 open

View all issuesOpen on GitHub
  • #7619

    Docker Compose 部署 pg 密码问题

    bugmissing reproduction stepsUpdated Sep 30, 2026
  • #7618

    newapi 很多人机账户怎么批量删除

    bugenhancementmissing reproduction stepsUpdated Sep 30, 2026
  • #7613

    [Bug] PassKey验证逻辑矛盾,root无法在多台设备上登录

    bugUpdated Sep 30, 2026
  • #7617

    功能建议:支持使用 OIDC 身份令牌调用 API(或提供令牌交换端点)

    enhancementUpdated Sep 30, 2026
  • #7612

    [Bug] 客户端时区与服务器时区不匹配时,无法进行修改密码、PassKey等操作

    bugUpdated Sep 29, 2026
  • #7611

    Bug: 模型定价页无法删除内置默认计费模型行(gpt-image-2 等),删除操作静默无效

    Updated Sep 29, 2026
  • #4051

    [Feature Request] Support custom navigation menu items in header

    staleUpdated Sep 29, 2026
  • #4014

    [Bug] EditChannelModal white screen on HTTP when creating new channel — clipboard.readText TypeError

    bugstaleUpdated Sep 29, 2026
  • #3533

    Jimeng video task polling uses wrong req_key / empty aspect_ratio causes task failure in v0.11.9

    bugstaleUpdated Sep 29, 2026
  • #3537

    multi_to_single 模式下被自动禁用的 key 无法自动恢复

    bugstaleUpdated Sep 29, 2026

> Tags

Goai-gatewayclaudedeepseekgemini

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 30, 2026
CategoryAI 编程
PricingOpen source

> Related tools

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.