新一代AI工具 是 AI Skill Hub 本期精选AI工具之一。在 GitHub 上收获超过 35.8k 颗 Star,综合评分 8.5 分,整体质量较高。我们强烈推荐将其纳入你的 AI 工具库,帮助提升工作效率。
新一代AI工具 是一款基于 Go 开发的开源工具,专注于 ai-gateway、claude、deepseek 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
新一代AI工具 是一款基于 Go 开发的开源工具,专注于 ai-gateway、claude、deepseek 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 方式一: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
# 查看帮助 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"

New API is a self-hosted AI gateway for applications, agents, and teams. Connect upstream model services, expose a consistent API to your clients, and manage routing, access, usage, and costs in one place.
Use it to share authorized model access across a team, switch providers without configuring every client again, or operate a private multi-model service with a web console. Upstreams include OpenAI, Anthropic, Google Gemini, Azure OpenAI, AWS Bedrock, Vertex AI, DeepSeek, Qwen, and other compatible services.
[!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.
[!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.
---
<a id="screenshots"></a>
| Area | What you can do |
|---|---|
| Model access | Use OpenAI Chat Completions, Responses, Anthropic Messages, and Gemini APIs; stream responses and use tools, reasoning, and multimodal inputs where supported |
| Routing | Configure model mappings, channel priorities and weights, retries, channel affinity, and multiple upstream keys |
| Usage and costs | Manage quotas, subscriptions, usage logs, cache accounting, and expression-based pricing for different usage tiers |
| Access control | Manage users, groups, fine-grained permissions, and API key restrictions; use OAuth/OIDC, passkeys, two-factor authentication, and login session management |
| Asynchronous tasks | Extend image, video, and other task APIs with JavaScript plugins, including task status and output retrieval |
| Web console | Configure channels and models, inspect usage and audit logs, and try models in the playground; available in English, Simplified Chinese, Traditional Chinese, French, Japanese, Russian, and Vietnamese |
This starts a single instance with SQLite and binds it 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 administrator account. The data directory persists the SQLite database across container replacements.
The repository's Compose configuration starts New API + PostgreSQL + Redis by default. It also contains examples for MySQL and a separate ClickHouse log database.
git clone https://github.com/QuantumNous/new-api.git
cd new-api
Before starting, edit docker-compose.yml: replace the database and Redis example passwords in both the services and connection strings, and set a persistent random SESSION_SECRET (generate one with openssl rand -hex 32). For an HTTPS console, configure SESSION_COOKIE_SECURE=true and SESSION_COOKIE_TRUSTED_URL with its exact public HTTPS origin.
docker compose up -d
docker compose logs -f new-api
Accounts, channels, plugin installation states, usage, prices, and costs shown below are simulated data. The marketplace displays the official plugin catalog. Click an image to view it at full size.
| Usage dashboard | Plugin marketplace |
|---|---|
| [](assets/screenshots/dashboard.en.jpg) | [](assets/screenshots/plugin-marketplace.en.jpg) |
| **Model square** | **Usage logs** |
| [](assets/screenshots/models.en.jpg) | [](assets/screenshots/usage-logs.en.jpg) |
---
| Component | Options |
|---|---|
| Main database | SQLite, MySQL ≥ 5.7.8, or PostgreSQL ≥ 9.6 |
| Separate log database | Configure with LOG_SQL_DSN; also supports ClickHouse |
| Cache | Optional Redis plus in-memory caching; use shared Redis when application nodes need shared rate limits |
| Container platforms | Linux amd64 / arm64 |
| Variable | Purpose |
|---|---|
SQL_DSN | Main database connection; unset uses SQLite |
LOG_SQL_DSN | Optional separate log database connection |
REDIS_CONN_STRING | Redis connection string |
SESSION_SECRET | Persistent authentication secret; all nodes must use the same value |
CRYPTO_SECRET | Defaults to SESSION_SECRET; nodes sharing Redis must use the same effective value |
SESSION_COOKIE_SECURE | Set to true for an HTTPS console; enables Secure refresh cookies and strict refresh/logout origin checks |
SESSION_COOKIE_TRUSTED_URL | Required in Secure mode: comma-separated exact HTTPS origins, without paths or wildcards; leave unset for local HTTP |
TRUSTED_PROXIES | Trusted reverse-proxy IPs/CIDRs, or none; explicitly configure for your network |
See the environment example, environment reference, and authentication and session guide for full configuration. Configure container variables in Compose's environment or env_file; copying .env.example alone does not inject variables into the container.
For production, put the console behind HTTPS and configure your reverse proxy for streaming and WebSocket upgrades. Persist and back up the database and mounted data. Multi-node deployments must share the main database and authentication secrets; separate Redis instances or in-memory rate limiters count limits independently per node. The session guide describes propagation behavior for each topology.
Pin an image version from Releases, review its upgrade notes, and back up before upgrading. The latest tag follows published builds and can change; migrations and compatibility must be assessed for your existing installation.
<a id="development"></a>
An AI gateway for models, applications, and agents
<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="#screenshots">Screenshots</a> • <a href="#capabilities">Capabilities</a> • <a href="#quick-start">Quick start</a> • <a href="#deployment">Deployment</a> • <a href="#development">Development</a> • <a href="#documentation">Documentation</a> </p>
</div>
---
| Interface | Common endpoints |
|---|---|
| OpenAI Chat / Responses | POST /v1/chat/completions, POST /v1/responses |
| Anthropic Messages | POST /v1/messages |
| Gemini | POST /v1beta/models/{model}:generateContent, POST /v1beta/models/{model}:streamGenerateContent |
| Realtime / Responses WebSocket | GET /v1/realtime, GET /v1/responses (WebSocket upgrade) |
| Images / audio | /v1/images/generations, /v1/images/edits, /v1/audio/speech, /v1/audio/transcriptions, /v1/audio/translations |
| Embeddings / rerank | POST /v1/embeddings, POST /v1/rerank |
| Task plugins | POST /v1/tasks/{pluginKey}, GET /v1/tasks/{taskId}, plus routes declared by each plugin |
RelayKit provides request, response, and streaming conversion between the four text protocols. Available features depend on the channel, upstream model, and conversion path; protocol-specific tools and fields may not map exactly. WebSocket support also requires a compatible upstream and channel configuration.
This README describes the current source tree. Check the release notes for the version you deploy.
<a id="quick-start"></a>
If this project is helpful to you, welcome to give us a ⭐️ Star!
Official Documentation • Issue Feedback • Latest Release
<sub>Built with ❤️ by QuantumNous</sub>
</div>
The backend uses Go and Gin. The web console uses React 19, TypeScript, Rsbuild, TanStack, and Tailwind CSS 4. Use Bun for frontend dependencies and scripts; see go.mod for the Go language baseline and Dockerfile for the container build toolchain.
Build the frontend before starting the backend, which embeds web/dist:
```bash
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 Compose 部署。首先编辑 docker-compose.yml 配置文件(使用 `nano docker-compose.yml`),根据需求配置数据库连接、环境变量等参数,然后执行 Docker Compose 启动命令完成部署。详细安装步骤请参考官方安装文档。
部署完成后,系统支持合法授权场景下的内部充值和配额分配(支持 EPay、Stripe 等支付方式)。提供组织级的成本核算功能,可按请求、使用量或缓存命中进行计费统计。支持多种 LLM 模型的灵活管理和计费策略配置,适用于内部管理或授权企业客户的使用场景。
关键环境变量包括:`SESSION_SECRET`(会话密钥,多机部署时必需)、`CRYPTO_SECRET`(加密密钥,Redis 使用时必需)、`SQL_DSN`(数据库连接字符串)、`REDIS_C`(Redis 配置)等。所有配置通过编辑 docker-compose.yml 文件进行管理,支持灵活的自定义配置以适应不同部署场景。
New API 提供完整的 LLM 网关 API 接口,支持 OpenAI、Claude、Google Gemini 等多种模型的标准 API 调用。包括聊天补全、实时 API、消息创建等功能。详细的 API 文档和调用示例请参考官方 API 文档。
高质量的AI工具,支持跨模型转换
该工具使用 AGPL-3.0 协议,商用场景请仔细阅读协议条款,必要时咨询法律意见。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
⚠️ AGPL 3.0 — 最严格的 Copyleft,网络服务端使用也需开源,SaaS 使用受限。
经综合评估,新一代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 |
收录时间:2026-05-28 · 更新时间:2026-05-30 · License:AGPL-3.0 · AI Skill Hub 不对第三方内容的准确性作法律背书。