简报·YT
← 返回 GitHub 动态
QuantumNous/new-api · ⭐ 已Star 已完成

QuantumNous/new-api v1.0.0-rc.44

2026-10-12 13:42 · ⭐ 5万 · GitHub Release 原文 ↗
#版本发布 #日志导出 #模型兼容

QuantumNous/new-api v1.0.0-rc.44

v1 正式版即将发布,本 RC 主要加入用量日志 CSV 导出与日志时间范围控制,并集中修复 Claude/Gemini 多类兼容问题,同时提醒 Playground 历史会清空一次。

新增能力 - 用量日志页 Search 旁新增 Export,可按当前筛选条件和时间范围导出 CSV,文件语言跟随查看者。普通用户导出自己的日志;管理员在 all-users 视图可导出所有用户日志。每个用户同时只能执行一个导出,跨标签页;配置 Redis 时跨节点也受限。 - Log Maintenance 新增 Allow users to export logs(默认开启)和 Longest log time range (days)(默认 365 天)。普通用户的日志搜索、导出、Dashboard 用量与流量图都受该范围限制;页面拆分为 Log recording、Log search and export、history log cleanup、server log management。 - 日期和时间选择器,包括日志页日期范围过滤器,支持精确到秒。 - Playground 数据改为按账号分开保存。

修复与改进 - Claude 请求按模型支持档位发送思考强度:已知 Claude 模型会取最接近的可接受 thinking effort,不支持时不发送。修复 Opus 4.5 使用 max/xhigh、Sonnet 4.5、Haiku 4.5,以及模型后缀或修饰符关闭 thinking 时的 400。原生 Claude 请求无后缀/修饰符时按原样透传。 - Claude Haiku 5.5 默认使用 adaptive thinking + medium effort;转换请求会丢弃 temperature、top_p、top_k。Gemini 2.5 Pro 对 xhigh/max 使用 32768 thinking budget。 - 发给 Gemini 的工具和结构化输出保留完整 JSON Schema:const、oneOf、$ref、$defs、type arrays、非字符串 enum。Gemini typed Schema 能容纳的 schema 照旧发送,其余放入 parametersJsonSchema 或 responseJsonSchema。使用 Gemini API v1 的模型会得到清理后的 schema 和转换警告。 - Responses images 发往 Chat Completions upstream 时改用 image_url 对象形式,兼容 vLLM 和严格 gateway 接收 Codex 截图与工具图片。 - 流转换保留文本:Chat streams 转 Claude Messages 时,最后一个 reasoning token 同 chunk 到达的 answer text 不丢;Claude Messages 转 Chat Completions 时保留 tool calls 旁的 assistant text。 - Claude 请求转发 thinking.block_binding 和每个 anthropic-beta header 值,修复系统提示或工具变化的多轮对话中 "The block is bound to a different conversation"。 - Responses WebSocket 会话在服务端结束时发送 close frame,Codex 可看到正常关闭。 - 无 Redis 时,模型限流 429 的错误消息和日志行与有 Redis 时保持一致。 - 控制台页面代码加载失败会 reload 一次;错误页仅在有状态码时显示。钱包、安全、OAuth callback 页面和用户绑定对话框加载更少 JavaScript;Linux DO 绑定显示 Linux DO logo。日期选择器与相对时间跟随界面语言。 - 模型广场显示 7 天内最近 24 个小时状态样本且无空缺;表达式模型卡显示 cache read price。用量日志预览保留记录的 billing tiers,任务结算日志显示 tiered billing。Pricing conversion 接受 endpoints 数组;模型广场禁用时 Root 仍可管理 pricing。 - 性能指标会统计客户端断开前已完成的 streams。密码登录 Sign in 按钮保持可点击并显示 legal consent warning。Auto 字体恢复使用浏览器 sans-serif;Meta Muse Spark 显示 Meta icon;移动端 billing source icons 对齐。依赖更新包括 Electron 41。

Breaking / 行为变更 - Playground 数据按账号分开保存,升级后之前的聊天记录会清空一次。 - 普通用户日志查询、导出和数据看板开始受 Longest log time range (days) 限制,默认 365 天;此前普通用户日志搜索无限制。 - 未提到性能数据或基准测试结果。

新增贡献者 - @zhaoruizhe81、@i-richardwang、@JohnUncle

