Commit Graph
1305 Commits
Author SHA1 Message Date
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 7d1dc22657 feat(config): add AmpCode config and incognito browser option
- Add AmpCode configuration structure for Amp CLI proxy
- Add IncognitoBrowser option for OAuth flows
- Update SDK config mappings

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 21:29:39 +07:00
RCDandClaude 6b85dadce7 feat(interfaces): extend client models and types
Update interfaces with new fields for extended provider support.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 21:29:29 +07:00
RCDandClaude 24626d061d feat(constant): add Kiro and iFlow provider constants
Add new provider constants for Kiro and iFlow authentication.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 21:29:20 +07:00
RCDandClaude 3fc5b5a3b3 feat(auth): add empty token provider for unauthenticated requests
Add empty auth provider for handling requests that don't require authentication.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 21:23:46 +07:00
RCDandClaude 357eed3ec6 feat(auth): enhance Kiro authentication with rate limiting and metrics
Extend Kiro auth module with:
- Background token refresh
- Cooldown mechanism for failed requests
- Browser fingerprint generation
- Jitter utilities for request timing
- Metrics collection and reporting
- Rate limiter with singleton pattern
- Refresh manager for token lifecycle
- Token repository for persistent storage
- Usage checker for quota monitoring
- Web-based OAuth flow templates
- Updated AWS auth and SSO OIDC flows

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 21:23:31 +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 45ba3b9c3f feat(auth): add GitHub Copilot OAuth authentication
Add complete Copilot authentication module:
- OAuth device flow for GitHub authentication
- Token management and storage
- Error handling for auth failures

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 21:22:38 +07:00
RCDandClaude 92bf72d8c5 feat(amp): add Amp CLI proxy module
Add complete Amp module for routing requests through the Amp CLI:
- Core module with lifecycle management
- Gemini bridge for model translation
- Model mapping configuration
- Proxy handler for request forwarding
- Response rewriter for format conversion
- Secret management for API keys
- Route definitions and fallback handlers
- Comprehensive test coverage

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 21:22:19 +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 1d29f18172 feat: sync with upstream v6.7.22-24
- Antigravity retry logic with improved error handling and capacity management
- Added request_id to error logs for better debugging
- Export OAuth constants from auth packages (antigravity, claude, codex, gemini)
- Added Antigravity AuthService in internal/auth/antigravity
- Updated Claude executor test expectations for system message handling
- Skip built-in tools in OAuth tool prefix
- Preserve displayName and description in Gemini models list
- Added Embed stubs for ProviderExecutor interface compliance
2026-01-26 20:22: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 377697331b feat: sync with upstream v6.7.17-18
- Updated gemini_schema.go with improved schema cleaning
- Refined signature caching logic (kept 1h TTL for memory efficiency)
- Enhanced Claude/Gemini translator tests
- Fixed Gemini function-calling INVALID_ARGUMENT via relaxed tool validation
2026-01-23 19:26:02 +07:00
RCD e86d2b86d5 feat: sync with upstream v6.7.16
Major changes from upstream v6.7.16:
- Remove sessionID from signature caching API entirely
  - CacheSignature(modelName, text, sig) instead of 4 params
  - GetCachedSignature(modelName, text) instead of 3 params
  - HasValidSignature(modelName, sig) instead of 1 param
- Add Gemini fallback: returns "skip_thought_signature_validator" on cache miss
- Add sliding expiration (TTL refresh on cache access)
- Add GetModelGroup() for grouping cache keys by model family
- Simplify antigravity executor by removing project switch logic
- Fix OpenAI Responses request handler to skip empty assistant text
- Fix OpenAI Responses request to validate full JSON before parsing

Local fixes for compatibility:
- Add Embed stub method to AntigravityExecutor for interface compliance
- Update test to clear cache for isolation (ThinkingBlockWithoutSignature)
- Update Gemini test to expect thinking blocks to be annotated not removed
- Fix gjson.Valid check before treating tool output as raw JSON
2026-01-21 15:05:05 +07:00
RCD 3fb213d513 feat: sync with upstream v6.7.15
Port features from upstream CLIProxyAPI:

