Commit Graph
477 Commits
Author SHA1 Message Date
RCD dfd2e09898 Merge remote-tracking branch 'upstream/main' 2026-03-02 02:08:44 +07:00
Luis Pater cc1d8f6629 Fixed: #1747
feat(auth): add configurable max-retry-credentials for finer control over cross-credential retries
2026-03-01 02:42:36 +08:00
Luis Pater 8bde8c37c0 Fixed: #1711
fix(server): use resolved log directory for request logger initialization and test fallback logic
2026-02-28 05:21:01 +08:00
RCD 0af0ad14e5 Merge upstream CLIProxyAPI v6.8.28–v6.8.32
Upstream changes:
- Codex responses compaction payload compatibility
- Codex usage_limit_reached retry-after, deterministic parsing
- Codex refresh_token_reused non-retryable fix
- Qwen rate limiting and quota error handling
- Context management compatibility simplification
- Antigravity tool_result image fix, model list backfill, deep copy cache
- Auth auto-refresh interval/concurrency limiting
- Auth hook OnResult refactor (replaces MarkResult)
- Gemini-3.1-flash-image support
- Registry cleanup of outdated model definitions

Fork resolution:
- Accept upstream's consolidated conductor.go (auto-refresh, round-tripper)
- Delete stale conductor_oauth.go, conductor_token.go (upstream reversed split)
- Delete stale provider_rotation_test.go (references removed method)
2026-02-27 20:58:16 +07:00
Luis Pater 0da34d3c2d Merge pull request #1668 from lyd123qw2008/fix/codex-usage-limit-retry-after
fix(codex): honor usage_limit_reached resets_at for retry_after
2026-02-27 06:01:44 +08:00
RCD 6ffc26271c Merge upstream CLIProxyAPI v6.8.27
Upstream changes:
- Post-auth hook system (RequestInfo refactor + hook chain)
- Credential-based round-robin for gemini-cli virtual auths
- Codex additive device-code login flow
- File input passthrough for /chat/completions and /responses
- Gemini → OpenAI usage conversion fix
- Responses stream: model/usage in translated streams, valid SSE error chunks
- Revert reasoning effort clamping

Fork resolution:
- Keep both integrationManager (fork) and postAuthHook (upstream) in handler struct
2026-02-25 14:49:42 +07:00
Luis Pater 48732ba05e Merge pull request #1527 from HEUDavid/feat/auth-hook
feat(auth): add post-auth hook mechanism
2026-02-24 05:33:13 +08:00
RCD dd41652e99 feat: add CODEOWNERS, PR template, and /health endpoint 2026-02-23 15:38:56 +07:00
RCD cf558dd166 Merge upstream CLIProxyAPI v6.8.18–v6.8.26
Upstream changes:
- Codex WebSocket executor and Codex response handlers
- Header passthrough (upstream response headers forwarded to clients)
- ExecuteStream returns *StreamResult (wraps channel + headers)
- Embeddings handler with synthetic fallback
- User ID cache for executors
- Gemini schema/request fixes
- New test coverage for bootstrap retries, error responses

Fork resolution:
- Delete upstream's modular TUI files (app.go, styles.go, dashboard.go,
  auth_tab.go, config_tab.go, keys_tab.go, logs_tab.go, oauth_tab.go,
  usage_tab.go, i18n.go, loghook.go) — keep fork's Flight Deck tui.go
- Add PassthroughHeaders field to SDKConfig
- Fix embeddings handler to capture 3-value ExecuteWithAuthManager return
- Update test mocks (conductor_test, auth_flow_test, multi_provider_test,
  gemini_executor_test) for new ExecuteStream signature