▸ Release Notes 英文原文(9743 字符)
> [!IMPORTANT] > **v1 Coming Soon & Log Export / v1 即将发布与日志导出** > > v1 正式版即将发布,现在是最后几个 RC 版本。 > > 使用日志支持导出 CSV。可以在日志维护里设置是否允许用户导出,以及日志最长时间范围,默认 365 天。普通用户的日志查询、导出和数据看板都按这个范围限制。 > > 游乐场的数据按账号分开保存,升级后之前的聊天记录会清空一次。 > > Claude 请求按模型支持的档位发送思考强度。发给 Gemini 的工具和结构化输出保留完整的 JSON Schema。 > > v1 is coming soon. These are the last few release candidates. > > Usage logs can be exported as CSV. In Log Maintenance you can choose whether users may export and set the longest log time range, 365 days by default. Regular users' log searches, exports, and dashboard charts all follow that range. > > Playground data is stored per account. Earlier Playground history is cleared once after the upgrade. > > Claude requests get the thinking effort each model accepts. Tools and structured output sent to Gemini keep their full JSON Schema. ## New Features * The usage log page has an Export button next to Search. It downloads the current view, with the page's filters and a chosen time range, as a CSV file in the viewer's language. Users export their own logs, and administrators in the all-users view export every user's logs. Each user runs one export at a time, across tabs and, with Redis, across nodes ([#7774](https://github.com/QuantumNous/new-api/issues/7774)). * Log Maintenance adds Allow users to export logs (on by default) and Longest log time range (days) (365 by default). Regular users' log searches had no limit before. Their searches, exports, and dashboard usage and traffic charts now share this range. The page is split into Log recording, Log search and export, history log cleanup, and server log management. * Date and time pickers, including the date range filter on log pages, work down to the second. ## Fixes and Improvements * Known Claude models get the nearest thinking effort they accept, and none when they accept none. This fixes 400s on Opus 4.5 with `max` or `xhigh`, on Sonnet 4.5 and Haiku 4.5, and when a model suffix or modifier turns thinking off. Native Claude requests without a suffix or modifier pass through as sent. * Claude Haiku 5.5 uses adaptive thinking with medium effort by default. Converted requests drop `temperature`, `top_p`, and `top_k` for it. Gemini 2.5 Pro gets a 32768 thinking budget for `xhigh` and `max`. * Tools and structured output sent to Gemini keep `const`, `oneOf`, `$ref`, `$defs`, type arrays, and non-string enums. A schema that Gemini's typed Schema can hold is sent as before, and any other schema goes in `parametersJsonSchema` or `responseJsonSchema`. Models set to Gemini API v1 get a cleaned schema and a conversion warning ([#7455](https://github.com/QuantumNous/new-api/issues/7455), [#7704](https://github.com/QuantumNous/new-api/issues/7704)). * Responses images sent to Chat Completions upstreams use the object form of `image_url`, so vLLM and strict gateways accept Codex screenshots and tool images ([#7578](https://github.com/QuantumNous/new-api/issues/7578)). * Chat streams converted to Claude Messages keep answer text that arrives in the same chunk as the last reasoning token ([#7664](https://github.com/QuantumNous/new-api/issues/7664)). Claude Messages converted to Chat Completions keep assistant text next to tool calls ([#6871](https://github.com/QuantumNous/new-api/issues/6871)). * Claude requests forward `thinking.block_binding` and every `anthropic-beta` header value. This fixes "The block is bound to a different conversation" in multi-turn conversations whose system prompt or tools change ([#7732](https://github.com/QuantumNous/new-api/issues/7732)). * Responses WebSocket sessions send a close frame when the server ends them, so Codex sees a normal close ([#7642](https://github.com/QuantumNous/new-api/issues/7642)). * Without Redis, model rate-limit 429s carry the same error message and log line as with Redis ([#7721](https://github.com/QuantumNous/new-api/issues/7721)). * The console reloads once when a page's code fails to load, and the error page shows a status code only when there is one ([#7634](https://github.com/QuantumNous/new-api/issues/7634)). * The wallet, security, and OAuth callback pages and the user binding dialog load much less JavaScript. Linux DO bindings show the Linux DO logo. * Date pickers and relative times follow the interface language ([#7654](https://github.com/QuantumNous/new-api/issues/7654)). * The model square shows the latest 24 hourly status samples within 7 days, with no gaps. Expression model cards show the cache read price ([#7757](https://github.com/QuantumNous/new-api/issues/7757)). * Usage log previews keep the recorded billing tiers ([#7763](https://github.com/QuantumNous/new-api/issues/7763)), and task settlement logs show tiered billing ([#7446](https://github.com/QuantumNous/new-api/issues/7446)). * Pricing conversion accepts model metadata that declares endpoints as an array ([#7724](https://github.com/QuantumNous/new-api/issues/7724)). Root can manage pricing while the model square is disabled ([#7761](https://github.com/QuantumNous/new-api/issues/7761)). * Performance metrics count streams that finished before the client disconnected ([#7638](https://github.com/QuantumNous/new-api/issues/7638)). * The Sign in button on password login stays clickable and shows the legal consent warning ([#7771](https://github.com/QuantumNous/new-api/issues/7771)). * The Auto font uses the browser's sans-serif again. Meta Muse Spark models show the Meta icon ([#7734](https://github.com/QuantumNous/new-api/issues/7734)), and billing source icons line up on mobile ([#7760](https://github.com/QuantumNous/new-api/issues/7760)). * Dependency updates, including Electron 41. --- ## What's Changed * fix(gemini): OpenAI 工具参数转换丢弃非字符串 enum,修复布尔枚举致上游 400 by @zhaoruizhe81 in https://github.com/QuantumNous/new-api/pull/7729 * fix(web): map Meta Muse Spark models to Meta icon by @i-richardwang in https://github.com/QuantumNous/new-api/pull/7734 * fix(web): show cache read price on expression model cards by @i-richardwang in https://github.com/QuantumNous/new-api/pull/7757 * fix(metrics): count completed streams after context cancellation by @jimmyleocn in https://github.com/QuantumNous/new-api/pull/7638 * fix(logs): vertically align billing source icons on mobile by @seefs001 in https://github.com/QuantumNous/new-api/pull/7760 * fix: mark task settlement logs with is_task for tiered billing display by @feitianbubu in https://github.com/QuantumNous/new-api/pull/7446 * fix(pricing): allow root access when the square is disabled by @seefs001 in https://github.com/QuantumNous/new-api/pull/7761 * fix(relaykit): preserve assistant text with tool calls by @enwaiax in https://github.com/QuantumNous/new-api/pull/6871 * fix(web): preserve recorded billing tiers in usage log previews by @seefs001 in https://github.com/QuantumNous/new-api/pull/7763 * chore(web): bump @lobehub/icons to 5.22.0 by @i-richardwang in https://github.com/QuantumNous/new-api/pull/7764 * fix(pricing): accept declared endpoint arrays in pricing conversion by @JohnUncle in https://github.com/QuantumNous/new-api/pull/7724 * fix(ci): stabilize checks and configure Bun dependency updates by @seefs001 in https://github.com/QuantumNous/new-api/pull/7765 * fix(auth): show legal consent warning on password login by @seefs001 in https://github.com/QuantumNous/new-api/pull/7771 * fix(claude): forward thinking.block_binding and every anthropic-beta value by @RedwindA in https://github.com/QuantumNous/new-api/pull/7732 * chore(deps-dev): bump @xmldom/xmldom from 0.8.13 to 0.8.15 in /electron by @dependabot[bot] in https://github.com/QuantumNous/new-api/pull/7187 * build(deps): bump yace from 1.1.0 to 1.1.1 in /web by @dependabot[bot] in https://github.com/QuantumNous/new-api/pull/7770 * build(deps): bump stream-markdown-parser from 1.1.3 to 1.2.18 in /web by @dependabot[bot] in https://github.com/QuantumNous/new-api/pull/7769 * build(deps-dev): bump @tanstack/router-plugin from 1.168.23 to 1.168.42 in /web by @dependabot[bot] in https://github.com/QuantumNous/new-api/pull/7768 * build(deps-dev): bump oxfmt from 0.57.0 to 0.72.0 in /web by @dependabot[bot] in https://github.com/QuantumNous/new-api/pull/7766 * chore(deps-dev): bump electron from 39.8.10 to 41.10.6 in /electron by @dependabot[bot] in https://github.com/QuantumNous/new-api/pull/7625 * chore(deps-dev): bump fast-uri from 3.1.5 to 3.1.7 in /electron by @dependabot[bot] in https://github.com/QuantumNous/new-api/pull/7169 * chore(deps): bump github.com/gorilla/websocket from 1.5.0 to 1.5.3 by @dependabot[bot] in https://github.com/QuantumNous/new-api/pull/7001 * chore(deps): bump ai from 7.0.31 to 7.0.136 in /web by @dependabot[bot] in https://github.com/QuantumNous/new-api/pull/7767 * chore(deps-dev): bump brace-expansion from 1.1.16 to 1.1.21 in /electron by @dependabot[bot] in https://github.com/QuantumNous/new-api/pull/7623 * chore(deps-dev): bump js-yaml from 4.3.1 to 4.3.2 in /electron by @dependabot[bot] in https://github.com/QuantumNous/new-api/pull/7327 * chore(deps-dev): bump undici from 6.28.0 to 6.29.0 in /electron by @dependabot[bot] in https://github.com/QuantumNous/new-api/pull/7624 * feat(logs): export usage logs from the common log page by @Calcium-Ion in https://github.com/QuantumNous/new-api/pull/7774 ## New Contributors * @zhaoruizhe81 made their first contribution in https://github.com/QuantumNous/new-api/pull/7729 * @i-richardwang made their first contribution in https://github.com/QuantumNous/new-api/pull/7734 * @JohnUncle made their first contribution in https://github.com/QuantumNous/new-api/pull/7724 **Full Changelog**: https://github.com/QuantumNous/new-api/compare/v1.0.0-rc.43...v1.0.0-rc.44
▸ 主项目介绍 · QuantumNous/new-api
▸ README 原文(同步于 2026-07-20 03:47)
<div align="center"> ![new-api](/web/default/public/logo.png) # New API 🍥 **新一代大模型网关与AI资产管理系统** <p align="center"> 简体中文 | <a href="./README.zh_TW.md">繁體中文</a> | <a href="./README.md">English</a> | <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://goreportcard.com/report/github.com/Calcium-Ion/new-api"> <img src="https://goreportcard.com/badge/github.com/Calcium-Ion/new-api" alt="GoReportCard"> </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://www.producthunt.com/products/new-api/launches/new-api?embed=true&utm_source=badge-featured&utm_medium=badge&utm_campaign=badge-new-api" target="_blank" rel="noopener noreferrer"> <img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1047693&theme=light&t=1769577875005" alt="New API - All-in-one AI asset management gateway. | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /> </a> </p> <p align="center"> <a href="#-快速开始">快速开始</a> • <a href="#-主要特性">主要特性</a> • <a href="#-部署">部署</a> • <a href="#-文档">文档</a> • <a href="#-帮助支持">帮助</a> </p> </div> ## 📝 项目说明 > [!IMPORTANT] > - 本项目仅面向合法授权的 AI API 网关、组织内部鉴权、多模型管理、用量统计、成本核算和私有化部署场景。 > - 使用者必须合法取得上游 API Key、账号、模型服务或接口权限,并遵守上游服务条款及适用法律法规。 > - 使用者应确保其使用方式符合上游服务条款及适用法律法规。 > - 面向公众提供生成式人工智能服务时,使用者应遵守[《生成式人工智能服务管理暂行办法》](http://www.cac.gov.cn/2023-07/13/c_1690898327029107.htm)等监管要求,自行完成所在司法辖区要求的备案、许可、内容安全、实名、日志留存、税务和上游授权等合规义务。 --- ## 🤝 我们信任的合作伙伴 <p align="center"> <em>排名不分先后</em> </p> <p align="center"> <a href="https://www.cherry-ai.com/" target="_blank"> <img src="./docs/images/cherry-studio.png" alt="Cherry Studio" height="80" /> </a><!-- --><a href="https://github.com/iOfficeAI/AionUi/" target="_blank"> <img src="./docs/images/aionui.png" alt="Aion UI" height="80" /> </a><!-- --><a href="https://bda.pku.edu.cn/" target="_blank"> <img src="./docs/images/pku.png" alt="北京大学" height="80" /> </a><!-- --><a href="https://www.compshare.cn/?ytag=GPU_yy_gh_newapi" target="_blank"> <img src="./docs/images/ucloud.png" alt="UCloud 优刻得" height="80" /> </a><!-- --><a href="https://www.aliyun.com/" target="_blank"> <img src="./docs/images/aliyun.png" alt="阿里云" height="80" /> </a><!-- --><a href="https://io.net/" target="_blank"> <img src="./docs/images/io-net.png" alt="IO.NET" height="80" /> </a> </p> --- ## 🙏 特别鸣谢 <p align="center"> <a href="https://www.jetbrains.com/?from=new-api" target="_blank"> <img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" alt="JetBrains Logo" width="120" /> </a> </p> <p align="center"> <strong>感谢 <a href="https://www.jetbrains.com/?from=new-api">JetBrains</a> 为本项目提供免费的开源开发许可证</strong> </p> --- ## 🚀 快速开始 ### 使用 Docker Compose(推荐) ```bash # 克隆项目 git clone https://github.com/QuantumNous/new-api.git cd new-api # 编辑 docker-compose.yml 配置 nano docker-compose.yml # 启动服务 docker-compose up -d ``` <details> <summary><strong>使用 Docker 命令</strong></summary> ```bash # 拉取最新镜像 docker pull calciumion/new-api:latest # 使用 SQLite(默认) docker run --name new-api -d --restart always \ -p 3000:3000 \ -e TZ=Asia/Shanghai \ -v ./data:/data \ calciumion/new-api:latest # 使用 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 ``` > **💡 提示:** `-v ./data:/data` 会将数据保存在当前目录的 `data` 文件夹中,你也可以改为绝对路径如 `-v /your/custom/path:/data` </details> --- 🎉 部署完成后,访问 `http://localhost:3000` 即可使用! > [!WARNING] > 将本项目作为面向公众的生成式 AI 服务或 API 转售服务运营时,使用者应先完成备案、内容安全、实名、日志留存、税务、支付和上游授权等合规义务。 📖 更多部署方式请参考 [部署指南](https://docs.newapi.pro/zh/docs/installation) --- ## 📚 文档 <div align="center"> ### 📖 [官方文档](https://docs.newapi.pro/zh/docs) | [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/QuantumNous/new-api) </div> **快速导航:** | 分类 | 链接 | |------|------| | 🚀 部署指南 | [安装文档](https://docs.newapi.pro/zh/docs/installation) | | ⚙️ 环境配置 | [环境变量](https://docs.newapi.pro/zh/docs/installation/config-maintenance/environment-variables) | | 📡 接口文档 | [API 文档](https://docs.newapi.pro/zh/docs/api) | | ❓ 常见问题 | [FAQ](https://docs.newapi.pro/zh/docs/support/faq) | | 💬 社区交流 | [交流渠道](https://docs.newapi.pro/zh/docs/support/community-interaction) | --- ## ✨ 主要特性 > 详细特性请参考 [特性说明](https://docs.newapi.pro/zh/docs/guide/wiki/basic-concepts/features-introduction) ### 🎨 核心功能 | 特性 | 说明 | |------|------| | 🎨 全新 UI | 现代化的用户界面设计 | | 🌍 多语言 | 支持中文、英文、法语、日语 | | 🔄 数据兼容 | 完全兼容原版 One API 数据库 | | 📈 数据看板 | 可视化控制台与统计分析 | | 🔒 权限管理 | 令牌分组、模型限制、用户管理 | ### 💰 授权用量与成本管理 - ✅ 合法授权场景下的内部充值与额度分配(易支付、Stripe) - ✅ 组织内按次、按量或缓存命中成本核算 - ✅ 支持 OpenAI、Azure、DeepSeek、Claude、Qwen 等模型的缓存计费统计 - ✅ 面向内部管理或企业客户的灵活计费策略配置 ### 🔐 授权与安全 - 😈 Discord 授权登录 - 🤖 LinuxDO 授权登录 - 📱 Telegram 授权登录 - 🔑 OIDC 统一认证 - 🔍 Key 查询使用额度(配合 [new-api-key-tool](https://github.com/Calcium-Ion/new-api-key-tool)) ### 🚀 高级功能 **API 格式支持:** - ⚡ [OpenAI Responses](https://docs.newapi.pro/zh/docs/api/ai-model/chat/openai/create-response) - ⚡ [OpenAI Realtime API](https://docs.newapi.pro/zh/docs/api/ai-model/realtime/create-realtime-session)(含 Azure) - ⚡ [Claude Messages](https://docs.newapi.pro/zh/docs/api/ai-model/chat/create-message) - ⚡ [Google Gemini](https://doc.newapi.pro/api/google-gemini-chat) - 🔄 [Rerank 模型](https://docs.newapi.pro/zh/docs/api/ai-model/rerank/create-rerank)(Cohere、Jina) **智能路由:** - ⚖️ 渠道加权随机 - 🔄 失败自动重试 - 🚦 用户级别模型限流 **格式转换:** - 🔄 **OpenAI Compatible ⇄ Claude Messages** - 🔄 **OpenAI Compatible → Google Gemini** - 🔄 **Google Gemini → OpenAI Compatible** - 仅支持文本,暂不支持函数调用 - 🚧 **OpenAI Compatible ⇄ OpenAI Responses** - 开发中 - 🔄 **思考转内容功能** **Reasoning Effort 支持:** <details> <summary>查看详细配置</summary> **OpenAI 系列模型:** - `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 思考模型:** - `claude-3-7-sonnet-20250219-thinking` - 启用思考模式 **Google Gemini 系列模型:** - `gemini-2.5-flash-thinking` - 启用思考模式 - `gemini-2.5-flash-nothinking` - 禁用思考模式 - `gemini-2.5-pro-thinking` - 启用思考模式 - `gemini-2.5-pro-thinking-128` - 启用思考模式,并设置思考预算为128tokens - 也可以直接在 Gemini 模型名称后追加 `-low` / `-medium` / `-high` 来控制思考力度(无需再设置思考预算后缀) </details> --- ## 🤖 模型支持 > 详情请参考 [接口文档 - 网关接口](https://docs.newapi.pro/zh/docs/api) | 模型类型 | 说明 | 文档 | |---------|------|------| | 🤖 OpenAI-Compatible | OpenAI 兼容模型 | [文档](https://docs.newapi.pro/zh/docs/api/ai-model/chat/openai/createchatcompletion) | | 🤖 OpenAI Responses | OpenAI Responses 格式 | [文档](https://docs.newapi.pro/zh/docs/api/ai-model/chat/openai/createresponse) | | 🎨 Midjourney-Proxy | [Midjourney-Proxy(Plus)](https://github.com/novicezk/midjourney-proxy) | [文档](https://doc.newapi.pro/api/midjourney-proxy-image) | | 🎵 Suno-API | [Suno API](https://github.com/Suno-API/Suno-API) | [文档](https://doc.newapi.pro/api/suno-music) | | 🔄 Rerank | Cohere、Jina | [文档](https://docs.newapi.pro/zh/docs/api/ai-model/rerank/create-rerank) | | 💬 Claude | Messages 格式 | [文档](https://docs.newapi.pro/zh/docs/api/ai-model/chat/createmessage) | | 🌐 Gemini | Google Gemini 格式 | [文档](https://docs.newapi.pro/zh/docs/api/ai-model/chat/gemini/geminirelayv1beta) | | 🔧 Dify | ChatFlow 模式 | - | | 🎯 自定义上游 | 支持配置合法授权的上游接口地址 | - | ### 📡 支持的接口 <details> <summary>查看完整接口列表</summary> - [聊天接口 (Chat Completions)](https://docs.newapi.pro/zh/docs/api/ai-model/chat/openai/createchatcompletion) - [响应接口 (Responses)](https://docs.newapi.pro/zh/docs/api/ai-model/chat/openai/createresponse) - [图像接口 (Image)](https://docs.newapi.pro/zh/docs/api/ai-model/images/openai/post-v1-images-generations) - [音频接口 (Audio)](https://docs.newapi.pro/zh/docs/api/ai-model/audio/openai/create-transcription) - [视频接口 (Video)](https://docs.newapi.pro/zh/docs/api/ai-model/audio/openai/createspeech) - [嵌入接口 (Embeddings)](https://docs.newapi.pro/zh/docs/api/ai-model/embeddings/createembedding) - [重排序接口 (Rerank)](https://docs.newapi.pro/zh/docs/api/ai-model/rerank/creatererank) - [实时对话 (Realtime)](https://docs.newapi.pro/zh/docs/api/ai-model/realtime/createrealtimesession) - [Claude 聊天](https://docs.newapi.pro/zh/docs/api/ai-model/chat/createmessage) - [Google Gemini 聊天](https://docs.newapi.pro/zh/docs/api/ai-model/chat/gemini/geminirelayv1beta) </details> --- ## 🚢 部署 > [!TIP] > **最新版 Docker 镜像:** `calciumion/new-api:latest` ### 📋 部署要求 | 组件 | 要求 | |------|------| | **本地数据库** | SQLite(Docker 需挂载 `/data` 目录)| | **远程数据库** | MySQL ≥ 5.7.8 或 PostgreSQL ≥ 9.6 | | **容器引擎** | Docker / Docker Compose | | **系统架构** | 仅支持 64 位系统(amd64 / arm64),不支持 32 位系统 | ### ⚙️ 环境变量配置 <details> <summary>常用环境变量配置</summary> | 变量名 | 说明 | 默认值 | |--------|--------------------------------------------------------------|--------| | `SESSION_SECRET` | 会话密钥(多机部署必须) | - | | `CRYPTO_SECRET` | 加密密钥(Redis 必须) | - | | `SQL_DSN` | 数据库连接字符串 | - | | `REDIS_CONN_STRING` | Redis 连接字符串 | - | | `STREAMING_TIMEOUT` | 流式超时时间(秒) | `300` | | `STREAM_SCANNER_MAX_BUFFER_MB` | 流式扫描器单行最大缓冲(MB),图像生成等超大 `data:` 片段(如 4K 图片 base64)需适当调大 | `64` | | `MAX_REQUEST_BODY_MB` | 请求体最大大小(MB,**解压后**计;防止超大请求/zip bomb 导致内存暴涨),超过将返回 `413` | `32` | | `AZURE_DEFAULT_API_VERSION` | Azure API 版本 | `2025-04-01-preview` | | `ERROR_LOG_ENABLED` | 错误日志开关 | `false` | | `PYROSCOPE_URL` | Pyroscope 服务地址 | - | | `PYROSCOPE_APP_NAME` | Pyroscope 应用名 | `new-api` | | `PYROSCOPE_BASIC_AUTH_USER` | Pyroscope Basic Auth 用户名 | - | | `PYROSCOPE_BASIC_AUTH_PASSWORD` | Pyroscope Basic Auth 密码 | - | | `PYROSCOPE_MUTEX_RATE` | Pyroscope mutex 采样率 | `5` | | `PYROSCOPE_BLOCK_RATE` | Pyroscope block 采样率 | `5` | | `HOSTNAME` | Pyroscope 标签里的主机名 | `new-api` | 📖 **完整配置:** [环境变量文档](https://docs.newapi.pro/zh/docs/installation/config-maintenance/environment-variables) </details> ### 🔧 部署方式 <details> <summary><strong>方式 1:Docker Compose(推荐)</strong></summary> ```bash # 克隆项目 git clone https://github.com/QuantumNous/new-api.git cd new-api # 编辑配置 nano docker-compose.yml # 启动服务 docker-compose up -d ``` </details> <details> <summary><strong>方式 2:Docker 命令</strong></summary> **使用 SQLite:** ```bash docker run --name new-api -d --restart always \ -p 3000:3000 \ -e TZ=Asia/Shanghai \ -v ./data:/data \ calciumion/new-api:latest ``` **使用 MySQL:** ```bash 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 ``` > **💡 路径说明:** > - `./data:/data` - 相对路径,数据保存在当前目录的 data 文件夹 > - 也可使用绝对路径,如:`/your/custom/path:/data` </details> <details> <summary><strong>方式 3:宝塔面板</strong></summary> 1. 安装宝塔面板(≥ 9.2.0 版本) 2. 在应用商店搜索 **New-API** 3. 一键安装 📖 [图文教程](./docs/installation/BT.md) </details> ### ⚠️ 多机部署注意事项 > [!WARNING] > - **必须设置** `SESSION_SECRET` - 否则登录状态不一致 > - **公用 Redis 必须设置** `CRYPTO_SECRET` - 否则数据无法解密 ### 🔄 渠道重试与缓存 **重试配置:** `设置 → 运营设置 → 通用设置 → 失败重试次数` **缓存配置:** - `REDIS_CONN_STRING`:Redis 缓存(推荐) - `MEMORY_CACHE_ENABLED`:内存缓存 --- ## 🔗 相关项目 ### 上游项目 | 项目 | 说明 | |------|------| | [One API](https://github.com/songquanpeng/one-api) | 原版项目基础 | | [Midjourney-Proxy](https://github.com/novicezk/midjourney-proxy) | Midjourney 接口支持 | ### 配套工具 | 项目 | 说明 | |------|------| | [new-api-key-tool](https://github.com/Calcium-Ion/new-api-key-tool) | Key 额度查询工具 | | [new-api-horizon](https://github.com/Calcium-Ion/new-api-horizon) | New API 高性能优化版 | --- ## 💬 帮助支持 ### 📖 文档资源 | 资源 | 链接 | |------|------| | 📘 常见问题 | [FAQ](https://docs.newapi.pro/zh/docs/support/faq) | | 💬 社区交流 | [交流渠道](https://docs.newapi.pro/zh/docs/support/community-interaction) | | 🐛 反馈问题 | [问题反馈](https://docs.newapi.pro/zh/docs/support/feedback-issues) | | 📚 完整文档 | [官方文档](https://docs.newapi.pro/zh/docs) | ### 🤝 贡献指南 欢迎各种形式的贡献! - 🐛 报告 Bug - 💡 提出新功能 - 📝 改进文档 - 🔧 提交代码 --- ## 📜 许可证 本项目采用 [GNU Affero 通用公共许可证 v3.0 (AGPLv3)](./LICENSE) 授权。 本项目为开源项目,在 [One API](https://github.com/songquanpeng/one-api)(MIT 许可证)的基础上进行二次开发。 如果您所在的组织政策不允许使用 AGPLv3 许可的软件,或您希望规避 AGPLv3 的开源义务,请发送邮件至:[support@quantumnous.com](mailto:support@quantumnous.com) --- ## 🌟 Star History <div align="center"> [![Star History Chart](https://api.star-history.com/svg?repos=Calcium-Ion/new-api&type=Date)](https://star-history.com/#Calcium-Ion/new-api&Date) </div> --- <div align="center"> ### 💖 感谢使用 New API 如果这个项目对你有帮助,欢迎给我们一个 ⭐️ Star! **[官方文档](https://docs.newapi.pro/zh/docs)** • **[问题反馈](https://github.com/Calcium-Ion/new-api/issues)** • **[最新发布](https://github.com/Calcium-Ion/new-api/releases)** <sub>Built with ❤️ by QuantumNous</sub> </div>
▸ 中文总结(生成于 2026-08-02 16:44)

QuantumNous/new-api 项目介绍

该项目是一个统一的大模型网关与 AI 资产管理平台,由 QuantumNous 维护,基于开源项目 One API 二次开发,核心定位是将多种大模型服务聚合到一个入口,并以统一/可转换的 API 格式对外提供,同时承担用量统计、成本核算、权限管理等企业级功能。

这个项目是做什么的

  • 提供统一的 AI 模型接入网关,实现多模型聚合与分发。它支持将各种主流 LLM 的请求转换为 OpenAI、Claude、Gemini 等兼容格式,让客户端可以用一套 API 访问不同厂商的模型。
  • 面向个人和企业提供集中的模型管理能力,包括令牌(Token)分组、模型限制、用户管理、用量统计、成本核算、充值额度分配等。
  • 可用于合法授权场景下的 API 网关、组织内部鉴权、多模型管理、用量统计、成本核算和私有化部署。

解决什么问题

  • 解决多家 AI 模型 API 格式不统一、管理分散的问题,通过一个网关屏蔽底层差异。
  • 解决企业内部多模型使用的鉴权、配额、计费、审计问题。
  • 解决原版 One API 功能不足的问题,提供更现代 UI、更多模型格式支持、更细粒度的计费策略。

核心技术架构与实现思路

  • 基于 Go 语言开发,兼容原版 One API 的数据库结构,可平滑迁移。
  • 支持 SQLite 作为默认本地数据库,也支持 MySQL ≥ 5.7.8 和 PostgreSQL ≥ 9.6,并可通过环境变量切换。
  • 支持 Redis 作为分布式缓存和多机部署的必要组件(需设置 REDIS_CONN_STRING)。
  • 以 Docker / Docker Compose 为主要部署方式,也支持宝塔面板一键安装,仅支持 64 位系统(amd64 / arm64)。
  • 内置智能路由:渠道加权随机、失败自动重试、用户级别模型限流。

值得关注的技术亮点

  • 多格式转换能力:
    • OpenAI Compatible ⇄ Claude Messages
    • OpenAI Compatible → Google Gemini
    • Google Gemini → OpenAI Compatible(仅文本,暂不支持函数调用)
    • OpenAI Compatible ⇄ OpenAI Responses(开发中)
    • 支持“思考转内容”功能
  • API 格式覆盖广:支持 OpenAI Chat/Responses/Realtime(含 Azure)、Claude Messages、Google Gemini、Rerank(Cohere、Jina)、Midjourney-Proxy、Suno-API、Dify 等。
  • Reasoning Effort 支持:可通过模型名后缀控制推理强度,如 o3-mini-high、gpt-5-low、claude-3-7-sonnet-20250219-thinking、gemini-2.5-pro-thinking 等。
  • 完整的环境变量配置体系:包括 SESSION_SECRET(多机必需)、CRYPTO_SECRET(Redis 必需)、SQL_DSN、STREAMING_TIMEOUT、MAX_REQUEST_BODY_MB(防 zip bomb)等。
  • 授权与安全:支持 Discord、LinuxDO、Telegram、OIDC 认证登录,并可通过配套工具 new-api-key-tool 查询 Key 额度。
  • 成本管理细致:支持 OpenAI、Azure、DeepSeek、Claude、Qwen 等模型的缓存计费统计,支持按次、按量或缓存命中成本核算。
  • 开源协议与上游关系:项目基于 One API(MIT 许可证)二次开发,本项目采用 AGPLv3 许可证。

快速部署示例(Docker)

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

# 使用 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

部署完成后访问 http://localhost:3000 即可使用。