Skip to content

Commit 4eec9ea

Browse files
author
ccs-upstream-sync[bot]
committed
Merge remote-tracking branch 'upstream/main' into upstream-sync/20260605-0449
2 parents 38187a6 + 5753d1a commit 4eec9ea

14 files changed

Lines changed: 463 additions & 162 deletions

File tree

README.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -118,26 +118,6 @@ Standalone persistence and visualization service for CLIProxyAPI, with periodic
118118

119119
Full CLIProxyAPI management center with request-level monitoring and cost estimates. CPA-Manager tracks collected requests by account, model, channel, latency, status, and token usage; estimates cost with editable model prices and one-click LiteLLM price sync; persists events in SQLite; and provides Codex account-pool operations with batch inspection, quota detection, unhealthy account discovery, cleanup suggestions, and one-click execution for day-to-day multi-account maintenance.
120120

121-
## Amp CLI Support
122-
123-
CLIProxyAPI includes integrated support for [Amp CLI](https://ampcode.com) and Amp IDE extensions, enabling you to use your Google/ChatGPT/Claude OAuth subscriptions with Amp's coding tools:
124-
125-
- Provider route aliases for Amp's API patterns (`/api/provider/{provider}/v1...`)
126-
- Management proxy for OAuth authentication and account features
127-
- Smart model fallback with automatic routing
128-
- **Model mapping** to route unavailable models to alternatives (e.g., `claude-opus-4.5``claude-sonnet-4`)
129-
- Security-first design with localhost-only management endpoints
130-
131-
When you need the request/response shape of a specific backend family, use the provider-specific paths instead of the merged `/v1/...` endpoints:
132-
133-
- Use `/api/provider/{provider}/v1/messages` for messages-style backends.
134-
- Use `/api/provider/{provider}/v1beta/models/...` for model-scoped generate endpoints.
135-
- Use `/api/provider/{provider}/v1/chat/completions` for chat-completions backends.
136-
137-
These routes help you select the protocol surface, but they do not by themselves guarantee a unique inference executor when the same client-visible model name is reused across multiple backends. Inference routing is still resolved from the request model/alias. For strict backend pinning, use unique aliases, prefixes, or otherwise avoid overlapping client-visible model names.
138-
139-
**[Complete Amp CLI Integration Guide](https://help.router-for.me/agent-client/amp-cli.html)**
140-
141121
## SDK Docs
142122

143123
- Usage: [docs/sdk-usage.md](docs/sdk-usage.md)
@@ -176,10 +156,6 @@ CLI wrapper for instant switching between multiple Claude accounts and alternati
176156

177157
Native macOS menu bar app that unifies Claude, Gemini, OpenAI, and Antigravity subscriptions with real-time quota tracking and smart auto-failover for AI coding tools like Claude Code, OpenCode, and Droid - no API keys needed.
178158

179-
### [CodMate](https://github.com/loocor/CodMate)
180-
181-
Native macOS SwiftUI app for managing CLI AI sessions (Codex, Claude Code, Gemini CLI) with unified provider management, Git review, project organization, global search, and terminal integration. Integrates CLIProxyAPI to provide OAuth authentication for Codex, Claude, Gemini, and Antigravity, with built-in and third-party provider rerouting through a single proxy endpoint - no API keys needed for OAuth providers.
182-
183159
### [ProxyPilot](https://github.com/Finesssee/ProxyPilot)
184160

185161
Windows-native CLIProxyAPI fork with TUI, system tray, and multi-provider OAuth for AI coding tools - no API keys needed.
@@ -227,10 +203,6 @@ Cross-platform desktop app (macOS, Windows, Linux) wrapping CLIProxyAPI with a n
227203

228204
Ready-to-use cross-platform quota inspector for CLIProxyAPI, supporting per-account codex 5h/7d quota windows, plan-based sorting, status coloring, and multi-account summary analytics.
229205

230-
### [CodexCliPlus](https://github.com/C4AL/CodexCliPlus)
231-
232-
Windows-focused, local-first desktop management platform for Codex CLI built on CLIProxyAPI, focused on simplifying local setup, account and runtime management, and providing a more complete Codex CLI experience for local users.
233-
234206
### [CLIProxy Pool Watch](https://github.com/murasame612/CLIProxyPoolWidget)
235207

236208
Native macOS SwiftUI app for monitoring ChatGPT/Codex account quotas in CLIProxyAPI pools. Displays account availability, Plus-base capacity, 5-hour and weekly quota bars, plan weights, and restore forecasts through the Management API.

README_CN.md

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -118,25 +118,6 @@ docker compose up -d
118118

119119
面向 CLIProxyAPI 的完整管理中心,提供请求级监控和费用预估。CPA-Manager 可按账号、模型、渠道、延迟、状态和 token 用量追踪采集到的请求;支持可编辑模型价格与一键同步 LiteLLM 价格来估算费用;用 SQLite 持久化事件;并提供面向 Codex 账号池的批量巡检、配额识别、异常账号定位、清理建议与一键执行能力,适合多账号池的日常运维管理。
120120

121-
## Amp CLI 支持
122-
123-
CLIProxyAPI 已内置对 [Amp CLI](https://ampcode.com) 和 Amp IDE 扩展的支持,可让你使用自己的 Google/ChatGPT/Claude OAuth 订阅来配合 Amp 编码工具:
124-
125-
- 提供商路由别名,兼容 Amp 的 API 路径模式(`/api/provider/{provider}/v1...`
126-
- 管理代理,处理 OAuth 认证和账号功能
127-
- 智能模型回退与自动路由
128-
- 以安全为先的设计,管理端点仅限 localhost
129-
130-
当你需要某一类后端的请求/响应协议形态时,优先使用 provider-specific 路径,而不是合并后的 `/v1/...` 端点:
131-
132-
- 对于 messages 风格的后端,使用 `/api/provider/{provider}/v1/messages`
133-
- 对于按模型路径暴露生成接口的后端,使用 `/api/provider/{provider}/v1beta/models/...`
134-
- 对于 chat-completions 风格的后端,使用 `/api/provider/{provider}/v1/chat/completions`
135-
136-
这些路径有助于选择协议表面,但当多个后端复用同一个客户端可见模型名时,它们本身并不能保证唯一的推理执行器。实际的推理路由仍然根据请求里的 model/alias 解析。若要严格钉住某个后端,请使用唯一 alias、前缀,或避免让多个后端暴露相同的客户端模型名。
137-
138-
**[Amp CLI 完整集成指南](https://help.router-for.me/cn/agent-client/amp-cli.html)**
139-
140121
## SDK 文档
141122

142123
- 使用文档:[docs/sdk-usage_CN.md](docs/sdk-usage_CN.md)
@@ -175,10 +156,6 @@ CLI 封装器,用于通过 CLIProxyAPI OAuth 即时切换多个 Claude 账户
175156

176157
原生 macOS 菜单栏应用,统一管理 Claude、Gemini、OpenAI 和 Antigravity 订阅,提供实时配额追踪和智能自动故障转移,支持 Claude Code、OpenCode 和 Droid 等 AI 编程工具,无需 API 密钥。
177158

178-
### [CodMate](https://github.com/loocor/CodMate)
179-
180-
原生 macOS SwiftUI 应用,用于管理 CLI AI 会话(Claude Code、Codex、Gemini CLI),提供统一的提供商管理、Git 审查、项目组织、全局搜索和终端集成。集成 CLIProxyAPI 为 Codex、Claude、Gemini 和 Antigravity 提供统一的 OAuth 认证,支持内置和第三方提供商通过单一代理端点重路由 - OAuth 提供商无需 API 密钥。
181-
182159
### [ProxyPilot](https://github.com/Finesssee/ProxyPilot)
183160

184161
原生 Windows CLIProxyAPI 分支,集成 TUI、系统托盘及多服务商 OAuth 认证,专为 AI 编程工具打造,无需 API 密钥。
@@ -223,10 +200,6 @@ Shadow AI 是一款专为受限环境设计的 AI 辅助工具。提供无窗口
223200

224201
上手即用的面向 CLIProxyAPI 跨平台配额查询工具,支持按账号展示 codex 5h/7d 配额窗口、按计划排序、状态着色及多账号汇总分析。
225202

226-
### [CodexCliPlus](https://github.com/C4AL/CodexCliPlus)
227-
228-
基于 CLIProxyAPI 的 Windows Codex CLI 本地优先桌面管理平台,聚焦简化本机配置、账号与运行状态管理,并为本地用户提供更完整的 Codex CLI 使用体验。
229-
230203
### [CLIProxy Pool Watch](https://github.com/murasame612/CLIProxyPoolWidget)
231204

232205
原生 macOS SwiftUI 应用,用于监控 CLIProxyAPI 池中的 ChatGPT/Codex 账号额度。通过 Management API 展示账号可用状态、Plus 基准容量、5 小时与周额度进度条、套餐权重和恢复预测。

README_JA.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -86,26 +86,6 @@ CLIProxyAPI向けの独立した使用量永続化・可視化サービス。CLI
8686

8787
リクエスト単位の監視とコスト推定を備えたCLIProxyAPI向けのフル管理センターです。CPA-Managerは、収集したリクエストをアカウント、モデル、チャネル、レイテンシ、ステータス、Token使用量ごとに追跡し、編集可能なモデル価格とLiteLLM価格のワンクリック同期でコストを推定します。SQLiteでイベントを永続化し、Codexアカウントプール向けに一括検査、クォータ判定、異常アカウント検出、クリーンアップ提案、ワンクリック実行を提供し、日常的なマルチアカウント運用に適しています。
8888

89-
## Amp CLIサポート
90-
91-
CLIProxyAPIは[Amp CLI](https://ampcode.com)およびAmp IDE拡張機能の統合サポートを含んでおり、Google/ChatGPT/ClaudeのOAuthサブスクリプションをAmpのコーディングツールで使用できます:
92-
93-
- Ampの APIパターン用のプロバイダールートエイリアス(`/api/provider/{provider}/v1...`
94-
- OAuth認証およびアカウント機能用の管理プロキシ
95-
- 自動ルーティングによるスマートモデルフォールバック
96-
- 利用できないモデルを代替モデルにルーティングする**モデルマッピング**(例:`claude-opus-4.5``claude-sonnet-4`
97-
- localhostのみの管理エンドポイントによるセキュリティファーストの設計
98-
99-
特定のバックエンド系統のリクエスト/レスポンス形状が必要な場合は、統合された `/v1/...` エンドポイントよりも provider-specific のパスを優先してください。
100-
101-
- messages 系のバックエンドには `/api/provider/{provider}/v1/messages`
102-
- モデル単位の generate 系エンドポイントには `/api/provider/{provider}/v1beta/models/...`
103-
- chat-completions 系のバックエンドには `/api/provider/{provider}/v1/chat/completions`
104-
105-
これらのパスはプロトコル面の選択には役立ちますが、同じクライアント向けモデル名が複数バックエンドで再利用されている場合、それだけで推論実行系が一意に固定されるわけではありません。実際の推論ルーティングは、引き続きリクエスト内の model/alias 解決に従います。厳密にバックエンドを固定したい場合は、一意な alias や prefix を使うか、クライアント向けモデル名の重複自体を避けてください。
106-
107-
**[Amp CLI統合ガイドの完全版](https://help.router-for.me/agent-client/amp-cli.html)**
108-
10989
## SDKドキュメント
11090

11191
- 使い方:[docs/sdk-usage.md](docs/sdk-usage.md)
@@ -144,10 +124,6 @@ CLIProxyAPI OAuthを使用して複数のClaudeアカウントや代替モデル
144124

145125
Claude、Gemini、OpenAI、Antigravityのサブスクリプションを統合し、リアルタイムのクォータ追跡とスマート自動フェイルオーバーを備えたmacOSネイティブのメニューバーアプリ。Claude Code、OpenCode、Droidなどのコーディングツール向け - APIキー不要
146126

147-
### [CodMate](https://github.com/loocor/CodMate)
148-
149-
CLI AIセッション(Codex、Claude Code、Gemini CLI)を管理するmacOS SwiftUIネイティブアプリ。統合プロバイダー管理、Gitレビュー、プロジェクト整理、グローバル検索、ターミナル統合機能を搭載。CLIProxyAPIと統合し、Codex、Claude、Gemini、AntigravityのOAuth認証を提供。単一のプロキシエンドポイントを通じた組み込みおよびサードパーティプロバイダーの再ルーティングに対応 - OAuthプロバイダーではAPIキー不要
150-
151127
### [ProxyPilot](https://github.com/Finesssee/ProxyPilot)
152128

153129
TUI、システムトレイ、マルチプロバイダーOAuthを備えたWindows向けCLIProxyAPIフォーク - AIコーディングツール用、APIキー不要
@@ -192,10 +168,6 @@ CLIProxyAPIをネイティブGUIでラップしたクロスプラットフォー
192168

193169
CLIProxyAPI向けのすぐに使えるクロスプラットフォームのクォータ確認ツール。アカウントごとの codex 5h/7d クォータ表示、プラン別ソート、ステータス色分け、複数アカウントの集計分析に対応。
194170

195-
### [CodexCliPlus](https://github.com/C4AL/CodexCliPlus)
196-
197-
CLIProxyAPIを基盤にしたWindows向けのローカル優先Codex CLIデスクトップ管理プラットフォーム。ローカル設定、アカウント、実行状態の管理を簡素化し、ローカルユーザーにより包括的なCodex CLI体験を提供します。
198-
199171
### [CLIProxy Pool Watch](https://github.com/murasame612/CLIProxyPoolWidget)
200172

201173
CLIProxyAPIプール内のChatGPT/Codexアカウントクォータを監視するmacOSネイティブSwiftUIアプリ。Management APIを通じて、アカウントの可用性、Plus基準の容量、5時間/週次クォータバー、プラン重み、復元予測を表示します。

config.example.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pprof:
4949
enable: false
5050
addr: '127.0.0.1:8316'
5151

52-
# When true, disable high-overhead HTTP middleware features to reduce per-request memory usage under high concurrency.
52+
# When true, disable high-overhead request logging and HTTP middleware features to reduce per-request memory usage under high concurrency.
5353
commercial-mode: false
5454

5555
# Open OAuth URLs in incognito/private browser mode.

internal/api/middleware/request_logging.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func RequestLoggingMiddleware(logger logging.RequestLogger) gin.HandlerFunc {
5858
wrapper.logOnErrorOnly = true
5959
}
6060
c.Writer = wrapper
61-
attachWebsocketLogSources(c, logger, loggerEnabled)
61+
attachRequestLogSources(c, logger, loggerEnabled)
6262

6363
// Process the request
6464
c.Next()
@@ -75,14 +75,23 @@ type fileBodySourceFactory interface {
7575
NewFileBodySource(prefix string) (*logging.FileBodySource, error)
7676
}
7777

78-
func attachWebsocketLogSources(c *gin.Context, logger logging.RequestLogger, loggerEnabled bool) {
79-
if c == nil || !loggerEnabled || !isResponsesWebsocketUpgrade(c.Request) {
78+
func attachRequestLogSources(c *gin.Context, logger logging.RequestLogger, loggerEnabled bool) {
79+
if c == nil || !loggerEnabled {
8080
return
8181
}
8282
factory, ok := logger.(fileBodySourceFactory)
8383
if !ok || factory == nil {
8484
return
8585
}
86+
if source, errSource := factory.NewFileBodySource("api-request"); errSource == nil {
87+
c.Set(logging.APIRequestSourceContextKey, source)
88+
}
89+
if source, errSource := factory.NewFileBodySource("api-response"); errSource == nil {
90+
c.Set(logging.APIResponseSourceContextKey, source)
91+
}
92+
if !isResponsesWebsocketUpgrade(c.Request) {
93+
return
94+
}
8695
if source, errSource := factory.NewFileBodySource("websocket-timeline"); errSource == nil {
8796
c.Set(logging.WebsocketTimelineSourceContextKey, source)
8897
}

internal/api/middleware/request_logging_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func TestShouldCaptureRequestBody(t *testing.T) {
144144
}
145145
}
146146

147-
func TestAttachWebsocketLogSourcesUsesLoggerLogsDir(t *testing.T) {
147+
func TestAttachRequestLogSourcesUsesLoggerLogsDir(t *testing.T) {
148148
gin.SetMode(gin.TestMode)
149149

150150
logsDir := t.TempDir()
@@ -154,7 +154,7 @@ func TestAttachWebsocketLogSourcesUsesLoggerLogsDir(t *testing.T) {
154154
c.Request = httptest.NewRequest(http.MethodGet, "/v1/responses", nil)
155155
c.Request.Header.Set("Upgrade", "websocket")
156156

157-
attachWebsocketLogSources(c, logger, true)
157+
attachRequestLogSources(c, logger, true)
158158
defer cleanupFileBodySourcesFromContext(c)
159159

160160
for _, key := range []string{

0 commit comments

Comments
 (0)