能力标签
新一代AI工具
🛠
AI工具

新一代AI工具

基于 Go · 开源免费,本地部署,数据完全自主可控
英文名:new-api
⭐ 35.8k Stars 🍴 8.1k Forks 💻 Go 📄 AGPL-3.0 🏷 AI 8.5分
8.5AI 综合评分
ai-gatewayclaudedeepseekgemini
✦ AI Skill Hub 推荐

新一代AI工具 是 AI Skill Hub 本期精选AI工具之一。在 GitHub 上收获超过 35.8k 颗 Star,综合评分 8.5 分,整体质量较高。我们强烈推荐将其纳入你的 AI 工具库,帮助提升工作效率。

📚 深度解析

新一代AI工具 是一款基于 Go 的开源工具,在 GitHub 上收获 36k+ Star,是ai-gateway、claude、deepseek、gemini领域中的优质开源项目。开源工具的最大优势在于代码完全透明,你可以审计每一行代码的安全性,也可以根据自身需求进行二次开发和定制。

**为什么要使用开源工具而非商业 SaaS?**
对于个人开发者和有隐私需求的用户,本地部署的开源工具意味着数据不离本机,不受第三方服务商的数据政策约束。同时,开源工具通常没有使用次数限制和月度费用,一次安装即可长期使用,对于高频使用场景的总拥有成本(TCO)远低于订阅制商业工具。

**安装与环境准备**
新一代AI工具 依赖 Go 运行环境。建议通过 pyenv(Python)或 nvm(Node.js)管理 Go 版本,避免全局环境污染。对于新手用户,推荐先创建虚拟环境(python -m venv venv && source venv/bin/activate),再安装依赖,这样即使出现问题也可以随时删除虚拟环境重新开始,不影响系统稳定性。

**社区与维护**
GitHub Issue 和 Discussion 是获取帮助的最快渠道。在提问前建议先检查 Closed Issues(已关闭的问题),大多数常见问题都已有解答。遇到 Bug 时,提供 pip list 的输出、完整错误堆栈和最小可复现示例,能显著提高开发者响应速度。AI Skill Hub 将持续追踪 新一代AI工具 的版本更新,及时通知重要功能变化。

📋 工具概览

新一代AI工具 是一款基于 Go 开发的开源工具,专注于 ai-gateway、claude、deepseek 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。

GitHub Stars
⭐ 35.8k
开发语言
Go
支持平台
Windows / macOS / Linux(跨平台)
维护状态
活跃维护,更新频繁
开源协议
AGPL-3.0
AI 综合评分
8.5 分
工具类型
AI工具
Forks
8.1k

📖 中文文档

以下内容由 AI Skill Hub 根据项目信息自动整理,如需查看完整原始文档请访问底部「原始来源」。

新一代AI工具 是一款基于 Go 开发的开源工具,专注于 ai-gateway、claude、deepseek 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。

📌 核心特色
  • 开源免费,支持本地部署,数据完全自主可控
  • 活跃的 GitHub 开源社区,持续迭代更新
  • 提供详细文档和使用示例,新手友好
  • 支持自定义配置,灵活适配不同使用环境
  • 可作为基础组件集成进现有技术栈或进行二次开发
🎯 主要使用场景
  • 本地部署运行,保护数据隐私,满足合规要求
  • 自定义集成到现有系统,扩展技术栈能力
  • 作为开源基础组件进行商业化二次开发
以下安装命令基于项目开发语言和类型自动生成,实际以官方 README 为准。
安装命令
# 方式一:go install(推荐)
go install github.com/QuantumNous/new-api@latest

# 方式二:从源码编译
git clone https://github.com/QuantumNous/new-api
cd new-api
go build -o new-api .

# 方式三:下载预编译二进制
# 访问 Releases 页面下载对应平台二进制文件
# https://github.com/QuantumNous/new-api/releases
📋 安装步骤说明
  1. 访问 GitHub 仓库页面
  2. 按照 README 文档完成依赖安装
  3. 根据系统环境完成初始化配置
  4. 参考官方示例或文档开始使用
  5. 遇到问题可在 GitHub Issues 中查找解答