v6.7.13:
- Raw JSON payload rules (DefaultRaw, OverrideRaw)
- OpenCode instructions support with user agent detection

v6.7.14:
- Improve signature handling by associating with model name

v6.7.15:
- Unify model group references with GetModelGroup helper function
2026-01-20 16:49:13 +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 4a0f8232d5 refactor(claude): remove redundant system instructions check
The checkSystemInstructions was being called on every request but the
cloaking/system prompt handling is now done elsewhere. This removes
redundant processing.

Cherry-picked from CLIProxyAPI: 7831cba9
2026-01-20 11:49:21 +07:00
RCD 3d4b723fb3 feat(translator): enhance session ID derivation with user_id parsing
Extract session ID from metadata.user_id field when available, using
the "session_" prefix marker. Falls back to first user message hash.

Cherry-picked from CLIProxyAPI: 6184c433 (Fixed: #1109)
2026-01-20 11:42:02 +07:00
RCD 5428a0ad74 test(antigravity): update tests to match cached-only signature behavior
Update tests to reflect the new signature handling behavior where only
cached signatures are used, not client-provided ones. This prevents
"Corrupted thought signature" errors when switching between Claude and
Gemini models.

Tests now properly cache signatures before testing conversion functions.
2026-01-20 11:39:56 +07:00
RCD 02b0714e3a feat(vertex): add Imagen image generation model support
Add support for Imagen 3.0 and 4.0 image generation models in Vertex AI:

- Add 5 Imagen model definitions (4.0, 4.0-ultra, 4.0-fast, 3.0, 3.0-fast)
- Implement :predict action routing for Imagen models
- Convert Imagen request/response format to match Gemini structure
- Transform prompts to Imagen's instances/parameters format
- Convert base64 image responses to Gemini-compatible inline data

Cherry-picked from CLIProxyAPI: 8734d4cb
2026-01-20 11:31:07 +07:00
RCD 94088ea1de refactor(antigravity): remove legacy client signature comments
Cleanup dead code from signature handling in thinking blocks.
The actual fix was applied in commit 27b25bc0.
Cherry-picked from CLIProxyAPI: 5977af96
2026-01-20 11:25:37 +07:00
RCD e6e7e6db30 feat(registry): support provider-specific model info lookup
Add InfoByProvider map to ModelRegistration to store provider-specific
ModelInfo, enabling different capabilities for the same model across
providers (e.g., direct API vs OpenRouter).

Changes:
- Add InfoByProvider field to ModelRegistration struct
- Update GetModelInfo to accept provider parameter for provider-specific lookup
- Update LookupModelInfo to accept variadic provider parameter
- Add LookupStaticModelInfo for fallback to static model definitions
- Update ApplyThinking to pass providerKey for registry lookups
- Update all GetModelInfo callers to use new signature
- Remove ensureMaxTokensForThinking test (function moved to thinking package)

Ported from CLIProxyAPI e641fde2
2026-01-20 11:15:39 +07:00
RCD f528639f1c feat(claude): clamp thinking budget to max_tokens constraints
Improve budget normalization in Claude applier to handle edge cases
where budget exceeds or approaches max_tokens limits.

Cherry-picked from 239a2879.
2026-01-20 10:54:29 +07:00
RCD 5dd078ffb3 refactor(claude): move max_tokens constraint enforcement to Apply method
Move ensureMaxTokensForThinking logic from claude_executor to
thinking/provider/claude/apply.go. This centralizes Claude-specific
thinking budget constraints in the thinking package.

Cherry-picked from c421d653.
2026-01-20 10:53:37 +07:00
RCD 8d8a010577 feat(executor): enhance payload translation with original request context
Add 6th parameter 'original' to applyPayloadConfigWithRoot to support
checking defaults against the original payload. This enables proper
default rule validation when translating between formats.

Based on upstream 2a663d5c.
2026-01-20 10:49:30 +07:00
RCD 27b25bc0d7 refactor(antigravity): remove unused client signature handling in thinking objects
- Comment out client signature extraction (incompatible across model families)
- Use only cached signatures for thinking blocks
- Switch to thinking.GetThinkingText for text extraction
- Add explanatory comment about cross-model signature issues

Cherry-picked from d4bb4e66.
2026-01-20 10:43:24 +07:00
RCD 5a38b6bc04 fix(executor): stop rewriting thinkingLevel for gemini
Remove automatic thinkingLevel -> thinkingBudget:-1 conversion
for non-gemini-3 models in antigravity executor.

Cherry-picked from 1d2fe553.
2026-01-20 10:40:07 +07:00
RCD f1d05cc027 feat(registry): expand antigravity model config
- Remove static Name mapping from AntigravityModelConfig
- Add new model entries: claude-sonnet-4-5, gpt-oss-120b-medium, tab_flash_lite_preview
- Add model skip list for unlisted models
- Update thinking limits (Max: 128000, ZeroAllowed: true)

Cherry-picked from c175821c.
2026-01-20 10:39:00 +07:00
RCD e80b531d68 fix(translator): avoid forcing RFC 8259 system prompt
Cherry-picked from 52e46ced.
2026-01-20 10:32:41 +07:00
RCD 8d737adaf1 feat(translator): report cached token usage in Claude output
Cherry-picked from cf9daf47.
2026-01-20 10:32:12 +07:00
RCD de766d80b3 refactor(translator): normalize includeThoughts field name
Rename include_thoughts to includeThoughts across all translator files
for consistency with the Gemini API field naming convention.

Cherry-picked key change from d5ef4a6d.
2026-01-19 06:54:38 +07:00
RCD eead4d59f4 fix(thinking): add original_mode to log field order
Cherry-picked from cb6caf3f. The main changes (fromSuffix parameter,
strictBudget logic) were already included in the thinking package port.
2026-01-19 06:50:42 +07:00
RCD f030ec3384 feat(thinking): add unified thinking configuration package
Port the internal/thinking package from CLIProxyAPI for unified thinking
configuration processing across all AI providers.

Features:
- Core types: ThinkingConfig, ThinkingMode, ThinkingLevel, SuffixResult
- Suffix parsing: model-name(16384) or model-name(high) syntax
- Validation: auto-conversion between budget/level formats, clamping
- Provider appliers: claude, gemini, antigravity, openai, codex
- Config extraction: extract thinking config from various request formats
- Stripping: remove thinking config for non-supporting models

Registry updates:
- Add UserDefined field to ModelInfo for passthrough behavior
- Add LookupModelInfo function for model capability lookup
2026-01-19 06:36:22 +07:00
RCD 22f91dc48e feat(translator): add reasoning state tracking and improve reasoning summary handling
Improves handling of reasoning summaries in OpenAI Responses API translation.
Cherry-picked from CLIProxyAPI.
2026-01-19 06:09:19 +07:00
RCD ed136fef5d refactor(logging): centralize log directory resolution logic
- Add ResolveLogDirectory() for consistent log path resolution
- Add SetLogLevel() for string-based log level configuration
- Update ConfigureLogOutput() to take *config.Config parameter
- Update all callers to use simplified API

Cherry-picked from CLIProxyAPI with adaptations.
2026-01-19 06:07:51 +07:00
RCD 630102632f fix(antigravity): convert non-string enum values to strings for Gemini API
Gemini API requires enum values to be strings. This adds NormalizeEnumValues
to convert numeric or boolean enum values to their string representations.
Cherry-picked from CLIProxyAPI.
2026-01-19 06:01:28 +07:00
RCD 2e490cf8f2 fix(translator): add check for empty text to prevent invalid serialization
Prevents sending empty text fields to Gemini and Antigravity APIs which
could cause invalid JSON serialization. Cherry-picked from CLIProxyAPI.
2026-01-19 06:00:12 +07:00
RCD e845700b9e test(updates): add unit tests for update system
11 tests covering:
- Poller creation, channel setting, start/stop
- Rollback data directory handling
- Rollback info save/load operations
- Health check recording and marking
- Asset platform detection
- Download progress reader
2026-01-18 07:39:02 +07:00
RCD 3127555850 feat(updates): add rollback support with crash detection
New rollback module for version recovery:
- Version-aware backup metadata tracking
- Platform-specific restore (Windows batch, Unix swap)
- Crash loop detection via startup health monitoring
- Auto-rollback after 3 rapid failures in 30s window
- MarkHealthy() clears failure counter after stable run

Install module updated to save rollback info on update.
2026-01-18 07:34:57 +07:00
RCD 4c3d538979 feat(updates): add background update poller
New poller module for periodic update checks:
- Configurable polling interval
- Channel support (stable/prerelease)
- Callback-based notification system
- Global singleton for tray integration
- Graceful start/stop with context cancellation
2026-01-18 07:34:09 +07:00
RCD 4d14eeb608 feat(config): add auto-update configuration settings
Add UpdatesConfig struct with configurable options:
- auto-check: enable/disable automatic update checks
- check-interval-hours: polling frequency (default 24h)
- auto-download/auto-install: for future automation
- notify-on-update: toast notifications
- channel: stable/prerelease support

Includes helper methods with sensible defaults.
2026-01-18 07:33:31 +07:00
RCD 7fc975198d fix(translator): preserve multiple system prompts in Gemini requests
Cherry-pick from CLIProxyAPI v6.7.7 (f8f3ad8).

Fixes issue where only the last system/developer message was preserved
when multiple were provided. Added systemPartIndex counter to accumulate
parts across all system messages instead of overwriting at index 0.

Also fixed path inconsistency in gemini_openai_request.go where the
array branch incorrectly used request.systemInstruction instead of
system_instruction.

Fixes: router-for-me/CLIProxyAPI#1064
2026-01-17 08:10:59 +07:00
RCD f2eabe57c5 fix(codex): ensure instructions field exists in request body
Add check to ensure 'instructions' field exists in Execute, ExecuteStream,
and CountTokens functions before sending request to Codex API.

Cherry-picked from:
- CLIProxyAPI v6.7.4 (902bea2)
2026-01-16 15:25:50 +07:00
RCD a2d701b205 fix(executor): update gemini-3-pro model name check to use internal name
Change conditional check from gemini-3-pro-preview (alias) to
gemini-3-pro-high (internal name) for system instruction injection.

Cherry-picked from:
- CLIProxyAPI v6.7.3 (c3ef46f)
2026-01-16 15:25:50 +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 4d33b21446 chore(pricing): update model pricing table for Jan 2026
- Add Claude 4.5 model variants (opus, sonnet, haiku)
- Add Gemini 2.0/2.5 Flash and Pro pricing
- Add OpenAI o3/o4-mini pricing
- Update date reference from Dec 2024 to Jan 2026
2026-01-12 07:37:44 +07:00
Finessse f415504d35 feat(api): add rate limits monitoring endpoints
- GET /v0/management/rate-limits - detailed per-credential status
- GET /v0/management/rate-limits/summary - availability overview
- Shows available, cooling_down, disabled counts and next recovery time
2026-01-12 07:37:03 +07:00
Finessse 522f0e5c89 feat(windows): add single-instance mutex and Windows service support
- winutil package with mutex-based single instance lock
- Toast notification helper for Windows
- Service stubs for future Windows service mode
2026-01-12 07:36:43 +07:00
Finessse d6dd24e2b7 feat(tui): add polished Flight Deck terminal dashboard
- Bubbletea-based TUI with 5 tabs: Status, Accounts, Rate Limits, Usage, Logs
- Industrial control room aesthetic with orange/green color scheme
- Double-line borders (╔═╗), active tab indicator 【】
- 3-column stat boxes on Status, 4-column on Usage
- Visual gauge bar for rate limit availability
- Config-optional mode allows TUI to run without config.yaml
- Full-width frame with properly aligned borders
2026-01-12 07:33:04 +07:00