|
|
@@ -4,11 +4,11 @@
|
|
|
|
|
|
# New API
|
|
|
|
|
|
-🍥 **新一代大模型网关与AI资产管理系统**
|
|
|
+🍥 **Next-Generation LLM Gateway and AI Asset Management System**
|
|
|
|
|
|
<p align="center">
|
|
|
- <strong>中文</strong> |
|
|
|
- <a href="./README.en.md">English</a> |
|
|
|
+ <a href="./README.zh.md">中文</a> |
|
|
|
+ <strong>English</strong> |
|
|
|
<a href="./README.fr.md">Français</a> |
|
|
|
<a href="./README.ja.md">日本語</a>
|
|
|
</p>
|
|
|
@@ -45,31 +45,31 @@
|
|
|
</p>
|
|
|
|
|
|
<p align="center">
|
|
|
- <a href="#-快速开始">快速开始</a> •
|
|
|
- <a href="#-主要特性">主要特性</a> •
|
|
|
- <a href="#-部署">部署</a> •
|
|
|
- <a href="#-文档">文档</a> •
|
|
|
- <a href="#-帮助支持">帮助</a>
|
|
|
+ <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>
|
|
|
|
|
|
-## 📝 项目说明
|
|
|
+## 📝 Project Description
|
|
|
|
|
|
> [!NOTE]
|
|
|
-> 本项目为开源项目,在 [One API](https://github.com/songquanpeng/one-api) 的基础上进行二次开发
|
|
|
+> This is an open-source project developed based on [One API](https://github.com/songquanpeng/one-api)
|
|
|
|
|
|
> [!IMPORTANT]
|
|
|
-> - 本项目仅供个人学习使用,不保证稳定性,且不提供任何技术支持
|
|
|
-> - 使用者必须在遵循 OpenAI 的 [使用条款](https://openai.com/policies/terms-of-use) 以及**法律法规**的情况下使用,不得用于非法用途
|
|
|
-> - 根据 [《生成式人工智能服务管理暂行办法》](http://www.cac.gov.cn/2023-07/13/c_1690898327029107.htm) 的要求,请勿对中国地区公众提供一切未经备案的生成式人工智能服务
|
|
|
+> - This project is for personal learning purposes only, with no guarantee of stability or technical support
|
|
|
+> - Users must comply with OpenAI's [Terms of Use](https://openai.com/policies/terms-of-use) and **applicable laws and regulations**, and must not use it for illegal purposes
|
|
|
+> - According to the [《Interim Measures for the Management of Generative Artificial Intelligence Services》](http://www.cac.gov.cn/2023-07/13/c_1690898327029107.htm), please do not provide any unregistered generative AI services to the public in China.
|
|
|
|
|
|
---
|
|
|
|
|
|
-## 🤝 我们信任的合作伙伴
|
|
|
+## 🤝 Trusted Partners
|
|
|
|
|
|
<p align="center">
|
|
|
- <em>排名不分先后</em>
|
|
|
+ <em>No particular order</em>
|
|
|
</p>
|
|
|
|
|
|
<p align="center">
|
|
|
@@ -77,13 +77,13 @@
|
|
|
<img src="./docs/images/cherry-studio.png" alt="Cherry Studio" height="80" />
|
|
|
</a>
|
|
|
<a href="https://bda.pku.edu.cn/" target="_blank">
|
|
|
- <img src="./docs/images/pku.png" alt="北京大学" height="80" />
|
|
|
+ <img src="./docs/images/pku.png" alt="Peking University" 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" />
|
|
|
+ <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" />
|
|
|
+ <img src="./docs/images/aliyun.png" alt="Alibaba Cloud" height="80" />
|
|
|
</a>
|
|
|
<a href="https://io.net/" target="_blank">
|
|
|
<img src="./docs/images/io-net.png" alt="IO.NET" height="80" />
|
|
|
@@ -92,7 +92,7 @@
|
|
|
|
|
|
---
|
|
|
|
|
|
-## 🙏 特别鸣谢
|
|
|
+## 🙏 Special Thanks
|
|
|
|
|
|
<p align="center">
|
|
|
<a href="https://www.jetbrains.com/?from=new-api" target="_blank">
|
|
|
@@ -101,42 +101,42 @@
|
|
|
</p>
|
|
|
|
|
|
<p align="center">
|
|
|
- <strong>感谢 <a href="https://www.jetbrains.com/?from=new-api">JetBrains</a> 为本项目提供免费的开源开发许可证</strong>
|
|
|
+ <strong>Thanks to <a href="https://www.jetbrains.com/?from=new-api">JetBrains</a> for providing free open-source development license for this project</strong>
|
|
|
</p>
|
|
|
|
|
|
---
|
|
|
|
|
|
-## 🚀 快速开始
|
|
|
+## 🚀 Quick Start
|
|
|
|
|
|
-### 使用 Docker Compose(推荐)
|
|
|
+### Using Docker Compose (Recommended)
|
|
|
|
|
|
```bash
|
|
|
-# 克隆项目
|
|
|
+# Clone the project
|
|
|
git clone https://github.com/QuantumNous/new-api.git
|
|
|
cd new-api
|
|
|
|
|
|
-# 编辑 docker-compose.yml 配置
|
|
|
+# Edit docker-compose.yml configuration
|
|
|
nano docker-compose.yml
|
|
|
|
|
|
-# 启动服务
|
|
|
+# Start the service
|
|
|
docker-compose up -d
|
|
|
```
|
|
|
|
|
|
<details>
|
|
|
-<summary><strong>使用 Docker 命令</strong></summary>
|
|
|
+<summary><strong>Using Docker Commands</strong></summary>
|
|
|
|
|
|
```bash
|
|
|
-# 拉取最新镜像
|
|
|
+# Pull the latest image
|
|
|
docker pull calciumion/new-api:latest
|
|
|
|
|
|
-# 使用 SQLite(默认)
|
|
|
+# 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
|
|
|
|
|
|
-# 使用 MySQL
|
|
|
+# Using MySQL
|
|
|
docker run --name new-api -d --restart always \
|
|
|
-p 3000:3000 \
|
|
|
-e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" \
|
|
|
@@ -145,94 +145,94 @@ docker run --name new-api -d --restart always \
|
|
|
calciumion/new-api:latest
|
|
|
```
|
|
|
|
|
|
-> **💡 提示:** `-v ./data:/data` 会将数据保存在当前目录的 `data` 文件夹中,你也可以改为绝对路径如 `-v /your/custom/path:/data`
|
|
|
+> **💡 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`
|
|
|
|
|
|
</details>
|
|
|
|
|
|
---
|
|
|
|
|
|
-🎉 部署完成后,访问 `http://localhost:3000` 即可使用!
|
|
|
+🎉 After deployment is complete, visit `http://localhost:3000` to start using!
|
|
|
|
|
|
-📖 更多部署方式请参考 [部署指南](https://docs.newapi.pro/zh/docs/installation)
|
|
|
+📖 For more deployment methods, please refer to [Deployment Guide](https://docs.newapi.pro/en/docs/installation)
|
|
|
|
|
|
---
|
|
|
|
|
|
-## 📚 文档
|
|
|
+## 📚 Documentation
|
|
|
|
|
|
<div align="center">
|
|
|
|
|
|
-### 📖 [官方文档](https://docs.newapi.pro/zh/docs) | [](https://deepwiki.com/QuantumNous/new-api)
|
|
|
+### 📖 [Official Documentation](https://docs.newapi.pro/en/docs) | [](https://deepwiki.com/QuantumNous/new-api)
|
|
|
|
|
|
</div>
|
|
|
|
|
|
-**快速导航:**
|
|
|
+**Quick Navigation:**
|
|
|
|
|
|
-| 分类 | 链接 |
|
|
|
+| Category | Link |
|
|
|
|------|------|
|
|
|
-| 🚀 部署指南 | [安装文档](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) |
|
|
|
+| 🚀 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) |
|
|
|
|
|
|
---
|
|
|
|
|
|
-## ✨ 主要特性
|
|
|
+## ✨ Key Features
|
|
|
|
|
|
-> 详细特性请参考 [特性说明](https://docs.newapi.pro/zh/docs/guide/wiki/basic-concepts/features-introduction)
|
|
|
+> For detailed features, please refer to [Features Introduction](https://docs.newapi.pro/en/docs/guide/wiki/basic-concepts/features-introduction)
|
|
|
|
|
|
-### 🎨 核心功能
|
|
|
+### 🎨 Core Functions
|
|
|
|
|
|
-| 特性 | 说明 |
|
|
|
+| Feature | Description |
|
|
|
|------|------|
|
|
|
-| 🎨 全新 UI | 现代化的用户界面设计 |
|
|
|
-| 🌍 多语言 | 支持中文、英文、法语、日语 |
|
|
|
-| 🔄 数据兼容 | 完全兼容原版 One API 数据库 |
|
|
|
-| 📈 数据看板 | 可视化控制台与统计分析 |
|
|
|
-| 🔒 权限管理 | 令牌分组、模型限制、用户管理 |
|
|
|
-
|
|
|
-### 💰 支付与计费
|
|
|
-
|
|
|
-- ✅ 在线充值(易支付、Stripe)
|
|
|
-- ✅ 模型按次数收费
|
|
|
-- ✅ 缓存计费支持(OpenAI、Azure、DeepSeek、Claude、Qwen等所有支持的模型)
|
|
|
-- ✅ 灵活的计费策略配置
|
|
|
-
|
|
|
-### 🔐 授权与安全
|
|
|
-
|
|
|
-- 😈 Discord 授权登录
|
|
|
-- 🤖 LinuxDO 授权登录
|
|
|
-- 📱 Telegram 授权登录
|
|
|
-- 🔑 OIDC 统一认证
|
|
|
-- 🔍 Key 查询使用额度(配合 [neko-api-key-tool](https://github.com/Calcium-Ion/neko-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)
|
|
|
-
|
|
|
-**智能路由:**
|
|
|
-- ⚖️ 渠道加权随机
|
|
|
-- 🔄 失败自动重试
|
|
|
-- 🚦 用户级别模型限流
|
|
|
-
|
|
|
-**格式转换:**
|
|
|
+| 🎨 New UI | Modern user interface design |
|
|
|
+| 🌍 Multi-language | Supports 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 |
|
|
|
+
|
|
|
+### 💰 Payment and Billing
|
|
|
+
|
|
|
+- ✅ Online recharge (EPay, Stripe)
|
|
|
+- ✅ Pay-per-use model pricing
|
|
|
+- ✅ Cache billing support (OpenAI, Azure, DeepSeek, Claude, Qwen and all supported models)
|
|
|
+- ✅ Flexible billing policy configuration
|
|
|
+
|
|
|
+### 🔐 Authorization and Security
|
|
|
+
|
|
|
+- 😈 Discord authorization login
|
|
|
+- 🤖 LinuxDO authorization login
|
|
|
+- 📱 Telegram authorization login
|
|
|
+- 🔑 OIDC unified authentication
|
|
|
+- 🔍 Key quota query usage (with [neko-api-key-tool](https://github.com/Calcium-Ion/neko-api-key-tool))
|
|
|
+
|
|
|
+### 🚀 Advanced Features
|
|
|
+
|
|
|
+**API Format Support:**
|
|
|
+- ⚡ [OpenAI Responses](https://docs.newapi.pro/en/docs/api/ai-model/chat/openai/create-response)
|
|
|
+- ⚡ [OpenAI Realtime API](https://docs.newapi.pro/en/docs/api/ai-model/realtime/create-realtime-session) (including Azure)
|
|
|
+- ⚡ [Claude Messages](https://docs.newapi.pro/en/docs/api/ai-model/chat/create-message)
|
|
|
+- ⚡ [Google Gemini](https://doc.newapi.pro/en/api/google-gemini-chat)
|
|
|
+- 🔄 [Rerank Models](https://docs.newapi.pro/en/docs/api/ai-model/rerank/create-rerank) (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** - 仅支持文本,暂不支持函数调用
|
|
|
-- 🚧 **OpenAI Compatible ⇄ OpenAI Responses** - 开发中
|
|
|
-- 🔄 **思考转内容功能**
|
|
|
+- 🔄 **Google Gemini → OpenAI Compatible** - Text only, function calling not supported yet
|
|
|
+- 🚧 **OpenAI Compatible ⇄ OpenAI Responses** - In development
|
|
|
+- 🔄 **Thinking-to-content functionality**
|
|
|
|
|
|
-**Reasoning Effort 支持:**
|
|
|
+**Reasoning Effort Support:**
|
|
|
|
|
|
<details>
|
|
|
-<summary>查看详细配置</summary>
|
|
|
+<summary>View detailed configuration</summary>
|
|
|
|
|
|
-**OpenAI 系列模型:**
|
|
|
+**OpenAI series models:**
|
|
|
- `o3-mini-high` - High reasoning effort
|
|
|
- `o3-mini-medium` - Medium reasoning effort
|
|
|
- `o3-mini-low` - Low reasoning effort
|
|
|
@@ -240,119 +240,119 @@ docker run --name new-api -d --restart always \
|
|
|
- `gpt-5-medium` - Medium reasoning effort
|
|
|
- `gpt-5-low` - Low reasoning effort
|
|
|
|
|
|
-**Claude 思考模型:**
|
|
|
-- `claude-3-7-sonnet-20250219-thinking` - 启用思考模式
|
|
|
+**Claude thinking models:**
|
|
|
+- `claude-3-7-sonnet-20250219-thinking` - Enable thinking mode
|
|
|
|
|
|
-**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` 来控制思考力度(无需再设置思考预算后缀)
|
|
|
+**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>
|
|
|
|
|
|
---
|
|
|
|
|
|
-## 🤖 模型支持
|
|
|
+## 🤖 Model Support
|
|
|
|
|
|
-> 详情请参考 [接口文档 - 中继接口](https://docs.newapi.pro/zh/docs/api)
|
|
|
+> For details, please refer to [API Documentation - Relay Interface](https://docs.newapi.pro/en/docs/api)
|
|
|
|
|
|
-| 模型类型 | 说明 | 文档 |
|
|
|
+| Model Type | Description | Documentation |
|
|
|
|---------|------|------|
|
|
|
-| 🤖 OpenAI GPTs | gpt-4-gizmo-* 系列 | - |
|
|
|
-| 🎨 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/create-message) |
|
|
|
-| 🌐 Gemini | Google Gemini 格式 | [文档](https://doc.newapi.pro/api/google-gemini-chat) |
|
|
|
-| 🔧 Dify | ChatFlow 模式 | - |
|
|
|
-| 🎯 自定义 | 支持完整调用地址 | - |
|
|
|
+| 🤖 OpenAI GPTs | gpt-4-gizmo-* series | - |
|
|
|
+| 🎨 Midjourney-Proxy | [Midjourney-Proxy(Plus)](https://github.com/novicezk/midjourney-proxy) | [Documentation](https://doc.newapi.pro/en/api/midjourney-proxy-image) |
|
|
|
+| 🎵 Suno-API | [Suno API](https://github.com/Suno-API/Suno-API) | [Documentation](https://doc.newapi.pro/en/api/suno-music) |
|
|
|
+| 🔄 Rerank | Cohere, Jina | [Documentation](https://docs.newapi.pro/en/docs/api/ai-model/rerank/create-rerank) |
|
|
|
+| 💬 Claude | Messages format | [Documentation](https://docs.newapi.pro/en/docs/api/ai-model/chat/create-message) |
|
|
|
+| 🌐 Gemini | Google Gemini format | [Documentation](https://doc.newapi.pro/en/api/google-gemini-chat) |
|
|
|
+| 🔧 Dify | ChatFlow mode | - |
|
|
|
+| 🎯 Custom | Supports complete call address | - |
|
|
|
|
|
|
-### 📡 支持的接口
|
|
|
+### 📡 Supported Interfaces
|
|
|
|
|
|
<details>
|
|
|
-<summary>查看完整接口列表</summary>
|
|
|
-
|
|
|
-- [聊天接口 (Chat Completions)](https://docs.newapi.pro/zh/docs/api/ai-model/chat/openai/create-chat-completion)
|
|
|
-- [响应接口 (Responses)](https://docs.newapi.pro/zh/docs/api/ai-model/chat/openai/create-response)
|
|
|
-- [图像接口 (Image)](https://docs.newapi.pro/zh/docs/api/ai-model/images/openai/v1-images-generations--post)
|
|
|
-- [音频接口 (Audio)](https://docs.newapi.pro/zh/docs/api/ai-model/audio/openai/create-transcription)
|
|
|
-- [视频接口 (Video)](https://docs.newapi.pro/zh/docs/api/ai-model/videos/create-video-generation)
|
|
|
-- [嵌入接口 (Embeddings)](https://docs.newapi.pro/zh/docs/api/ai-model/embeddings/create-embedding)
|
|
|
-- [重排序接口 (Rerank)](https://docs.newapi.pro/zh/docs/api/ai-model/rerank/create-rerank)
|
|
|
-- [实时对话 (Realtime)](https://docs.newapi.pro/zh/docs/api/ai-model/realtime/create-realtime-session)
|
|
|
-- [Claude 聊天](https://docs.newapi.pro/zh/docs/api/ai-model/chat/create-message)
|
|
|
-- [Google Gemini 聊天](https://doc.newapi.pro/api/google-gemini-chat)
|
|
|
+<summary>View complete interface list</summary>
|
|
|
+
|
|
|
+- [Chat Interface (Chat Completions)](https://docs.newapi.pro/en/docs/api/ai-model/chat/openai/create-chat-completion)
|
|
|
+- [Response Interface (Responses)](https://docs.newapi.pro/en/docs/api/ai-model/chat/openai/create-response)
|
|
|
+- [Image Interface (Image)](https://docs.newapi.pro/en/docs/api/ai-model/images/openai/v1-images-generations--post)
|
|
|
+- [Audio Interface (Audio)](https://docs.newapi.pro/en/docs/api/ai-model/audio/openai/create-transcription)
|
|
|
+- [Video Interface (Video)](https://docs.newapi.pro/en/docs/api/ai-model/videos/create-video-generation)
|
|
|
+- [Embedding Interface (Embeddings)](https://docs.newapi.pro/en/docs/api/ai-model/embeddings/create-embedding)
|
|
|
+- [Rerank Interface (Rerank)](https://docs.newapi.pro/en/docs/api/ai-model/rerank/create-rerank)
|
|
|
+- [Realtime Conversation (Realtime)](https://docs.newapi.pro/en/docs/api/ai-model/realtime/create-realtime-session)
|
|
|
+- [Claude Chat](https://docs.newapi.pro/en/docs/api/ai-model/chat/create-message)
|
|
|
+- [Google Gemini Chat](https://doc.newapi.pro/en/api/google-gemini-chat)
|
|
|
|
|
|
</details>
|
|
|
|
|
|
---
|
|
|
|
|
|
-## 🚢 部署
|
|
|
+## 🚢 Deployment
|
|
|
|
|
|
> [!TIP]
|
|
|
-> **最新版 Docker 镜像:** `calciumion/new-api:latest`
|
|
|
+> **Latest Docker image:** `calciumion/new-api:latest`
|
|
|
|
|
|
-### 📋 部署要求
|
|
|
+### 📋 Deployment Requirements
|
|
|
|
|
|
-| 组件 | 要求 |
|
|
|
+| Component | Requirement |
|
|
|
|------|------|
|
|
|
-| **本地数据库** | SQLite(Docker 需挂载 `/data` 目录)|
|
|
|
-| **远程数据库** | MySQL ≥ 5.7.8 或 PostgreSQL ≥ 9.6 |
|
|
|
-| **容器引擎** | Docker / Docker Compose |
|
|
|
+| **Local database** | SQLite (Docker must mount `/data` directory)|
|
|
|
+| **Remote database** | MySQL ≥ 5.7.8 or PostgreSQL ≥ 9.6 |
|
|
|
+| **Container engine** | Docker / Docker Compose |
|
|
|
|
|
|
-### ⚙️ 环境变量配置
|
|
|
+### ⚙️ Environment Variable Configuration
|
|
|
|
|
|
<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)
|
|
|
+<summary>Common environment variable configuration</summary>
|
|
|
+
|
|
|
+| Variable Name | Description | Default Value |
|
|
|
+|--------|------|--------|
|
|
|
+| `SESSION_SECRET` | Session secret (required for multi-machine deployment) | - |
|
|
|
+| `CRYPTO_SECRET` | Encryption secret (required for Redis) | - |
|
|
|
+| `SQL_DSN` | Database connection string | - |
|
|
|
+| `REDIS_CONN_STRING` | Redis connection string | - |
|
|
|
+| `STREAMING_TIMEOUT` | Streaming timeout (seconds) | `300` |
|
|
|
+| `STREAM_SCANNER_MAX_BUFFER_MB` | Max per-line buffer (MB) for the stream scanner; increase when upstream sends huge image/base64 payloads | `64` |
|
|
|
+| `MAX_REQUEST_BODY_MB` | Max request body size (MB, counted **after decompression**; prevents huge requests/zip bombs from exhausting memory). Exceeding it returns `413` | `32` |
|
|
|
+| `AZURE_DEFAULT_API_VERSION` | Azure API version | `2025-04-01-preview` |
|
|
|
+| `ERROR_LOG_ENABLED` | Error log switch | `false` |
|
|
|
+| `PYROSCOPE_URL` | Pyroscope server address | - |
|
|
|
+| `PYROSCOPE_APP_NAME` | Pyroscope application name | `new-api` |
|
|
|
+| `PYROSCOPE_BASIC_AUTH_USER` | Pyroscope basic auth user | - |
|
|
|
+| `PYROSCOPE_BASIC_AUTH_PASSWORD` | Pyroscope basic auth password | - |
|
|
|
+| `PYROSCOPE_MUTEX_RATE` | Pyroscope mutex sampling rate | `5` |
|
|
|
+| `PYROSCOPE_BLOCK_RATE` | Pyroscope block sampling rate | `5` |
|
|
|
+| `HOSTNAME` | Hostname tag for Pyroscope | `new-api` |
|
|
|
+
|
|
|
+📖 **Complete configuration:** [Environment Variables Documentation](https://docs.newapi.pro/en/docs/installation/config-maintenance/environment-variables)
|
|
|
|
|
|
</details>
|
|
|
|
|
|
-### 🔧 部署方式
|
|
|
+### 🔧 Deployment Methods
|
|
|
|
|
|
<details>
|
|
|
-<summary><strong>方式 1:Docker Compose(推荐)</strong></summary>
|
|
|
+<summary><strong>Method 1: Docker Compose (Recommended)</strong></summary>
|
|
|
|
|
|
```bash
|
|
|
-# 克隆项目
|
|
|
+# Clone the project
|
|
|
git clone https://github.com/QuantumNous/new-api.git
|
|
|
cd new-api
|
|
|
|
|
|
-# 编辑配置
|
|
|
+# Edit configuration
|
|
|
nano docker-compose.yml
|
|
|
|
|
|
-# 启动服务
|
|
|
+# Start service
|
|
|
docker-compose up -d
|
|
|
```
|
|
|
|
|
|
</details>
|
|
|
|
|
|
<details>
|
|
|
-<summary><strong>方式 2:Docker 命令</strong></summary>
|
|
|
+<summary><strong>Method 2: Docker Commands</strong></summary>
|
|
|
|
|
|
-**使用 SQLite:**
|
|
|
+**Using SQLite:**
|
|
|
```bash
|
|
|
docker run --name new-api -d --restart always \
|
|
|
-p 3000:3000 \
|
|
|
@@ -361,7 +361,7 @@ docker run --name new-api -d --restart always \
|
|
|
calciumion/new-api:latest
|
|
|
```
|
|
|
|
|
|
-**使用 MySQL:**
|
|
|
+**Using MySQL:**
|
|
|
```bash
|
|
|
docker run --name new-api -d --restart always \
|
|
|
-p 3000:3000 \
|
|
|
@@ -371,76 +371,76 @@ docker run --name new-api -d --restart always \
|
|
|
calciumion/new-api:latest
|
|
|
```
|
|
|
|
|
|
-> **💡 路径说明:**
|
|
|
-> - `./data:/data` - 相对路径,数据保存在当前目录的 data 文件夹
|
|
|
-> - 也可使用绝对路径,如:`/your/custom/path:/data`
|
|
|
+> **💡 Path explanation:**
|
|
|
+> - `./data:/data` - Relative path, data saved in the data folder of the current directory
|
|
|
+> - You can also use absolute path, e.g.: `/your/custom/path:/data`
|
|
|
|
|
|
</details>
|
|
|
|
|
|
<details>
|
|
|
-<summary><strong>方式 3:宝塔面板</strong></summary>
|
|
|
+<summary><strong>Method 3: BaoTa Panel</strong></summary>
|
|
|
|
|
|
-1. 安装宝塔面板(≥ 9.2.0 版本)
|
|
|
-2. 在应用商店搜索 **New-API**
|
|
|
-3. 一键安装
|
|
|
+1. Install BaoTa Panel (≥ 9.2.0 version)
|
|
|
+2. Search for **New-API** in the application store
|
|
|
+3. One-click installation
|
|
|
|
|
|
-📖 [图文教程](./docs/BT.md)
|
|
|
+📖 [Tutorial with images](./docs/BT.md)
|
|
|
|
|
|
</details>
|
|
|
|
|
|
-### ⚠️ 多机部署注意事项
|
|
|
+### ⚠️ Multi-machine Deployment Considerations
|
|
|
|
|
|
> [!WARNING]
|
|
|
-> - **必须设置** `SESSION_SECRET` - 否则登录状态不一致
|
|
|
-> - **公用 Redis 必须设置** `CRYPTO_SECRET` - 否则数据无法解密
|
|
|
+> - **Must set** `SESSION_SECRET` - Otherwise login status inconsistent
|
|
|
+> - **Shared Redis must set** `CRYPTO_SECRET` - Otherwise data cannot be decrypted
|
|
|
|
|
|
-### 🔄 渠道重试与缓存
|
|
|
+### 🔄 Channel Retry and Cache
|
|
|
|
|
|
-**重试配置:** `设置 → 运营设置 → 通用设置 → 失败重试次数`
|
|
|
+**Retry configuration:** `Settings → Operation Settings → General Settings → Failure Retry Count`
|
|
|
|
|
|
-**缓存配置:**
|
|
|
-- `REDIS_CONN_STRING`:Redis 缓存(推荐)
|
|
|
-- `MEMORY_CACHE_ENABLED`:内存缓存
|
|
|
+**Cache configuration:**
|
|
|
+- `REDIS_CONN_STRING`: Redis cache (recommended)
|
|
|
+- `MEMORY_CACHE_ENABLED`: Memory cache
|
|
|
|
|
|
---
|
|
|
|
|
|
-## 🔗 相关项目
|
|
|
+## 🔗 Related Projects
|
|
|
|
|
|
-### 上游项目
|
|
|
+### Upstream Projects
|
|
|
|
|
|
-| 项目 | 说明 |
|
|
|
+| Project | Description |
|
|
|
|------|------|
|
|
|
-| [One API](https://github.com/songquanpeng/one-api) | 原版项目基础 |
|
|
|
-| [Midjourney-Proxy](https://github.com/novicezk/midjourney-proxy) | Midjourney 接口支持 |
|
|
|
+| [One API](https://github.com/songquanpeng/one-api) | Original project base |
|
|
|
+| [Midjourney-Proxy](https://github.com/novicezk/midjourney-proxy) | Midjourney interface support |
|
|
|
|
|
|
-### 配套工具
|
|
|
+### Supporting Tools
|
|
|
|
|
|
-| 项目 | 说明 |
|
|
|
+| Project | Description |
|
|
|
|------|------|
|
|
|
-| [neko-api-key-tool](https://github.com/Calcium-Ion/neko-api-key-tool) | Key 额度查询工具 |
|
|
|
-| [new-api-horizon](https://github.com/Calcium-Ion/new-api-horizon) | New API 高性能优化版 |
|
|
|
+| [neko-api-key-tool](https://github.com/Calcium-Ion/neko-api-key-tool) | Key quota query tool |
|
|
|
+| [new-api-horizon](https://github.com/Calcium-Ion/new-api-horizon) | New API high-performance optimized version |
|
|
|
|
|
|
---
|
|
|
|
|
|
-## 💬 帮助支持
|
|
|
+## 💬 Help Support
|
|
|
|
|
|
-### 📖 文档资源
|
|
|
+### 📖 Documentation Resources
|
|
|
|
|
|
-| 资源 | 链接 |
|
|
|
+| Resource | Link |
|
|
|
|------|------|
|
|
|
-| 📘 常见问题 | [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) |
|
|
|
+| 📘 FAQ | [FAQ](https://docs.newapi.pro/en/docs/support/faq) |
|
|
|
+| 💬 Community Interaction | [Communication Channels](https://docs.newapi.pro/en/docs/support/community-interaction) |
|
|
|
+| 🐛 Issue Feedback | [Issue Feedback](https://docs.newapi.pro/en/docs/support/feedback-issues) |
|
|
|
+| 📚 Complete Documentation | [Official Documentation](https://docs.newapi.pro/en/docs) |
|
|
|
|
|
|
-### 🤝 贡献指南
|
|
|
+### 🤝 Contribution Guide
|
|
|
|
|
|
-欢迎各种形式的贡献!
|
|
|
+Welcome all forms of contribution!
|
|
|
|
|
|
-- 🐛 报告 Bug
|
|
|
-- 💡 提出新功能
|
|
|
-- 📝 改进文档
|
|
|
-- 🔧 提交代码
|
|
|
+- 🐛 Report Bugs
|
|
|
+- 💡 Propose New Features
|
|
|
+- 📝 Improve Documentation
|
|
|
+- 🔧 Submit Code
|
|
|
|
|
|
---
|
|
|
|
|
|
@@ -456,11 +456,11 @@ docker run --name new-api -d --restart always \
|
|
|
|
|
|
<div align="center">
|
|
|
|
|
|
-### 💖 感谢使用 New API
|
|
|
+### 💖 Thank you for using New API
|
|
|
|
|
|
-如果这个项目对你有帮助,欢迎给我们一个 ⭐️ Star!
|
|
|
+If this project is helpful to you, welcome to give us a ⭐️ Star!
|
|
|
|
|
|
-**[官方文档](https://docs.newapi.pro/zh/docs)** • **[问题反馈](https://github.com/Calcium-Ion/new-api/issues)** • **[最新发布](https://github.com/Calcium-Ion/new-api/releases)**
|
|
|
+**[Official Documentation](https://docs.newapi.pro/en/docs)** • **[Issue Feedback](https://github.com/Calcium-Ion/new-api/issues)** • **[Latest Release](https://github.com/Calcium-Ion/new-api/releases)**
|
|
|
|
|
|
<sub>Built with ❤️ by QuantumNous</sub>
|
|
|
|