Commit Graph
287 Commits
Author SHA1 Message Date
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
RCDandClaude 1c9ade20f8 fix: change HTTP status code from 400 to 502 when no provider available
Cherry-picked from upstream 6da7ed53

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:28:20 +07:00
RCDandClaude a7b7856135 fix(tests): register test models in global registry for auth lookup
Tests were failing with "auth_not_found: no auth available" because the
conductor.pickNextMixed() function checks ClientSupportsModel() against
the global registry. Test auths weren't registered with their models.

Changes:
- sdk/cliproxy/auth/conductor_test.go: Add registry.RegisterClient calls
- internal/translator/gemini/.../gemini_openai-responses_request.go:
  Skip empty text parts to avoid invalid Gemini content

Note: Some pre-existing flaky tests remain in test/integration and
internal/translator/gemini (NonJSON tool output test).

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-30 16:07:03 +07:00
RCDandClaude 3a00e35a5a feat(auth): add support for request_retry and disable_cooling overrides
Cherry-picked from plus: 70897247

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-30 15:39:42 +07:00
RCDandClaude cb25c754ea feat(auth): add skip persistence context key for file watcher events
Cherry-picked from plus: 9c341f5a

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-30 15:39:20 +07: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
RCDandClaude 41b1ad654e feat(config): add oauth-model-alias migration support
Add migration logic for converting oauth-model-mappings to oauth-model-alias
with comprehensive test coverage.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 21:30:09 +07:00
RCDandClaude d6104a0fca feat(auth): add iFlow authentication provider
Add iFlow auth module for cookie-based authentication:
- Cookie helper utilities
- iFlow auth client implementation
- Token management
- Local OAuth server for browser flow
- SDK auth integration

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 21:23:10 +07:00
RCDandClaude 1fa155621b feat: sync with upstream v6.7.28
Cherry-picked changes from CLIProxyAPI v6.7.28:

- feat(handlers): add test to verify no retries after partial stream response (4eb1e60)
- fix(config): prune oauth-model-alias when preserving config (d0bada7)

Note: fix(api): update amp module only on config changes (8510fc3) was skipped
as ProxyPilot does not have the Amp feature.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 18:48:10 +07:00
RCD 1663148a32 feat: sync with upstream v6.7.25-26
Cherry-picked changes from CLIProxyAPI:
- fix(gemini): force type to string for enum fields (fixes Antigravity Gemini API error)
- feat(auth): add request_retry and disable_cooling per-auth overrides
- feat(auth): add skip persistence context key for file watcher events