- Fix tuiMode → launchTUI flag variable reference
- Remove unused "io" import from main.go
2026-02-23 11:58:54 +07:00
Luis Pater e6c7af0fa9 Merge pull request #1522 from soilSpoon/feature/canceled
feature(proxy): Adds special handling for client cancellations in proxy error handler
2026-02-22 22:02:59 +08:00
lyd123qw2008 f5d46b9ca2 fix(codex): honor usage_limit_reached resets_at for retry_after 2026-02-21 13:50:23 +08:00
Luis Pater 7fe8246a9f Merge branch 'tui' into dev 2026-02-19 03:18:24 +08:00
Luis Pater bb86a0c0c4 feat(logging, executor): add request logging tests and WebSocket-based Codex executor
- Introduced unit tests for request logging middleware to enhance coverage.
- Added WebSocket-based Codex executor to support Responses API upgrade.
- Updated middleware logic to selectively capture request bodies for memory efficiency.
- Enhanced Codex configuration handling with new WebSocket attributes.
2026-02-19 01:57:02 +08:00
RCD 4cf25c05ce Merge upstream CLIProxyAPI v6.8.15–v6.8.17
Upstream changes:
- feat: add Google One login and improve Gemini CLI auto-discovery
- feat: add gpt-5.3-codex-spark model definition
- feat: add 'kimi' channel support in model definitions
- feat: pass cache usage from codex to openai chat completions
- fix: normalize Gemini credential file prefix for consistency
- refactor: replace manual pointer assignments with new()
- chore: update Go to 1.26, update Codex client version

Fork fixes:
- Bump mise Go pin to 1.26.0
- Remove stale .syso resource files (incompatible with Go 1.26 linker)
2026-02-16 08:01:38 +07:00
lhpqaq 2c8821891c fix(tui): update with review 2026-02-16 00:24:25 +08:00
lhpqaq 54ad7c1b6b feat(tui): add manager tui 2026-02-15 14:52:40 +08:00
Luis Pater 46a6782065 refactor(all): replace manual pointer assignments with new to enhance code readability and maintainability 2026-02-15 14:10:10 +08:00
이대희 93147dddeb Improves error handling for canceled requests
Adds explicit handling for context.Canceled errors in the reverse proxy error handler to return 499 status code without logging, which is more appropriate for client-side cancellations during polling.

Also adds a test case to verify this behavior.
2026-02-12 10:39:45 +09:00
이대희 c0f9b15a58 Merge remote-tracking branch 'upstream/main' into feature/canceled 2026-02-12 10:33:49 +09:00
이대희andgemini-code-assist[bot] 6f2fbdcbae Update internal/api/modules/amp/proxy.go
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-02-12 10:30:05 +09:00
HEUDavid 65debb874f feat/auth-hook: refactor RequstInfo to preserve original HTTP semantics 2026-02-12 07:11:17 +08:00
HEUDavid 3caadac003 feat/auth-hook: add post auth hook [CR] 2026-02-12 07:11:17 +08:00
HEUDavid 6a9e3a6b84 feat/auth-hook: add post auth hook 2026-02-12 07:11:17 +08:00
HEUDavid 94563d622c feat/auth-hook: add post auth hook 2026-02-12 07:11:17 +08:00
RCD a987b9fb83 Merge upstream CLIProxyAPI v6.8.11 into ProxyPilot
Upstream changes (v6.8.0–v6.8.11):
- feat: add Kimi (Moonshot AI) provider support with OAuth
- feat: add iFlow provider with OAuth and cookie auth
- feat: support Claude thinking type adaptive
- feat: capture cached token count in usage metadata
- fix: correct max completion tokens for opus 4.6 thinking
- fix: improve content handling for system and user messages
- fix: rewrite model name in response.model for Responses API SSE
- refactor: simplify provider lifecycle and registration logic
- refactor: migrate config-access to internal package

Fork integration:
- Migrate configaccess from sdk/access/config to internal/access/config_access
- Update reconcile.go to use internalconfig types directly
- Add Kimi and iFlow login flags to ProxyPilot CLI
- Integrate managementasset auto-updater
- Keep all ProxyPilot fork features (TUI, agent setup, service, etc.)
2026-02-11 19:03:07 +07:00
sususu98 f3ccd85ba1 feat(gemini-cli): add Google One login and improve auto-discovery
Add Google One personal account login to Gemini CLI OAuth flow:
- CLI --login shows mode menu (Code Assist vs Google One)
- Web management API accepts project_id=GOOGLE_ONE sentinel
- Auto-discover project via onboardUser without cloudaicompanionProject when project is unresolved

