diff --git a/README.en.md b/README.en.md index 2349104aa..60d4f6a02 100644 --- a/README.en.md +++ b/README.en.md @@ -1,6 +1,10 @@

- 中文 | English | Français + 中文 | English | Français | 日本語

+ +> [!NOTE] +> **MT (Machine Translation)**: This document is machine translated. For the most accurate information, please refer to the [Chinese version](./README.md). +
![new-api](/web/public/logo.png) @@ -75,7 +79,7 @@ New API offers a wide range of features, please refer to [Features Introduction] 1. 🎨 Brand new UI interface 2. 🌍 Multi-language support -3. 💰 Online recharge functionality (YiPay) +3. 💰 Online recharge functionality, currently supports EPay and Stripe 4. 🔍 Support for querying usage quotas with keys (works with [neko-api-key-tool](https://github.com/Calcium-Ion/neko-api-key-tool)) 5. 🔄 Compatible with the original One API database 6. 💵 Support for pay-per-use model pricing @@ -96,7 +100,11 @@ New API offers a wide range of features, please refer to [Features Introduction] - Add `-thinking` suffix to enable thinking mode (e.g.: `claude-3-7-sonnet-20250219-thinking`) 16. 🔄 Thinking-to-content functionality 17. 🔄 Model rate limiting for users -18. 💰 Cache billing support, which allows billing at a set ratio when cache is hit: +18. 🔄 Request format conversion functionality, supporting the following three format conversions: + 1. OpenAI Chat Completions => Claude Messages + 2. Claude Messages => OpenAI Chat Completions (can be used for Claude Code to call third-party models) + 3. OpenAI Chat Completions => Gemini Chat +19. 💰 Cache billing support, which allows billing at a set ratio when cache is hit: 1. Set the `Prompt Cache Ratio` option in `System Settings-Operation Settings` 2. Set `Prompt Cache Ratio` in the channel, range 0-1, e.g., setting to 0.5 means billing at 50% when cache is hit 3. Supported channels: @@ -115,7 +123,9 @@ This version supports multiple models, please refer to [API Documentation-Relay 4. Custom channels, supporting full call address input 5. Rerank models ([Cohere](https://cohere.ai/) and [Jina](https://jina.ai/)), [API Documentation](https://docs.newapi.pro/api/jinaai-rerank) 6. Claude Messages format, [API Documentation](https://docs.newapi.pro/api/anthropic-chat) -7. Dify, currently only supports chatflow +7. Google Gemini format, [API Documentation](https://docs.newapi.pro/api/google-gemini-chat/) +8. Dify, currently only supports chatflow +9. For more interfaces, please refer to [API Documentation](https://docs.newapi.pro/api) ## Environment Variable Configuration @@ -192,7 +202,8 @@ For detailed API documentation, please refer to [API Documentation](https://docs - [Image API](https://docs.newapi.pro/api/openai-image) - [Rerank API](https://docs.newapi.pro/api/jinaai-rerank) - [Realtime API](https://docs.newapi.pro/api/openai-realtime) -- [Claude Chat API (messages)](https://docs.newapi.pro/api/anthropic-chat) +- [Claude Chat API](https://docs.newapi.pro/api/anthropic-chat) +- [Google Gemini Chat API](https://docs.newapi.pro/api/google-gemini-chat) ## Related Projects - [One API](https://github.com/songquanpeng/one-api): Original project diff --git a/README.fr.md b/README.fr.md index de788ede4..d06980053 100644 --- a/README.fr.md +++ b/README.fr.md @@ -1,6 +1,10 @@

- 中文 | English | Français + 中文 | English | Français | 日本語

+ +> [!NOTE] +> **MT (Traduction Automatique)**: Ce document est traduit automatiquement. Pour les informations les plus précises, veuillez vous référer à la [version chinoise](./README.md). +
![new-api](/web/public/logo.png) @@ -75,7 +79,7 @@ New API offre un large éventail de fonctionnalités, veuillez vous référer à 1. 🎨 Nouvelle interface utilisateur 2. 🌍 Prise en charge multilingue -3. 💰 Fonctionnalité de recharge en ligne (YiPay) +3. 💰 Fonctionnalité de recharge en ligne, prend actuellement en charge EPay et Stripe 4. 🔍 Prise en charge de la recherche de quotas d'utilisation avec des clés (fonctionne avec [neko-api-key-tool](https://github.com/Calcium-Ion/neko-api-key-tool)) 5. 🔄 Compatible avec la base de données originale de One API 6. 💵 Prise en charge de la tarification des modèles de paiement à l'utilisation @@ -96,7 +100,11 @@ New API offre un large éventail de fonctionnalités, veuillez vous référer à - Ajouter le suffixe `-thinking` pour activer le mode de pensée (par exemple : `claude-3-7-sonnet-20250219-thinking`) 16. 🔄 Fonctionnalité de la pensée au contenu 17. 🔄 Limitation du débit du modèle pour les utilisateurs -18. 💰 Prise en charge de la facturation du cache, qui permet de facturer à un ratio défini lorsque le cache est atteint : +18. 🔄 Fonctionnalité de conversion de format de requête, prenant en charge les trois conversions de format suivantes : + 1. OpenAI Chat Completions => Claude Messages + 2. Claude Messages => OpenAI Chat Completions (peut être utilisé pour Claude Code pour appeler des modèles tiers) + 3. OpenAI Chat Completions => Gemini Chat +19. 💰 Prise en charge de la facturation du cache, qui permet de facturer à un ratio défini lorsque le cache est atteint : 1. Définir l'option `Ratio de cache d'invite` dans `Paramètres système->Paramètres de fonctionnement` 2. Définir le `Ratio de cache d'invite` dans le canal, plage de 0 à 1, par exemple, le définir sur 0,5 signifie facturer à 50 % lorsque le cache est atteint 3. Canaux pris en charge : @@ -115,7 +123,9 @@ Cette version prend en charge plusieurs modèles, veuillez vous référer à [Do 4. Canaux personnalisés, prenant en charge la saisie complète de l'adresse d'appel 5. Modèles Rerank ([Cohere](https://cohere.ai/) et [Jina](https://jina.ai/)), [Documentation de l'API](https://docs.newapi.pro/api/jinaai-rerank) 6. Format de messages Claude, [Documentation de l'API](https://docs.newapi.pro/api/anthropic-chat) -7. Dify, ne prend actuellement en charge que chatflow +7. Format Google Gemini, [Documentation de l'API](https://docs.newapi.pro/api/google-gemini-chat/) +8. Dify, ne prend actuellement en charge que chatflow +9. Pour plus d'interfaces, veuillez vous référer à la [Documentation de l'API](https://docs.newapi.pro/api) ## Configuration des variables d'environnement @@ -192,7 +202,8 @@ Pour une documentation détaillée de l'API, veuillez vous référer à [Documen - [API d'image](https://docs.newapi.pro/api/openai-image) - [API de rerank](https://docs.newapi.pro/api/jinaai-rerank) - [API en temps réel](https://docs.newapi.pro/api/openai-realtime) -- [API de discussion Claude (messages)](https://docs.newapi.pro/api/anthropic-chat) +- [API de discussion Claude](https://docs.newapi.pro/api/anthropic-chat) +- [API de discussion Google Gemini](https://docs.newapi.pro/api/google-gemini-chat) ## Projets connexes - [One API](https://github.com/songquanpeng/one-api) : Projet original diff --git a/README.ja.md b/README.ja.md new file mode 100644 index 000000000..13049e86d --- /dev/null +++ b/README.ja.md @@ -0,0 +1,224 @@ +

+ 中文 | English | Français | 日本語 +

+ +> [!NOTE] +> **MT(機械翻訳)**: この文書は機械翻訳されています。最も正確な情報については、[中国語版](./README.md)を参照してください。 + +
+ +![new-api](/web/public/logo.png) + +# New API + +🍥次世代大規模モデルゲートウェイとAI資産管理システム + +Calcium-Ion%2Fnew-api | Trendshift + +

+ + license + + + release + + + docker + + + docker + + + GoReportCard + +

+
+ +## 📝 プロジェクト説明 + +> [!NOTE] +> 本プロジェクトは、[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)の要求に従い、中国地域の公衆に未登録の生成式AI サービスを提供しないでください。 + +

🤝 信頼できるパートナー

+

 

+

順不同

+

+ Cherry Studio + 北京大学 + UCloud 優刻得 + Alibaba Cloud + IO.NET +

+

 

+ +## 📚 ドキュメント + +詳細なドキュメントは公式Wikiをご覧ください:[https://docs.newapi.pro/](https://docs.newapi.pro/) + +AIが生成したDeepWikiにもアクセスできます: +[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/QuantumNous/new-api) + +## ✨ 主な機能 + +New APIは豊富な機能を提供しています。詳細な機能については[機能説明](https://docs.newapi.pro/wiki/features-introduction)を参照してください: + +1. 🎨 全く新しいUIインターフェース +2. 🌍 多言語サポート +3. 💰 オンラインチャージ機能をサポート、現在EPayとStripeをサポート +4. 🔍 キーによる使用量クォータの照会をサポート([neko-api-key-tool](https://github.com/Calcium-Ion/neko-api-key-tool)と連携) +5. 🔄 オリジナルのOne APIデータベースと互換性あり +6. 💵 モデルの従量課金をサポート +7. ⚖️ チャネルの重み付けランダムをサポート +8. 📈 データダッシュボード(コンソール) +9. 🔒 トークングループ化、モデル制限 +10. 🤖 より多くの認証ログイン方法をサポート(LinuxDO、Telegram、OIDC) +11. 🔄 Rerankモデルをサポート(CohereとJina)、[API ドキュメント](https://docs.newapi.pro/api/jinaai-rerank) +12. ⚡ OpenAI Realtime APIをサポート(Azureチャネルを含む)、[APIドキュメント](https://docs.newapi.pro/api/openai-realtime) +13. ⚡ Claude Messages形式をサポート、[APIドキュメント](https://docs.newapi.pro/api/anthropic-chat) +14. /chat2linkルートを使用してチャット画面に入ることをサポート +15. 🧠 モデル名のサフィックスを通じてreasoning effortを設定することをサポート: + 1. OpenAI oシリーズモデル + - `-high`サフィックスを追加してhigh reasoning effortに設定(例:`o3-mini-high`) + - `-medium`サフィックスを追加してmedium reasoning effortに設定(例:`o3-mini-medium`) + - `-low`サフィックスを追加してlow reasoning effortに設定(例:`o3-mini-low`) + 2. Claude思考モデル + - `-thinking`サフィックスを追加して思考モードを有効にする(例:`claude-3-7-sonnet-20250219-thinking`) +16. 🔄 思考からコンテンツへの機能 +17. 🔄 ユーザーに対するモデルレート制限機能 +18. 🔄 リクエストフォーマット変換機能、以下の3つのフォーマット変換をサポート: + 1. OpenAI Chat Completions => Claude Messages + 2. Claude Messages => OpenAI Chat Completions(Claude Codeがサードパーティモデルを呼び出す際に使用可能) + 3. OpenAI Chat Completions => Gemini Chat +19. 💰 キャッシュ課金サポート、有効にするとキャッシュがヒットした際に設定された比率で課金できます: + 1. `システム設定-運営設定`で`プロンプトキャッシュ倍率`オプションを設定 + 2. チャネルで`プロンプトキャッシュ倍率`を設定、範囲は0-1、例えば0.5に設定するとキャッシュがヒットした際に50%で課金 + 3. サポートされているチャネル: + - [x] OpenAI + - [x] Azure + - [x] DeepSeek + - [x] Claude + +## モデルサポート + +このバージョンは複数のモデルをサポートしています。詳細は[APIドキュメント-中継インターフェース](https://docs.newapi.pro/api)を参照してください: + +1. サードパーティモデル **gpts**(gpt-4-gizmo-*) +2. サードパーティチャネル[Midjourney-Proxy(Plus)](https://github.com/novicezk/midjourney-proxy)インターフェース、[APIドキュメント](https://docs.newapi.pro/api/midjourney-proxy-image) +3. サードパーティチャネル[Suno API](https://github.com/Suno-API/Suno-API)インターフェース、[APIドキュメント](https://docs.newapi.pro/api/suno-music) +4. カスタムチャネル、完全な呼び出しアドレスの入力をサポート +5. Rerankモデル([Cohere](https://cohere.ai/)と[Jina](https://jina.ai/))、[APIドキュメント](https://docs.newapi.pro/api/jinaai-rerank) +6. Claude Messages形式、[APIドキュメント](https://docs.newapi.pro/api/anthropic-chat) +7. Google Gemini形式、[APIドキュメント](https://docs.newapi.pro/api/google-gemini-chat/) +8. Dify、現在はchatflowのみをサポート +9. その他のインターフェースについては[APIドキュメント](https://docs.newapi.pro/api)を参照してください + +## 環境変数設定 + +詳細な設定説明については[インストールガイド-環境変数設定](https://docs.newapi.pro/installation/environment-variables)を参照してください: + +- `GENERATE_DEFAULT_TOKEN`:新規登録ユーザーに初期トークンを生成するかどうか、デフォルトは`false` +- `STREAMING_TIMEOUT`:ストリーミング応答のタイムアウト時間、デフォルトは300秒 +- `DIFY_DEBUG`:Difyチャネルがワークフローとノード情報を出力するかどうか、デフォルトは`true` +- `GET_MEDIA_TOKEN`:画像トークンを統計するかどうか、デフォルトは`true` +- `GET_MEDIA_TOKEN_NOT_STREAM`:非ストリーミングの場合に画像トークンを統計するかどうか、デフォルトは`true` +- `UPDATE_TASK`:非同期タスク(Midjourney、Suno)を更新するかどうか、デフォルトは`true` +- `GEMINI_VISION_MAX_IMAGE_NUM`:Geminiモデルの最大画像数、デフォルトは`16` +- `MAX_FILE_DOWNLOAD_MB`: 最大ファイルダウンロードサイズ、単位MB、デフォルトは`20` +- `CRYPTO_SECRET`:暗号化キー、Redisデータベースの内容を暗号化するために使用 +- `AZURE_DEFAULT_API_VERSION`:Azureチャネルのデフォルトのバージョン、デフォルトは`2025-04-01-preview` +- `NOTIFICATION_LIMIT_DURATION_MINUTE`:メールなどの通知制限の継続時間、デフォルトは`10`分 +- `NOTIFY_LIMIT_COUNT`:指定された継続時間内のユーザー通知の最大数、デフォルトは`2` +- `ERROR_LOG_ENABLED=true`: エラーログを記録して表示するかどうか、デフォルトは`false` + +## デプロイ + +詳細なデプロイガイドについては[インストールガイド-デプロイ方法](https://docs.newapi.pro/installation)を参照してください: + +> [!TIP] +> 最新のDockerイメージ:`calciumion/new-api:latest` + +### マルチマシンデプロイの注意事項 +- 環境変数`SESSION_SECRET`を設定する必要があります。そうしないとマルチマシンデプロイ時にログイン状態が不一致になります +- Redisを共有する場合、`CRYPTO_SECRET`を設定する必要があります。そうしないとマルチマシンデプロイ時にRedisの内容を取得できません + +### デプロイ要件 +- ローカルデータベース(デフォルト):SQLite(Dockerデプロイの場合は`/data`ディレクトリをマウントする必要があります) +- リモートデータベース:MySQLバージョン >= 5.7.8、PgSQLバージョン >= 9.6 + +### デプロイ方法 + +#### 宝塔パネルのDocker機能を使用してデプロイ +宝塔パネル(**9.2.0バージョン**以上)をインストールし、アプリケーションストアで**New-API**を見つけてインストールします。 +[画像付きチュートリアル](./docs/BT.md) + +#### Docker Composeを使用してデプロイ(推奨) +```shell +# プロジェクトをダウンロード +git clone https://github.com/Calcium-Ion/new-api.git +cd new-api +# 必要に応じてdocker-compose.ymlを編集 +# 起動 +docker-compose up -d +``` + +#### Dockerイメージを直接使用 +```shell +# SQLiteを使用 +docker run --name new-api -d --restart always -p 3000:3000 -e TZ=Asia/Shanghai -v /home/ubuntu/data/new-api:/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 /home/ubuntu/data/new-api:/data calciumion/new-api:latest +``` + +## チャネルリトライとキャッシュ +チャネルリトライ機能はすでに実装されており、`設定->運営設定->一般設定->失敗リトライ回数`でリトライ回数を設定できます。**キャッシュ機能を有効にすることを推奨します**。 + +### キャッシュ設定方法 +1. `REDIS_CONN_STRING`:Redisをキャッシュとして設定 +2. `MEMORY_CACHE_ENABLED`:メモリキャッシュを有効にする(Redisを設定した場合は手動設定不要) + +## APIドキュメント + +詳細なAPIドキュメントについては[APIドキュメント](https://docs.newapi.pro/api)を参照してください: + +- [チャットインターフェース(Chat)](https://docs.newapi.pro/api/openai-chat) +- [画像インターフェース(Image)](https://docs.newapi.pro/api/openai-image) +- [再ランク付けインターフェース(Rerank)](https://docs.newapi.pro/api/jinaai-rerank) +- [リアルタイム対話インターフェース(Realtime)](https://docs.newapi.pro/api/openai-realtime) +- [Claudeチャットインターフェース](https://docs.newapi.pro/api/anthropic-chat) +- [Google Geminiチャットインターフェース](https://docs.newapi.pro/api/google-gemini-chat) + +## 関連プロジェクト +- [One API](https://github.com/songquanpeng/one-api):オリジナルプロジェクト +- [Midjourney-Proxy](https://github.com/novicezk/midjourney-proxy):Midjourneyインターフェースサポート +- [neko-api-key-tool](https://github.com/Calcium-Ion/neko-api-key-tool):キーを使用して使用量クォータを照会 + +New APIベースのその他のプロジェクト: +- [new-api-horizon](https://github.com/Calcium-Ion/new-api-horizon):New API高性能最適化版 + +## ヘルプサポート + +問題がある場合は、[ヘルプサポート](https://docs.newapi.pro/support)を参照してください: +- [コミュニティ交流](https://docs.newapi.pro/support/community-interaction) +- [問題のフィードバック](https://docs.newapi.pro/support/feedback-issues) +- [よくある質問](https://docs.newapi.pro/support/faq) + +## 🌟 Star History + +[![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) + diff --git a/README.md b/README.md index 2103fe8fc..af2b64b44 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- 中文 | English | Français + 中文 | English | Français | 日本語

@@ -75,7 +75,7 @@ New API提供了丰富的功能,详细特性请参考[特性说明](https://do 1. 🎨 全新的UI界面 2. 🌍 多语言支持 -3. 💰 支持在线充值功能(易支付) +3. 💰 支持在线充值功能,当前支持易支付和Stripe 4. 🔍 支持用key查询使用额度(配合[neko-api-key-tool](https://github.com/Calcium-Ion/neko-api-key-tool)) 5. 🔄 兼容原版One API的数据库 6. 💵 支持模型按次数收费 @@ -119,7 +119,9 @@ New API提供了丰富的功能,详细特性请参考[特性说明](https://do 4. 自定义渠道,支持填入完整调用地址 5. Rerank模型([Cohere](https://cohere.ai/)和[Jina](https://jina.ai/)),[接口文档](https://docs.newapi.pro/api/jinaai-rerank) 6. Claude Messages 格式,[接口文档](https://docs.newapi.pro/api/anthropic-chat) -7. Dify,当前仅支持chatflow +7. Google Gemini格式,[接口文档](https://docs.newapi.pro/api/google-gemini-chat/) +8. Dify,当前仅支持chatflow +9. 更多接口请参考[接口文档](https://docs.newapi.pro/api) ## 环境变量配置 @@ -128,16 +130,14 @@ New API提供了丰富的功能,详细特性请参考[特性说明](https://do - `GENERATE_DEFAULT_TOKEN`:是否为新注册用户生成初始令牌,默认为 `false` - `STREAMING_TIMEOUT`:流式回复超时时间,默认300秒 - `DIFY_DEBUG`:Dify渠道是否输出工作流和节点信息,默认 `true` -- `FORCE_STREAM_OPTION`:是否覆盖客户端stream_options参数,默认 `true` - `GET_MEDIA_TOKEN`:是否统计图片token,默认 `true` - `GET_MEDIA_TOKEN_NOT_STREAM`:非流情况下是否统计图片token,默认 `true` - `UPDATE_TASK`:是否更新异步任务(Midjourney、Suno),默认 `true` -- `COHERE_SAFETY_SETTING`:Cohere模型安全设置,可选值为 `NONE`, `CONTEXTUAL`, `STRICT`,默认 `NONE` - `GEMINI_VISION_MAX_IMAGE_NUM`:Gemini模型最大图片数量,默认 `16` - `MAX_FILE_DOWNLOAD_MB`: 最大文件下载大小,单位MB,默认 `20` -- `CRYPTO_SECRET`:加密密钥,用于加密数据库内容 +- `CRYPTO_SECRET`:加密密钥,用于加密Redis数据库内容 - `AZURE_DEFAULT_API_VERSION`:Azure渠道默认API版本,默认 `2025-04-01-preview` -- `NOTIFICATION_LIMIT_DURATION_MINUTE`:通知限制持续时间,默认 `10`分钟 +- `NOTIFICATION_LIMIT_DURATION_MINUTE`:邮件等通知限制持续时间,默认 `10`分钟 - `NOTIFY_LIMIT_COUNT`:用户通知在指定持续时间内的最大数量,默认 `2` - `ERROR_LOG_ENABLED=true`: 是否记录并显示错误日志,默认`false` @@ -182,7 +182,7 @@ docker run --name new-api -d --restart always -p 3000:3000 -e SQL_DSN="root:1234 ``` ## 渠道重试与缓存 -渠道重试功能已经实现,可以在`设置->运营设置->通用设置`设置重试次数,**建议开启缓存**功能。 +渠道重试功能已经实现,可以在`设置->运营设置->通用设置->失败重试次数`设置重试次数,**建议开启缓存**功能。 ### 缓存设置方法 1. `REDIS_CONN_STRING`:设置Redis作为缓存 @@ -196,12 +196,12 @@ docker run --name new-api -d --restart always -p 3000:3000 -e SQL_DSN="root:1234 - [图像接口(Image)](https://docs.newapi.pro/api/openai-image) - [重排序接口(Rerank)](https://docs.newapi.pro/api/jinaai-rerank) - [实时对话接口(Realtime)](https://docs.newapi.pro/api/openai-realtime) -- [Claude聊天接口(messages)](https://docs.newapi.pro/api/anthropic-chat) +- [Claude聊天接口](https://docs.newapi.pro/api/anthropic-chat) +- [Google Gemini聊天接口](https://docs.newapi.pro/api/google-gemini-chat) ## 相关项目 - [One API](https://github.com/songquanpeng/one-api):原版项目 - [Midjourney-Proxy](https://github.com/novicezk/midjourney-proxy):Midjourney接口支持 -- [chatnio](https://github.com/Deeptrain-Community/chatnio):下一代AI一站式B/C端解决方案 - [neko-api-key-tool](https://github.com/Calcium-Ion/neko-api-key-tool):用key查询使用额度 其他基于New API的项目: