Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Register via this link to get started → <a href="https://co.yes.vg/register?re
- 📊 **Real-time monitoring & analytics**: Dashboards, active sessions, consumption leaderboards, decision-chain tracing, and proxy health tracking provide second-level visibility.
- 💰 **Price sheet management**: Paginated SQL queries with debounce search and LiteLLM sync keep thousands of model prices searchable in milliseconds.
- 🔁 **Session management**: Five-minute context cache preserves decision trails, reduces vendor switches, and maintains full auditability.
- 🔄 **OpenAI compatibility layer**: Supports `/v1/chat/completions`, handles format conversions, tool calls, reasoning fields, and Codex CLI instruction injection automatically.
- 🔄 **OpenAI-compatible endpoint**: Supports `/v1/chat/completions` (OpenAI-compatible format), passes through tool calls and reasoning fields, enforces strict same-format routing with no cross-format conversion.

## ⚡️ Quick Start

Expand Down Expand Up @@ -217,7 +217,7 @@ Multi-provider pool (Claude / OpenAI / Gemini / others) + PostgreSQL + Redis
2. **Context control**: `SessionManager` fetches the five-minute cache from Redis, enforces concurrency, and records the decision chain.
3. **Rate limiting**: `RateLimitService` applies Lua-driven atomic counters for RPM, spend, and session caps, falling back gracefully if Redis is unavailable.
4. **Routing**: `ProxyProviderResolver` scores vendors with weights, priorities, breaker states, and session reuse, retrying up to three times.
5. **Forwarding & compatibility**: `ProxyForwarder` plus `ResponseTransformer` adapt Claude/OpenAI/Response formats, handle proxies, and honor model redirects.
5. **Forwarding & response handling**: `ProxyForwarder` sends requests upstream; `ProxyResponseHandler` processes response streams while preserving endpoint-native formats, with proxy support and model redirects.
6. **Observability**: Dashboards, leaderboards, and price sheets query PostgreSQL via repositories with hourly aggregations.

## 🚢 Deployment
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ PackyCode 为本软件的用户提供了特别优惠,使用此链接注册并
- 📊 **实时监控与统计**:仪表盘、活跃 Session、消耗排行榜、决策链记录、代理状态追踪,秒级掌控运行态势。
- 💰 **价格表管理**:分页查询 + SQL 优化,支持搜索防抖、LiteLLM 同步,千级模型也能快速检索。
- 🔁 **Session 管理**:5 分钟上下文缓存,记录决策链,避免频繁切换供应商并保留全链路审计。
- 🔄 **OpenAI 兼容层**:支持 `/v1/chat/completions`,自动格式转换、工具调用、reasoning 字段与 Codex CLI 指令注入
- 🔄 **OpenAI 兼容端点**:支持 `/v1/chat/completions`(OpenAI 兼容格式),工具调用与 reasoning 字段透传,严格同格式路由,无跨格式转换

## ⚡️ 快速开始 Quick Start