Improve robustness of auto-discovery and token handling:
- Add context-aware auto-discovery polling (30s timeout, 2s interval)
- Distinguish network errors from project-selection-required errors
- Refresh expired access tokens in readAuthFile before project lookup
- Extend project_id auto-fill to gemini auth type (was antigravity-only)

Unify credential file naming to geminicli- prefix for both CLI and web.

Add extractAccessToken unit tests (9 cases).
2026-02-11 17:53:03 +08:00
이대희andCopilot ce0c6aa82b Update internal/api/modules/amp/proxy.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-10 19:07:49 +09:00
이대희 3c85d2a4d7 feature(proxy): Adds special handling for client cancellations in proxy error handler
Silences logging for client cancellations during polling to reduce noise in logs.
Client-side cancellations are common during long-running operations and should not be treated as errors.
2026-02-10 18:02:08 +09:00
Luis Pater 0040d78496 refactor(sdk): simplify provider lifecycle and registration logic 2026-02-10 15:39:26 +08:00
Muhammad Zahid Masruri 918b6955e4 fix(amp): rewrite model name in response.model for Responses API SSE events
The ResponseRewriter's modelFieldPaths was missing 'response.model',
causing the mapped model name to leak through SSE streaming events
(response.created, response.in_progress, response.completed) in the
OpenAI Responses API (/v1/responses).

This caused Amp CLI to report 'Unknown OpenAI model' errors when
model mapping was active (e.g., gpt-5.2-codex -> gpt-5.3-codex),
because the mapped name reached Amp's backend via telemetry.

Also sorted modelFieldPaths alphabetically per review feedback
and added regression tests for all rewrite paths.

Fixes #1463
2026-02-09 23:52:59 +07:00
hkfires 3fbee51e9f fix(management): ensure management.html is available synchronously and improve asset sync handling 2026-02-09 08:32:58 +08:00
hkfires 234056072d refactor(management): streamline control panel management and implement sync throttling 2026-02-08 10:42:49 +08:00
Luis Pater 68cb81a258 feat: add Kimi authentication support and streamline device ID handling
- Introduced `RequestKimiToken` API for Kimi authentication flow.
- Integrated device ID management throughout Kimi-related components.
- Enhanced header management for Kimi API requests with device ID context.
2026-02-06 20:43:30 +08:00
RCD 7e3df456a5 Merge upstream CLIProxyAPI v6.7.42 into ProxyPilot
This merge brings in upstream changes from CLIProxyAPI v6.7.42 while
preserving ProxyPilot-specific customizations:

- Updated API server and executor modules
- New OAuth model alias functionality
- Enhanced thinking provider for iflow
- Updated model definitions and registry
- Improved docker build scripts

Conflicts were resolved by keeping ProxyPilot branding and merging
upstream improvements for translator and runtime components.
2026-02-03 11:08:58 +07:00
hkfires bc3bea72f3 refactor(codex): remove codex instructions injection support 2026-02-01 20:43:35 +07:00
hkfires 1f1160eb07 refactor(api): centralize config change logging 2026-02-01 20:42:09 +07:00
Luis Pater b927b0cc6c Merge branch 'dev' into codex 2026-02-01 20:20:49 +08:00
hkfires ac802a4646 refactor(codex): remove codex instructions injection support 2026-02-01 14:33:31 +08:00
RCDandClaude 3e4dccf857 fix(middleware): address remaining code review findings
MEDIUM: Return 400 on body read error instead of passing empty body
- Previously, on io.ReadAll error, body was consumed but c.Next()
  was called, causing downstream handlers to see empty body
- Now returns http.StatusBadRequest on read errors

MEDIUM: Recompute token analysis after scaffold injection
- Token analysis was computed before scaffold state was injected
- If scaffold pushed request over token threshold, trimming was skipped
- Now recomputes analyzeTokenBudget() after injection

LOW: Always strip X-CLIProxyAPI-Todo header
- Header was only stripped when memory store was available
- If memory disabled, internal header leaked upstream
- Now stripped immediately regardless of memory store state

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 12:52:57 +07:00
RCDandClaude 4491089ad1 fix(middleware): ensure prompt budget trimming loop executes
The trimming loop condition `for keep >= minKeep` was never true because
`keep` started at 20 while `minKeep` defaults to 25. Added clamp to ensure
`keep >= minKeep` at initialization, fixing prompt budget enforcement.