以下用法示例由 AI Skill Hub 整理,涵盖最常见的使用场景。
常用命令 / 代码示例
# 查看帮助
new-api --help

# 基本运行
new-api [options] <input>

# 详细使用说明请查阅文档
# https://github.com/QuantumNous/new-api
以下配置示例基于典型使用场景生成,具体参数请参照官方文档调整。
配置示例
# new-api 配置说明
# 查看配置选项
new-api --config-example > config.yml

# 常见配置项
# output_dir: ./output
# log_level: info
# workers: 4

# 环境变量(覆盖配置文件)
export NEW_API_CONFIG="/path/to/config.yml"
📑 README 深度解析 真实文档 完整度 74/100 查看 GitHub 原文 →
以下内容由系统直接从 GitHub README 解析整理,保留代码块、表格与列表结构。

简介

new-api

📝 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.

---

✨ Key Features

For detailed features, please refer to Features Introduction

🚀 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:

<details> <summary>View detailed configuration</summary>

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).

</details>

---

📋 Deployment Requirements

ComponentRequirement
**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

Edit docker-compose.yml configuration

nano docker-compose.yml

🚢 Deployment

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

🔧 Deployment Methods

<details> <summary><strong>Method 1: Docker Compose (Recommended)</strong></summary>

```bash

⚠️ Multi-machine Deployment Considerations

[!WARNING] - All nodes must use the same primary database and the same SESSION_SECRET; otherwise Access Tokens, refresh sessions, and temporary authentication flows cannot be verified consistently. - Nodes connected to the same Redis must also use the same CRYPTO_SECRET, or their cache-key digests will differ and shared entries cannot be reused consistently.

The database is authoritative for login Sessions and for the per-user active/issuance limits. Redis Session entries are short-lived caches whose TTL follows SYNC_FREQUENCY (60 seconds by default) and never exceeds the Session's remaining lifetime.

Redis topologySession propagationRate limiting
Shared RedisRevocations and version publications normally propagate immediatelyRedis limits are shared across nodes
Independent Redis per nodeNodes converge from the database within the effective SYNC_FREQUENCY; a newly rotated token may receive a temporary 401 on a node with stale cacheEach node has its own allowance, so aggregate capacity can reach roughly the configured limit multiplied by the node count
No RedisEvery Session validation reads the databaseIn-memory limits are independent per node

A shorter SYNC_FREQUENCY reduces the independent-Redis staleness window but causes one additional primary-key Session lookup per active SID, per node, per TTL. These guarantees make Session authentication bounded-stale across the supported topologies; rate limits and other Redis-backed control-plane caches remain topology-dependent.

See User authentication and login sessions for the token, Origin-check and PAT contracts.

🚀 Quick Start

💰 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

🤝 Contribution Guide

Welcome all forms of contribution!

  • 🐛 Report Bugs
  • 💡 Propose New Features
  • 📝 Improve Documentation
  • 🔧 Submit Code

---

⚙️ Environment Variable Configuration

<details> <summary>Common environment variable configuration</summary>

Variable NameDescriptionDefault Value
SESSION_SECRETAuthentication signing secret; must be identical on every node-
SESSION_COOKIE_SECUREfalse/unset disables the refresh/logout OriginGuard for local HTTP dev proxies; true enables the Secure cookie and strict Origin checksfalse
SESSION_COOKIE_TRUSTED_URLRequired with Secure mode: comma-separated exact HTTPS Origins allowed to call refresh/logout; not a relay CORS allowlist-
TRUSTED_PROXIESUnset/blank trusts loopback, RFC 1918 and IPv6 ULA with a startup warning; none trusts no proxies; an explicit proxy IP/CIDR list replaces the defaults127.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_LIMITMaximum active login Sessions per user50
USER_SESSION_ISSUANCE_LIMITMaximum Sessions created per user within the issuance window, including revoked Sessions100
USER_SESSION_ISSUANCE_WINDOW_SECONDSPer-user Session issuance window; clamped to the revoked retention period when configured higher86400
USER_SESSION_REVOKED_RETENTION_DAYSDays to retain revoked Session rows for audit and issuance accounting7
USER_SESSION_HOURLY_ALERT_THRESHOLDGlobal Sessions created per hour that triggers an alert only; it never blocks login5000
CRYPTO_SECRETHMAC secret for cache keys; nodes sharing Redis must use the same effective valueDefaults to SESSION_SECRET
SQL_DSNDatabase connection string-
REDIS_CONN_STRINGRedis connection string-
RELAY_IDLE_CONN_TIMEOUTIdle keep-alive timeout for relay HTTP clients, seconds. Defaults to Go standard library behavior; set 0 to disable90
RELAY_RESPONSE_HEADER_TIMEOUTHow 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 headroom1800
STREAMING_TIMEOUTStreaming timeout (seconds)300
STREAM_SCANNER_MAX_BUFFER_MBMax per-line buffer (MB) for the stream scanner; increase when upstream sends huge image/base64 payloads64
MAX_REQUEST_BODY_MBMax request body size (MB, counted **after decompression**; prevents huge requests/zip bombs from exhausting memory). Exceeding it returns 41332
AZURE_DEFAULT_API_VERSIONAzure API version2025-04-01-preview
ERROR_LOG_ENABLEDError log switchfalse
PYROSCOPE_URLPyroscope server address-
PYROSCOPE_APP_NAMEPyroscope application namenew-api
PYROSCOPE_BASIC_AUTH_USERPyroscope basic auth user-
PYROSCOPE_BASIC_AUTH_PASSWORDPyroscope basic auth password-
PYROSCOPE_MUTEX_RATEPyroscope mutex sampling rate5
PYROSCOPE_BLOCK_RATEPyroscope block sampling rate5
HOSTNAMEHostname tag for Pyroscopenew-api

📖 Complete configuration: Environment Variables Documentation

</details>

Edit configuration

nano docker-compose.yml

New API

🍥 Next-Generation LLM Gateway and AI Asset Management System

<p align="center"> <a href="./README.zh_CN.md">简体中文</a> | <a href="./README.zh_TW.md">繁體中文</a> | <strong>English</strong> | <a href="./README.fr.md">Français</a> | <a href="./README.ja.md">日本語</a> </p>

<p align="center"> <a href="https://raw.githubusercontent.com/Calcium-Ion/new-api/main/LICENSE"> <img src="https://img.shields.io/github/license/Calcium-Ion/new-api?color=brightgreen" alt="license"> </a><a href="https://github.com/Calcium-Ion/new-api/releases/latest"> <img src="https://img.shields.io/github/v/release/Calcium-Ion/new-api?color=brightgreen&include_prereleases" alt="release"> </a><a href="https://hub.docker.com/r/CalciumIon/new-api"> <img src="https://img.shields.io/badge/docker-dockerHub-blue" alt="docker"> </a> <a href="https://atomgit.com/QuantumNous/new-api" target="_blank"> <img alt="AtomGit G-Star" src="https://atomgit.com/QuantumNous/new-api/star/badge.svg"/> </a> </p>

<p align="center"> <a href="https://trendshift.io/repositories/20180" target="_blank"> <img src="https://trendshift.io/api/badge/repositories/20180" alt="QuantumNous%2Fnew-api | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/> </a> <br> <a href="https://hellogithub.com/repository/QuantumNous/new-api" target="_blank"> <img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=539ac4217e69431684ad4a0bab768811&claim_uid=tbFPfKIDHpc4TzR" alt="Featured|HelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" /> </a> <a href="https://atomgit.com/QuantumNous/new-api" target="_blank"> <img alt="AtomGit G-Star" src="https://atomgit.com/QuantumNous/new-api/star/new_badge.svg" width="250" height="55" /> </a> </p>

<p align="center"> <a href="#-quick-start">Quick Start</a> • <a href="#-key-features">Key Features</a> • <a href="#-deployment">Deployment</a> • <a href="#-documentation">Documentation</a> • <a href="#-help-support">Help</a> </p>

</div>

📖 [Official Documentation](https://docs.newapi.pro/en/docs) | [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/QuantumNous/new-api)

</div>

Quick Navigation:

CategoryLink
🚀 Deployment Guide[Installation Documentation](https://docs.newapi.pro/en/docs/installation)
⚙️ Environment Configuration[Environment Variables](https://docs.newapi.pro/en/docs/installation/config-maintenance/environment-variables)
📡 API Documentation[API Documentation](https://docs.newapi.pro/en/docs/api)
❓ FAQ[FAQ](https://docs.newapi.pro/en/docs/support/faq)
💬 Community Interaction[Communication Channels](https://docs.newapi.pro/en/docs/support/community-interaction)

---

📡 Supported Interfaces

<details> <summary>View complete interface list</summary>

</details>

---

💖 Thank you for using New API

If this project is helpful to you, welcome to give us a ⭐️ Star!

Official DocumentationIssue FeedbackLatest Release

<sub>Built with ❤️ by QuantumNous</sub>

</div>

🇨🇳 中文文档镜像 AI 翻译 2026-06-11
英文原文章节由系统翻译为中文摘要,便于快速理解。完整原文见上方 "📑 README 深度解析"。
📌 简介

New API 是一个下一代 LLM 网关和 AI 资产管理系统,专为合法授权的 AI API 网关、组织级身份认证、多模型管理、使用分析、成本核算和私有部署场景设计。该项目要求用户合法获取上游 API 密钥、账户和模型服务权限,并遵守上游服务条款及适用法律法规。

⚡ 功能介绍

支持多种 API 格式,包括 OpenAI Responses、OpenAI Realtime API(含 Azure)、Claude Messages 和 Google Gemini 等。提供组织级按请求、按使用量和缓存命中的成本核算,支持 OpenAI、Azure、DeepSeek、Claude、Qwen 等模型的缓存计费统计。内置合法授权场景下的充值和配额分配功能(支持 EPay、Stripe),灵活的计费策略适用于内部管理或授权企业客户。

📋 环境依赖

本地数据库支持 SQLite(Docker 需挂载 `/data` 目录),远程数据库支持 MySQL ≥ 5.7.8 或 PostgreSQL ≥ 9.6。容器引擎需使用 Docker 或 Docker Compose。推荐使用最新 Docker 镜像 `calciumion/new-api:latest`。

🛠 安装步骤(Docker/pip/源码)

推荐使用 Docker Compose 部署。首先编辑 docker-compose.yml 配置文件(使用 `nano docker-compose.yml`),根据需求配置数据库连接、环境变量等参数,然后执行 Docker Compose 启动命令完成部署。详细安装步骤请参考官方安装文档。

🚀 使用教程

部署完成后,系统支持合法授权场景下的内部充值和配额分配(支持 EPay、Stripe 等支付方式)。提供组织级的成本核算功能,可按请求、使用量或缓存命中进行计费统计。支持多种 LLM 模型的灵活管理和计费策略配置,适用于内部管理或授权企业客户的使用场景。

⚙️ 配置说明(含 MCP / env)

关键环境变量包括:`SESSION_SECRET`(会话密钥,多机部署时必需)、`CRYPTO_SECRET`(加密密钥,Redis 使用时必需)、`SQL_DSN`(数据库连接字符串)、`REDIS_C`(Redis 配置)等。所有配置通过编辑 docker-compose.yml 文件进行管理,支持灵活的自定义配置以适应不同部署场景。

🔌 API 说明

New API 提供完整的 LLM 网关 API 接口,支持 OpenAI、Claude、Google Gemini 等多种模型的标准 API 调用。包括聊天补全、实时 API、消息创建等功能。详细的 API 文档和调用示例请参考官方 API 文档。

🎯 aiskill88 AI 点评 A 级 2026-05-28

高质量的AI工具,支持跨模型转换

📚 实用指南(长尾问题)
适合谁
  • 构建企业知识库 / RAG 检索应用的团队
最佳实践
  • 生产部署优先使用 Docker Compose 隔离依赖,并挂载 volume 持久化数据
常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • 容器内无法访问宿主机 localhost — 使用 host.docker.internal
部署方案
  • Docker:new-api 提供官方镜像,docker compose up 一键启动
  • 云端托管:可放在 Vercel / Railway / Fly.io 等 PaaS 平台
相关搜索
new-api 中文教程new-api 安装报错怎么办new-api Docker 部署new-api 与同类工具对比new-api 最佳实践new-api 适合谁用

⚡ 核心功能

👥 适合谁
  • 构建企业知识库 / RAG 检索应用的团队
⭐ 最佳实践
  • 生产部署优先使用 Docker Compose 隔离依赖,并挂载 volume 持久化数据
⚠️ 常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • 容器内无法访问宿主机 localhost — 使用 host.docker.internal

👥 适合人群

AI 技术爱好者研究人员和学生开发者和工程师技术创业者

🎯 使用场景

  • 本地部署运行,保护数据隐私,满足合规要求
  • 自定义集成到现有系统,扩展技术栈能力
  • 作为开源基础组件进行商业化二次开发

⚖️ 优点与不足

✅ 优点
  • +GitHub 35.8k Star,社区高度认可
  • +AI Skill Hub 精选推荐
  • +完全开源免费,无授权费用
  • +本地部署,数据完全自主可控
  • +开发者社区支持,遇问题可查可问
⚠️ 不足
  • 安装和初始配置可能需要一定技术基础
  • 功能完整性通常不如成熟商业产品
  • 技术支持主要依赖开源社区,响应速度不稳定
⚠️ 使用须知

该工具使用 AGPL-3.0 协议,商用场景请仔细阅读协议条款,必要时咨询法律意见。

AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。

建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。

📄 License 说明

⚠️ AGPL 3.0 — 最严格的 Copyleft,网络服务端使用也需开源,SaaS 使用受限。

🔗 相关工具推荐

📚 相关教程推荐
📰 相关 AI 新闻
🍿 AI 圈相关吃瓜
🗺️ 相关解决方案
🧩 你可能还需要
基于当前 Skill 的能力图谱,自动补全的工具组合

❓ 常见问题 FAQ

new-api 是一款Go开发的AI辅助工具。开源AI工具:A unified AI model hub for aggregation & distribution. It supports cross-convert。⭐35.8k · Go 主要应用场景包括:AI模型聚合与分发。
💡 AI Skill Hub 点评

经综合评估,新一代AI工具 在AI工具赛道中表现稳健,质量优秀。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。

📚 深入学习 新一代AI工具
查看分步骤安装教程和完整使用指南,快速上手这款工具
🌐 原始信息
原始名称 new-api
原始描述 开源AI工具:A unified AI model hub for aggregation & distribution. It supports cross-convert。⭐35.8k · Go
Topics ai-gatewayclaudedeepseekgemini
GitHub https://github.com/QuantumNous/new-api
License AGPL-3.0
语言 Go
🔗 原始来源
🐙 GitHub 仓库  https://github.com/QuantumNous/new-api 🌐 官方网站  https://www.newapi.ai

收录时间:2026-05-28 · 更新时间:2026-05-30 · License:AGPL-3.0 · AI Skill Hub 不对第三方内容的准确性作法律背书。

📺 订阅 AI Skill Hub Daily Telegram 频道
每天 8 条精选 AI Skill、MCP、Agent 与自动化工具推送
加入频道 →