Expand Down Expand Up @@ -220,7 +220,7 @@ Hono + Proxy Pipeline (认证 → Session 分配 → 限流 → 供应商选择
2. **上下文管理**:`SessionManager` 从 Redis 读取 5 分钟缓存,控制并发并记录决策链。
3. **限流**:`RateLimitService` 使用 Lua 脚本原子写入 RPM/金额/并发指标,Redis 不可用则 Fail-Open 降级。
4. **调度**:`ProviderResolver` 根据权重、优先级、熔断状态与 Session 复用策略选择最佳供应商,至多 3 次重试。
5. **转发与兼容**:`ProxyForwarder` + `ResponseTransformer` 适配 Claude/OpenAI/Response API,支持代理与模型重定向。
5. **转发与响应处理**:`ProxyForwarder` 负责上游请求转发,`ProxyResponseHandler` 处理响应流并保留端点原生格式,支持代理与模型重定向。
6. **监控**:日志、排行榜、价格表等 UI 通过 `repository` 查询 PostgreSQL,以小时级聚合呈现指标。

## 🚢 部署指南 Deployment
Expand Down
33 changes: 2 additions & 31 deletions messages/en/settings/providers/form/sections.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,32 +45,6 @@
"summary": "{failureThreshold} failures / {openDuration} min break / {successThreshold} successes to recover / {maxRetryAttempts} attempts per provider",
"title": "Circuit Breaker"
},
"codexStrategy": {
"desc": "Control how to handle the instructions field in Codex requests; affects gateway compatibility",
"hint": "Hint: Some strict Codex gateways (e.g. 88code, foxcode) require official instructions. Choose \"Auto\" or \"Force official\".",
"select": {
"auto": {
"desc": "Pass through client instructions; on 400 error, retry with official prompt",
"label": "Auto (recommended)"
},
"force": {
"desc": "Always use official Codex CLI instructions (~4000+ chars)",
"label": "Force official"
},
"keep": {
"desc": "Always pass through client instructions, no auto retry (for permissive gateways)",
"label": "Pass-through"
},
"label": "Strategy",
"placeholder": "Select a strategy"
},
"summary": {
"auto": "Auto (recommended)",
"force": "Force official",
"keep": "Pass-through"
},
"title": "Codex Instructions Policy"
},
"mcpPassthrough": {
"desc": "When enabled, pass through MCP tool calls to specified AI provider (e.g. minimax for image recognition, web search)",
"hint": "Hint: MCP passthrough allows Claude Code client to use tool capabilities provided by third-party AI providers (e.g. image recognition, web search)",
Expand Down Expand Up @@ -196,6 +170,8 @@
}
},
"codexOverrides": {
"title": "Codex Parameter Overrides",
"desc": "Override Codex (Responses API) request parameters at the provider level",
"parallelToolCalls": {
"help": "Controls whether parallel tool calls are allowed. \"inherit\" follows the client request. Disabling may reduce tool-call concurrency.",
"label": "Parallel Tool Calls Override",
Expand Down Expand Up @@ -268,11 +244,6 @@
"inherit": "Inherit (follow client request)"
}
},
"joinClaudePool": {
"desc": "When enabled, this provider will participate in load balancing with Claude-type providers",
"help": "Available only when there is a redirect mapping to claude-* models. When users request claude-* models, this provider also joins scheduling.",
"label": "Join Claude Routing Pool"
},
"modelRedirects": {
"label": "Model Redirects",
"optional": "(optional)"
Expand Down
16 changes: 0 additions & 16 deletions messages/en/settings/providers/form/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,6 @@
"codexInstructionsDesc": "(determines scheduling policy)",
"codexInstructionsForce": "Force Official",
"codexInstructionsKeep": "Keep Original",
"codexStrategyAutoDesc": "Pass through client instructions, auto retry with official prompt on 400 error",
"codexStrategyAutoLabel": "Auto (Recommended)",
"codexStrategyConfig": "Codex Instructions Strategy",
"codexStrategyConfigAuto": "Auto (Recommended)",
"codexStrategyConfigForce": "Force Official",
"codexStrategyConfigKeep": "Keep Original",
"codexStrategyDesc": "Control how to handle Codex request instructions field, affects upstream gateway compatibility",
"codexStrategyForceDesc": "Always use official Codex CLI instructions (~4000+ chars)",
"codexStrategyForceLabel": "Force Official",
"codexStrategyHint": "Hint: Some strict Codex gateways (e.g. 88code, foxcode) require official instructions. Choose \"Auto\" or \"Force Official\" strategy",
"codexStrategyKeepDesc": "Always pass through client instructions, no auto retry (for lenient gateways)",
"codexStrategyKeepLabel": "Keep Original",
"codexStrategySelect": "Strategy Selection",
"collapseAll": "Collapse All Advanced Configuration",
"confirmAdd": "Confirm Add",
"confirmAddPending": "Adding...",
Expand All @@ -57,9 +44,6 @@
"filterProvider": "Filter by Provider Type",
"group": "Group",
"groupPlaceholder": "e.g. premium, economy",
"joinClaudePool": "Join Claude Scheduling Pool",
"joinClaudePoolDesc": "When enabled, this provider will participate in load balancing with Claude type providers",
"joinClaudePoolHelp": "Only available when model redirect config contains mappings to claude-* models. When enabled, this provider will also participate in scheduling when users request claude-* models.",
"leaveEmpty": "Leave empty for unlimited",
"limit0Means": "0 means unlimited",
"limit5hLabel": "5-Hour Spending Limit (USD)",
Expand Down
33 changes: 2 additions & 31 deletions messages/ja/settings/providers/form/sections.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,32 +45,6 @@
"summary": "{failureThreshold} 回失敗 / {openDuration} 分間ブレーク / {successThreshold} 回成功で回復 / 各プロバイダー最大 {maxRetryAttempts} 回試行",
"title": "サーキットブレーカー設定"
},
"codexStrategy": {
"desc": "Codex リクエストの instructions フィールドの扱いを制御します。上流ゲートウェイとの互換性に影響します。",
"hint": "ヒント: 88code や foxcode など一部の厳格な Codex 中継では公式 instructions が必要です。「自動」または「公式を強制」を選択してください。",
"select": {
"auto": {
"desc": "クライアントの instructions を透過し、400 エラー時は公式プロンプトで自動再試行",
"label": "自動(推奨)"
},
"force": {
"desc": "常に公式の Codex CLI instructions を使用(約 4000+ 文字)",
"label": "公式を強制"
},
"keep": {
"desc": "常にクライアントの instructions を透過し、自動再試行しない(緩い中継向け)",
"label": "そのまま透過"
},
"label": "ポリシー選択",
"placeholder": "戦略を選択"
},
"summary": {
"auto": "自動(推奨)",
"force": "公式を強制",
"keep": "そのまま透過"
},
"title": "Codex Instructions ポリシー"
},
"mcpPassthrough": {
"desc": "有効にすると、MCP ツール呼び出しを指定された AI プロバイダにパススルーします(例:minimax の画像認識、Web 検索)",
"hint": "ヒント: MCP パススルーにより、Claude Code クライアントは第三者の AI プロバイダー提供のツール機能(画像認識、Web 検索など)を使用できます",
Expand Down Expand Up @@ -197,6 +171,8 @@
}
},
"codexOverrides": {
"title": "Codex パラメータオーバーライド",
"desc": "プロバイダーレベルで Codex (Responses API) リクエストパラメータをオーバーライド",
"parallelToolCalls": {
"help": "並列の tool calls を許可するかどうかを制御します。「クライアントに従う」は parallel_tool_calls を変更しません。無効化すると並列度が下がる可能性があります。",
"label": "並列ツール呼び出しオーバーライド",
Expand Down Expand Up @@ -269,11 +245,6 @@
"inherit": "継承(クライアントに従う)"
}
},
"joinClaudePool": {
"desc": "有効にすると、Claude 系のプロバイダーと共に負荷分散に参加します",
"help": "claude-* へのリダイレクトがある場合のみ利用できます。ユーザーが claude-* モデルを要求した際に本プロバイダーも選択対象になります。",
"label": "Claude ルーティングプールに参加"
},
"modelRedirects": {
"label": "モデルリダイレクト設定",
"optional": "(任意)"
Expand Down
16 changes: 0 additions & 16 deletions messages/ja/settings/providers/form/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,6 @@
"codexInstructionsDesc": "(スケジューリング方針を決定)",
"codexInstructionsForce": "公式を強制",
"codexInstructionsKeep": "元の値を保持",
"codexStrategyAutoDesc": "クライアントの instructions を透過し、400 エラー時は公式プロンプトで自動リトライします",
"codexStrategyAutoLabel": "自動 (推奨)",
"codexStrategyConfig": "Codex Instructions 戦略",
"codexStrategyConfigAuto": "自動 (推奨)",
"codexStrategyConfigForce": "公式を強制",
"codexStrategyConfigKeep": "元の値を保持",
"codexStrategyDesc": "Codex リクエストの instructions フィールドの扱いを制御します。上流ゲートウェイとの互換性に影響します",
"codexStrategyForceDesc": "公式の Codex CLI instructions を常に使用します (約 4000+ 文字)",
"codexStrategyForceLabel": "公式を強制",
"codexStrategyHint": "ヒント: 一部の厳格な Codex ゲートウェイ (例: 88code, foxcode) では公式 instructions が必要です。\"自動\" または \"公式を強制\" を選択してください",
"codexStrategyKeepDesc": "クライアントの instructions を常に透過し、自動リトライしません (柔軟なゲートウェイ向け)",
"codexStrategyKeepLabel": "元の値を保持",
"codexStrategySelect": "戦略の選択",
"collapseAll": "高度な設定をすべて折りたたむ",
"confirmAdd": "追加を確認",
"confirmAddPending": "追加中...",
Expand All @@ -57,9 +44,6 @@
"filterProvider": "プロバイダータイプでフィルタ",
"group": "グループ",
"groupPlaceholder": "例:premium, economy",
"joinClaudePool": "Claude スケジューリングプールに参加",
"joinClaudePoolDesc": "有効にすると、このプロバイダーは Claude タイプのプロバイダーとともに負荷分散スケジューリングに参加します",
"joinClaudePoolHelp": "モデルリダイレクト設定に claude-* モデルへのマッピングが含まれる場合にのみ利用可能です。有効にすると、ユーザーが claude-* モデルを要求した際にも、このプロバイダーがスケジューリング対象になります。",
"leaveEmpty": "無制限の場合は空のままにしてください",
"limit0Means": "0は無制限を意味します",
"limit5hLabel": "5時間支出上限 (USD)",
Expand Down
32 changes: 0 additions & 32 deletions messages/providers-i18n-additions.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@
"modelRedirectsSourceRequired": "源模型名称不能为空",
"modelRedirectsTargetRequired": "目标模型名称不能为空",
"modelRedirectsExists": "模型 \"{model}\" 已存在重定向规则",
"joinClaudePool": "加入 Claude 调度池",
"joinClaudePoolDesc": "启用后,此供应商将与 Claude 类型供应商一起参与负载均衡调度",
"joinClaudePoolHelp": "仅当模型重定向配置中存在映射到 claude-* 模型时可用。启用后,当用户请求 claude-* 模型时,此供应商也会参与调度选择。",
"modelWhitelist": "模型白名单",
"modelWhitelistDesc": "限制此供应商可以处理的模型。默认情况下,供应商可以处理该类型下的所有模型。",
"modelWhitelistLabel": "允许的模型",
Expand Down Expand Up @@ -155,19 +152,6 @@
"proxyTestResultConnectionMethodProxy": "代理",
"proxyTestResultConnectionMethodDirect": "直连",
"proxyTestResultErrorType": "错误类型: {type}",
"codexStrategyConfig": "Codex Instructions 策略",
"codexStrategyConfigAuto": "自动 (推荐)",
"codexStrategyConfigForce": "强制官方",
"codexStrategyConfigKeep": "透传原样",
"codexStrategyDesc": "控制如何处理 Codex 请求的 instructions 字段,影响与上游中转站的兼容性",
"codexStrategySelect": "策略选择",
"codexStrategyAutoLabel": "自动 (推荐)",
"codexStrategyAutoDesc": "透传客户端 instructions,400 错误时自动重试官方 prompt",
"codexStrategyForceLabel": "强制官方",
"codexStrategyForceDesc": "始终使用官方 Codex CLI instructions(约 4000+ 字)",
"codexStrategyKeepLabel": "透传原样",
"codexStrategyKeepDesc": "始终透传客户端 instructions,不自动重试(适用于宽松中转站)",
"codexStrategyHint": "提示: 部分严格的 Codex 中转站(如 88code、foxcode)需要官方 instructions,选择\"自动\"或\"强制官方\"策略",
"confirmAdd": "确认添加",
"confirmUpdate": "确认更新",
"confirmAddPending": "添加中...",
Expand Down Expand Up @@ -325,9 +309,6 @@
"modelRedirectsSourceRequired": "Source model name cannot be empty",
"modelRedirectsTargetRequired": "Target model name cannot be empty",
"modelRedirectsExists": "Model \"{model}\" already has a redirect rule",
"joinClaudePool": "Join Claude Scheduling Pool",
"joinClaudePoolDesc": "When enabled, this provider will participate in load balancing with Claude type providers",
"joinClaudePoolHelp": "Only available when model redirect config contains mappings to claude-* models. When enabled, this provider will also participate in scheduling when users request claude-* models.",
"modelWhitelist": "Model Whitelist",
"modelWhitelistDesc": "Limit models this provider can handle. By default, provider can handle all models of its type.",
"modelWhitelistLabel": "Allowed Models",
Expand Down Expand Up @@ -412,19 +393,6 @@
"proxyTestResultConnectionMethodProxy": "Proxy",
"proxyTestResultConnectionMethodDirect": "Direct",
"proxyTestResultErrorType": "Error type: {type}",
"codexStrategyConfig": "Codex Instructions Strategy",
"codexStrategyConfigAuto": "Auto (Recommended)",
"codexStrategyConfigForce": "Force Official",
"codexStrategyConfigKeep": "Keep Original",
"codexStrategyDesc": "Control how to handle Codex request instructions field, affects upstream gateway compatibility",
"codexStrategySelect": "Strategy Selection",
"codexStrategyAutoLabel": "Auto (Recommended)",
"codexStrategyAutoDesc": "Pass through client instructions, auto retry with official prompt on 400 error",
"codexStrategyForceLabel": "Force Official",
"codexStrategyForceDesc": "Always use official Codex CLI instructions (~4000+ chars)",
"codexStrategyKeepLabel": "Keep Original",
"codexStrategyKeepDesc": "Always pass through client instructions, no auto retry (for lenient gateways)",
"codexStrategyHint": "Hint: Some strict Codex gateways (e.g. 88code, foxcode) require official instructions. Choose \"Auto\" or \"Force Official\" strategy",
"confirmAdd": "Confirm Add",
"confirmUpdate": "Confirm Update",
"confirmAddPending": "Adding...",
Expand Down
Loading
Loading