Affected functions:
- trimOpenAIChatCompletions
- trimOpenAIResponses
- trimOpenAIChatCompletionsWithMemory
- trimOpenAIResponsesWithMemory
- trimClaudeMessagesWithMemory

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 12:50:05 +07:00
RCDandClaude 7cc4e9d8f5 refactor(middleware): split codex_prompt_budget.go into logical modules
Split the 2,762 line codex_prompt_budget.go into focused modules:
- codex_prompt_budget.go (1,272 lines): Main middleware, scaffold injection
- codex_budget_types.go (498 lines): Constants, package vars, config functions
- codex_budget_calculator.go (944 lines): Token analysis, trim functions

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 12:28:00 +07:00
RCDandClaude b4fd299fce refactor(modules): remove deprecated RouteModule interface
Remove the V1 RouteModule interface which was marked as deprecated.
All modules now use RouteModuleV2 exclusively. The RegisterModule
function signature is simplified to accept RouteModuleV2 directly
instead of interface{}.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:55:57 +07:00
RCDandClaude b5077879d0 chore: clarify GetRequestMonitor stub comment
Remove TODO marker and update comment to indicate the stub is
intentional for API compatibility, not incomplete work.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:54:32 +07:00
RCDandClaude 4ba0a04c37 feat(logging): make error-logs-max-files configurable
Cherry-picked from upstream 6db8d2a2

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:34:58 +07:00
RCDandClaude acdf099442 feat(openai): add responses/compact support
Cherry-picked from upstream 95096bc3

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:28:45 +07:00
hkfires 4649cadcb5 refactor(api): centralize config change logging 2026-02-01 11:31:44 +08:00
sususu98 6db8d2a28e feat(logging): make error-logs-max-files configurable
- Add ErrorLogsMaxFiles config field with default value 10
- Support hot-reload via config file changes
- Add Management API: GET/PUT/PATCH /v0/management/error-logs-max-files
- Maintain SDK backward compatibility with NewFileRequestLogger (3 params)
- Add NewFileRequestLoggerWithOptions for custom error log retention

When request logging is disabled, forced error logs are retained up to
the configured limit. Set to 0 to disable cleanup.
2026-01-31 17:48:40 +08:00
Luis Pater f887f9985d Merge pull request #1248 from shekohex/feat/responses-compact
feat(openai): add responses/compact support
2026-01-31 03:12:55 +08:00
RCDandClaude 71a502075e fix(logging): capture streaming TTFB on first chunk and make timestamps required
- Add firstChunkTimestamp field to ResponseWriterWrapper for sync capture
- Capture TTFB in Write() and WriteString() before async channel send
- Add SetFirstChunkTimestamp() to StreamingLogWriter interface
- Make requestTimestamp/apiResponseTimestamp required in LogRequest()
- Remove timestamp capture from WriteAPIResponse() (now via setter)
- Fix Gemini handler to set API_RESPONSE_TIMESTAMP before writing response

This ensures accurate TTFB measurement for all streaming API formats
(OpenAI, Gemini, Claude) by capturing timestamp synchronously when
the first response chunk arrives, not when the stream finalizes.

Cherry-picked from upstream: 295f34d7

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-30 15:31:30 +07:00
RCDandClaude bcd735b2a8 fix(logging): add API response timestamp and fix request timestamp timing
Previously:
- REQUEST INFO timestamp was captured at log write time (not request arrival)
- API RESPONSE had NO timestamp at all

This fix:
- Captures REQUEST INFO timestamp when request first arrives
- Adds API RESPONSE timestamp when upstream response arrives
- Add Timestamp field to RequestInfo, set at middleware initialization
- Set API_RESPONSE_TIMESTAMP in appendAPIResponse() and gemini handler
- Pass timestamps through logging chain to writeNonStreamingLog()
- Add timestamp output to API RESPONSE section

Cherry-picked from upstream: c41ce77e

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-30 15:30:56 +07:00