Manually added RequestRetryOverride/DisableCoolingOverride methods to
types.go to preserve ProxyPilot's conductor.go compatibility while
gaining new functionality.
2026-01-27 22:08:43 +07:00
RCD 5be8c90506 feat: sync with upstream v6.7.19-21
- Updated all executors with context cancellation handling
- Added payload rules using requested model
- Filter out Top_P when Temperature is set on Claude
- Remove empty system messages in translators
- Handle quota cooldown in retry logic
- Include requested model in executor metadata
- Normalize plan type filenames to lowercase
- Added Embed stubs for ProviderExecutor interface compliance
- Added payloadRequestedModel helper function
2026-01-24 11:17:03 +07:00
RCD e0fa10b669 feat: sync with upstream v6.7.13
Features ported from upstream:
- feat(claude): add native request cloaking support
- feat(translator): add candidate count (n param) support for Gemini
- fix(translator): consolidate multiple system messages into single message (#1064)
- feat(codex): add config toggle for codex instructions injection
- feat(auth): add hashed account ID to credential filenames for team plans
- feat(config): add support for raw JSON payload rules (default-raw, override-raw)
- feat(codex): add OpenCode instructions based on user agent

Also includes minor whitespace cleanup and code organization.
2026-01-20 14:08:05 +07:00
RCD 7b22c4fd4d feat(auth): cherry-pick CLIProxyAPI v6.6.108-109 core updates
- Add ensureAntigravityProjectID to fetch project_id during token refresh
- Simplify filestore Save() to use os.O_TRUNC instead of temp file rename
- Auto-fetch project_id for antigravity provider in readAuthFile()
- Add metadataEqualIgnoringTimestamps to prevent refresh loops
- Use reflect.DeepEqual for cleaner metadata comparison

Cherry-picked from:
- CLIProxyAPI v6.6.108 (086eb3d)
- CLIProxyAPI v6.6.109-dev (7248f65)
2026-01-16 15:25:49 +07:00
Finessse e8a6269a45 test: add tests for logging, errors, config, and auth packages
- Add 26 tests for SetLogLevel() in logging package
- Add 6 tests for AppError in errors package
- Add 10 tests for SDKConfig in config package
- Add 3 tests for EmailRequiredError in sdk/auth
2026-01-12 02:30:46 +07:00
Finessse 9f5eb93f64 sync(upstream): add HttpRequest support across executors
Cherry-picked from e8e3bc86. Adds HttpRequest method to ProviderExecutor
interface for injecting credentials into arbitrary HTTP requests.

- Added HttpRequest to conductor.go interface
- Added HttpRequest stubs to kiro, minimax, zhipu executors
- Added http-request example
- Updated mock executors in tests

Also kept our Embed method and CountTokens implementations.
2026-01-11 06:32:53 +07:00
Finessse 01e1d5aed2 sync(upstream): auth rotation atomic fix + memory leak fixes
- fix(auth): make provider rotation atomic (keep shouldKeepProviderOrder)
- fix(server): resolve memory leaks in failed attempts and codex cache
  - Add background cleanup goroutine for stale IP entries
  - Add cache expiry cleanup for codex prompt cache
- Update provider rotation tests for atomic rotation

Cherry-picked: 8be06255, 47dacce6
Merged with ProxyPilot's shouldKeepProviderOrder for gemini-3 fallback
2026-01-11 06:11:37 +07:00
Finessse fd9d097b8e sync(upstream): management API and executor improvements
- feat(management): add generic API call handler
- Fix: disable thinking when tool_choice forces tool use
- feat(api): add ManagementTokenRequester interface (sans iflow)
- fix(management): refresh antigravity token for api-call $TOKEN$
- fix(auth): error when antigravity refresh token missing during refresh

Cherry-picked: ade71947, aca2ef63, ee171bc5, b01619b4, 5e5d8142
Adapted: removed iflow references (not in ProxyPilot)
2026-01-11 06:00:37 +07:00
Finessse 4bf4256e3f sync(upstream): logging/handlers improvements
- fix(logging): improve request/response capture
- fix(handlers): match raw error text before JSON body for duplicate detection
- feat(logging): disambiguate OAuth credential selection in debug logs
- Various logging refinements for auth selection

Cherry-picked from upstream: a091d12f, 3ca5fb10, 0e4148b2, 79fbcb3e, 48f6d7ab, 48f19aab, cb3bdffb, a95428f2
2026-01-11 05:57:48 +07:00
Finessse 7157230427 refactor(auth): rename ImportFromGeminiCLI to ImportFromAntigravityIDE 2026-01-11 05:11:05 +07:00
Finessse 9679f69b81 feat(auth): add Gemini CLI token import for Antigravity
- Add internal/auth/antigravity package with token loading from ~/.gemini/oauth_creds.json
- Add ImportFromGeminiCLI method to AntigravityAuthenticator
- Add DoAntigravityImport CLI command
- Add --antigravity-import flag to server binary

Usage: proxypilot --antigravity-import
2026-01-11 04:10:54 +07:00
Finessse ab2be5d03c fix(auth): simplify auto-refresh interval validation 2026-01-09 23:42:36 +07:00
Finessse 0761e2b695 fix(auth): prioritize paidTier over isDefault for antigravity tier detection 2026-01-09 23:42:13 +07:00
Finessse bc3d89d958 perf(handlers): cache request details lookup per model 2026-01-09 23:38:21 +07:00
Finessse 5d9d4328f9 refactor(handlers): use pooled SSE writer helpers across all providers 2026-01-09 23:38:09 +07:00
Finessse b02b3c32ce perf(sdk): use pre-allocated byte slice for SSE keep-alive 2026-01-09 23:37:55 +07:00
Finessse 616cde1a0f test(sdk): add stream forwarder benchmarks 2026-01-09 23:37:41 +07:00
Finessse d2efc1dd8e feat(sdk): add pooled SSE writer helpers for reduced allocations 2026-01-09 23:37:29 +07:00
Finessse 86470c8274 feat(routing): add usage-aware credential selector
Routes requests to the account with lowest daily output tokens.
Spreads load across accounts to avoid hitting quota limits.
Config: routing.strategy = "usage-aware" or "least-used"
2026-01-08 04:45:19 +07:00
Finessse 33be41ba03 feat(cache): wire cache initialization and add docs
Initialize response/prompt caches in Service.Run from config.
Add cache lookup to executor payload helpers.
Document cache config and management API in README.
2026-01-06 06:24:01 +07:00
Finessse c8176cddab chore: remove legacy management UI
Remove /management.html, pp_open_legacy_ui tray binding,
disable-control-panel and panel-github-repository config options.
OpenManagementUI now opens /proxypilot.html directly.
2026-01-06 06:22:06 +07:00
Finessse 30978f1f17 feat(cache): add response cache and prompt cache tracking
Response cache stores completions keyed by request hash.
Prompt cache tracking aggregates cache_read/cache_creation tokens.
WebUI CacheStats component shows hit rates and token savings.
2026-01-06 06:21:54 +07:00
Finessse 093e77c8c0 feat: add priority/usage APIs, WebUI dashboard, config options
- PATCH /v0/management/auth/:id/priority endpoint
- GET /v0/management/auth/:id/usage endpoint
- AccountUsage.tsx dashboard component
- AutoRefreshBuffer, DailyResetHour config fields
- Conductor wiring for refresh config
2026-01-05 12:59:29 +07:00
Finessse 4dd917ff31 feat(auth): wire usage tracking and token expiry to CLI
- Add authUsagePlugin to bridge usage.Record -> Auth.Usage stats
- Register plugin in service.Run() after usage.StartDefault()
- Populate TokenExpiresAt from metadata in Load/Register/Update
- Enables per-auth usage tracking and proactive token refresh
2026-01-05 07:25:02 +07:00
Finessse 43f625caf1 chore: integrate sdk test files into main repo 2026-01-05 03:23:41 +07:00
Finessse c33d299137 feat(auth): add priority, usage tracking, and proactive token refresh
- Add Priority field to Auth for per-provider account ordering
- Add UsageStats struct tracking total/daily tokens and requests
- Track usage in MarkResult with daily reset logic
- Add TokenExpiresAt for proactive refresh (5min buffer)
- Sort available auths by priority in selector
2026-01-05 03:18:33 +07:00
Finessse 36621166c8 feat(antigravity): capture tier metadata and retry delays 2026-01-01 00:51:28 +07:00
Finessse 42063d9f2a feat(auth): add Amazon Q CLI token import
- Add internal/auth/amazonq/token.go for token file parsing
- Add sdk/auth/amazonq.go for SDK-level Amazon Q auth
- Support importing tokens from Amazon Q CLI (~/.aws/q/)
2025-12-29 18:57:45 +07:00
Finessse e663c9d395 feat(auth): add Zhipu AI authenticator
Add API key authenticator for Zhipu AI provider.

- Simple API key input (no OAuth required)
- Supports label for account identification
2025-12-28 20:51:19 +07:00
Finessse efda335476 feat(auth): add MiniMax authenticator
Add API key authenticator for MiniMax provider.

- Simple API key input (no OAuth required)
- Supports label for account identification
2025-12-28 20:51:00 +07:00
Finessse 0fb4f42ffb refactor(sdk): remove iFlow from service, add MiniMax/Zhipu
- Remove iFlow executor and model retrieval cases
- Add MiniMax executor registration
- Add Zhipu executor registration
- Add MiniMax/Zhipu model retrieval cases
2025-12-28 20:48:35 +07:00
Finessse d8165d05d9 refactor(sdk): remove iFlow from refresh registry
Remove iFlow provider registration from refresh lead registry.
2025-12-28 20:48:15 +07:00
Finessse 91b13504f8 refactor(sdk): remove iFlow authenticator
Remove iFlow SDK authenticator implementation.

Deleted: sdk/auth/iflow.go
2025-12-28 20:47:50 +07:00
Finessse 7d9a114bf8 feat(config): add global model mapping hook for SDK handlers
Adds GlobalModelMapperFunc type and hook to SDKConfig, allowing
SDK-level handlers to access Config-level global model mappings.
This enables cross-provider model aliasing (e.g., gpt-4o → claude-sonnet).
2025-12-28 10:45:26 +07:00
Finessse b127b674e9 sync: squash merge upstream CLIProxyAPI v6.6.62
Synced with upstream v6.6.61-v6.6.62 changes:
- Added usage export/import endpoints
- Added normalizeCodexKey function
- Updated BootstrapRetries type
- Enhanced model definitions and antigravity config

Preserved ProxyPilot customizations:
- Kept CompressionConfig for long-context sessions
- Kept Kiro, GitHub Copilot, Amazon Q model definitions
- Kept shouldKeepProviderOrder for Gemini-3 provider stability
- Kept advanceProviderCursor pattern (separate cursor advancement)
- Removed AmpCode integration (not used)

Version: 0.1.4
2025-12-28 08:32:11 +07:00
Finessse 81848357c4 feat: auto-register translators on startup
Import translator package with side effects to register all
built-in format translators at initialization.
2025-12-28 07:11:28 +07:00
Finessse 0f5836e14b refactor(translator): enhance registry with new capabilities
Update registry to support middleware, caching, pooling, and
resilience features integration.
2025-12-28 07:09:01 +07:00
Finessse 21125722cd test(translator): add lazy loading tests
Add tests for lazy translator registration and loading behavior.
2025-12-28 07:08:41 +07:00
Finessse 3e47344da9 feat(translator): add testing utilities
Add mock translators and test helpers for translator unit testing.
2025-12-28 07:08:31 +07:00
Finessse 31e52f26e8 feat(translator): add translation quality scoring
Add quality assessment for translations with structural comparison
and scoring metrics.
2025-12-28 07:08:21 +07:00