Commit History
-
refactor(executor): split providers and preserve legacy entrypoints
shinmentakezo07 +1: Claude Opus 4.6Extract provider-specific logic into refactored executors with a shared base flow, keep legacy executor files as thin compatibility wrappers, and apply static safety fixes to reduce duplication and avoid symbol/nil-path regressions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>3e5ab39
-
feat: passthrough upstream response headers to clients
Kirill TuranskiyCPA previously stripped ALL response headers from upstream AI provider APIs, preventing clients from seeing rate-limit info, request IDs, server-timing and other useful headers. Changes: - Add Headers field to Response and StreamResult structs - Add FilterUpstreamHeaders helper (hop-by-hop + security denylist) - Add WriteUpstreamHeaders helper (respects CPA-set headers) - ExecuteWithAuthManager/ExecuteCountWithAuthManager now return headers - ExecuteStreamWithAuthManager returns headers from initial connection - All 11 provider executors populate Response.Headers - All handler call sites write filtered upstream headers before response Filtered headers (not forwarded): - RFC 7230 hop-by-hop: Connection, Transfer-Encoding, Keep-Alive, etc. - Security: Set-Cookie - CPA-managed: Content-Length, Content-Encoding409fbf7
-
refactor(all): replace manual pointer assignments with `new` to enhance code readability and maintainability
Unverified signature2359a6f
-
refactor(translator, executor): remove redundant `bytes.Clone` calls for improved performance
Unverified signature- Replaced all instances of `bytes.Clone` with direct references to enhance efficiency. - Simplified payload handling across executors and translators by eliminating unnecessary data duplication.1b0fbba -
refactor(executor): optimize payload cloning and streamline SDK translator usage
Unverified signature- Replaced unnecessary `bytes.Clone` calls for `opts.OriginalRequest` throughout executors. - Introduced intermediate variable `originalPayloadSource` to simplify payload processing. - Ensured better clarity and structure in request translation logic.c702df8
-
feat(openai): add responses/compact support
Shady KhalifaUnverified signature8f7449a
-
feat(executor): add request_id to error logs
hkfiresExtract error.message from JSON error responses when summarizing error bodies for debug logs2511652
-
feat(executor): apply payload rules using requested model
hkfires69a5340
-
feat(registry): support provider-specific model info lookup
hkfires4771da8
-
refactor(thinking): pass source and target formats to ApplyThinking for cross-format validation
hkfiresUpdate ApplyThinking signature to accept fromFormat and toFormat parameters instead of a single provider string. This enables: - Proper level-to-budget conversion when source is level-based (openai/codex) and target is budget-based (gemini/claude) - Strict budget range validation when source and target formats match - Level clamping to nearest supported level for cross-format requests - Format alias resolution in SDK translator registry for codex/openai-response Also adds ErrBudgetOutOfRange error code and improves iflow config extraction to fall back to openai format when iflow-specific config is not present.4072514
-
fix(executor): properly handle thinking application errors
hkfirese934726 -
refactor: improve thinking logic
hkfiresee9e572
-
feat(executor): add HttpRequest support across executors for better http request handling
Unverified signaturea64baa3
-
feat(executor): enhance payload translation with original request context
Unverified signatureRefactored `applyPayloadConfig` to `applyPayloadConfigWithRoot`, adding support for default rule validation against the original payload when available. Updated all executors to use `applyPayloadConfigWithRoot` and incorporate an optional original request payload for translations.ae057e3
-
fix(thinking): fallback to upstream model for thinking support when alias not in registry
hkfirescc7e585 -
fix(thinking): use model alias for thinking config resolution in mapped models
hkfiresd57c140
-
refactor(executor): resolve upstream model at conductor level before execution
hkfiresc37b7ba -
fix(executor): use upstream model for thinking config and payload translation
hkfires7559da4
-
fix: apply thinkingLevel from model suffix metadata for Gemini 3
Ben VargasThe previous commit added thinkingLevel support but didn't apply it when the reasoning effort came from model name suffix (e.g., model(minimal)). This was because ResolveThinkingConfigFromMetadata returns nil for level-based models, bypassing the metadata application. Changes: - Add ApplyGemini3ThinkingLevelFromMetadata for standard Gemini API - Add ApplyGemini3ThinkingLevelFromMetadataCLI for CLI API format - Update gemini_cli_executor to apply Gemini 3 thinkingLevel from metadata - Update antigravity_executor to apply Gemini 3 thinkingLevel from metadata - Update aistudio_executor to apply Gemini 3 thinkingLevel from metadata - Add comprehensive test coverage for Gemini 3 thinkingLevel functionsa1a3463
-
Merge pull request #449 from sususu98/fix/gemini-cli-429-retry-delay-parsing
Unverified signaturefix(gemini-cli): enhance 429 retry delay parsingd2552c8
-
refactor(executor): clarify executor comments and oauth names
hkfires9cc01d9 -
refactor(executor): clarify providers and streams
hkfiresAdd package and constructor documentation for AI Studio, Antigravity, Gemini CLI, Gemini API, and Vertex executors to describe their roles and inputs. Introduce a shared stream scanner buffer constant in the Gemini API executor and reuse it in Gemini CLI and Vertex streaming code so stream handling uses a consistent configuration. Update Refresh implementations for AI Studio, Gemini CLI, Gemini API (API key), and Vertex executors to short‑circuit and simply return the incoming auth object, while keeping Antigravity token renewal as the only executor that performs OAuth refresh. Remove OAuth2-based token refresh logic and related dependencies from the Gemini API executor, since it now operates strictly with API key credentials.f3f3cbf
-
fix(gemini-cli): enhance 429 retry delay parsing
sususu +1: Claude Opus 4.5Add fallback parsing for quota reset delay when RetryInfo is not present: - Try ErrorInfo.metadata.quotaResetDelay (e.g., "373.801628ms") - Parse from error.message "Your quota will reset after Xs." This ensures proper cooldown timing for rate-limited requests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>4ceec71
-
fix(executor): increase buffer size for stream scanners to 50MB across multiple executors
sususu864db07
-
fix(executor): centralize default thinking config
hkfiresc60202a -
feat(executor): normalize thinking budget across all Gemini executors
hkfiresab09327
-
Fixed: #414
Unverified signature**refactor(gemini): comment out unused CLI preview entry**d0b35c1
-
refactor(executor): dedupe thinking metadata helpers across Gemini executors
aurorafluxExtract applyThinkingMetadata and applyThinkingMetadataCLI helpers to payload_helpers.go and use them across all four Gemini-based executors: - gemini_executor.go (Execute, ExecuteStream, CountTokens) - gemini_cli_executor.go (Execute, ExecuteStream, CountTokens) - aistudio_executor.go (translateRequest) - antigravity_executor.go (Execute, ExecuteStream) This eliminates code duplication introduced in the -reasoning suffix PR and centralizes the thinking config application logic. Net reduction: 28 lines of code.82379d5
-
**refactor(executor): simplify Gemini CLI execution and remove internal retry logic**
Unverified signature- Removed nested retry handling for 429 rate limit errors. - Simplified request/response handling by cleaning redundant retry-related code. - Eliminated `parseRetryDelay` function and max retry configuration logic.4ae9540
-
fix(executor): prevent streaming on failed response when no fallback
Ben VargasFix critical bug where ExecuteStream would create a streaming channel from a failed (non-2xx) response after exhausting all retries with no fallback models available. When retries were exhausted on the last model, the code would break from the inner loop but fall through to streaming channel creation (line 401), immediately returning at line 461. This made the error handling code at lines 464-471 unreachable, causing clients to receive an empty/closed stream instead of a proper error response. Solution: Check if httpResp is non-2xx before creating the streaming channel. If failed, continue the outer loop to reach error handling. Identified by: codex-bot review Ref: https://github.com/router-for-me/CLIProxyAPI/pull/280#pullrequestreview-34845604238da283a -
fix(executor): prevent streaming from 429 response when fallback available
Ben VargasFix critical bug where ExecuteStream would create a streaming channel using a 429 error response instead of continuing to the next fallback model after exhausting retries. When 429 retries were exhausted and a fallback model was available, the inner retry loop would break but immediately fall through to the streaming channel creation, attempting to stream from the failed 429 response instead of trying the next model. Solution: Add shouldContinueToNextModel flag to explicitly skip the streaming logic and continue the outer model loop when appropriate. Identified by: codex-bot review Ref: https://github.com/router-for-me/CLIProxyAPI/pull/280#pullrequestreview-3484479106f7a456b -
feat(executor): add intelligent retry logic for 429 rate limits
Ben VargasImplement Google RetryInfo.retryDelay support for handling 429 rate limit errors. Retries same model up to 3 times using exact delays from Google's API before trying fallback models. - Add parseRetryDelay() to extract Google's retry guidance - Implement inner retry loop in Execute() and ExecuteStream() - Context-aware waiting with cancellation support - Cap delays at 60s maximum for safety8160cb0
-
**fix(runtime): simplify scanner buffer allocation in executor implementations**
Unverified signature09adea3
-
**feat(runtime): add payload configuration support for executors**
Unverified signatureIntroduce `PayloadConfig` in the configuration to define default and override rules for modifying payload parameters. Implement `applyPayloadConfig` and `applyPayloadConfigWithRoot` to apply these rules across various executors, ensuring consistent parameter handling for different models and protocols. Update all relevant executors to utilize this functionality.a917f9b
-
feat(gemini-cli): add multi-project support and enhance credential handling
Unverified signatureIntroduce support for multi-project Gemini CLI logins, including shared and virtual credential management. Enhance runtime, metadata handling, and token updates for better project granularity and consistency across virtual and shared credentials. Extend onboarding to allow activating all available projects.aae5103
-
fix(executor): remove outdated Gemini model previews from CLI fallback order
Unverified signaturef52524a
-
fix(executor): remove `safetySettings` from payload for Gemini requests
Unverified signature0f6a6da
-
refactor(executor): summarize API error bodies of html in debug logs
hkfires62f6af9
-
chore(logging): clarify 429 rate-limit retries in Gemini executor
hkfires20518ca -
fix(gemini-cli): correctly strip/normalize thinking config by model
hkfiresc32fec0 -
fix(executor): only apply thinking config to supported models
hkfiresc896fd9
-
fix(gemini): map responseModalities to uppercase IMAGE/TEXT
hkfires80f30e2
-
feat(executor): add debug logs for rate-limiting retries in Gemini CLI executor
Unverified signature4f358ac
-
Refactor executor error handling and usage reporting
Unverified signature- Updated the Execute methods in various executors (GeminiCLIExecutor, GeminiExecutor, IFlowExecutor, OpenAICompatExecutor, QwenExecutor) to return a response and error as named return values for improved clarity. - Enhanced error handling by deferring failure tracking in usage reporters, ensuring that failures are reported correctly. - Improved response body handling by ensuring proper closure and error logging for HTTP responses across all executors. - Added failure tracking and reporting in the usage reporter to capture unsuccessful requests. - Updated the usage logging structure to include a 'Failed' field for better tracking of request outcomes. - Adjusted the logic in the RequestStatistics and Record methods to accommodate the new failure tracking mechanism.b9ad503
-
Enhance logging for API requests and responses across executors
Unverified signature- Added detailed logging of upstream request metadata including URL, method, headers, and body for Codex, Gemini, IFlow, OpenAI Compat, and Qwen executors. - Implemented error logging for API response failures to capture errors during HTTP requests. - Introduced structured logging for authentication details (AuthID, AuthLabel, AuthType, AuthValue) to improve traceability. - Updated response logging to include status codes and headers for better debugging. - Ensured that all executors consistently log API interactions to facilitate monitoring and troubleshooting.5b50851 -
Feature: #103
Unverified signaturefeat(gemini): add Gemini thinking configuration support and metadata normalization - Introduced logic to parse and apply `thinkingBudget` and `include_thoughts` configurations from metadata. - Enhanced request handling to include normalized Gemini model metadata, preserving the original model identifier. - Updated Gemini and Gemini-CLI executors to apply thinking configuration based on metadata overrides. - Refactored handlers to support metadata extraction and cloning during request preparation.a382a67
-
feat(registry, executor, util): add support for `gemini-2.5-flash-image-preview` and improve aspect ratio handling
Unverified signature- Introduced `gemini-2.5-flash-image-preview` model to the registry with updated definitions. - Enhanced Gemini CLI and API executors to handle image aspect ratio adjustments for the new model. - Added utility function to create base64 white image placeholders based on aspect ratio configurations.147d05d -
feat(registry, executor): add support for `glm-4.6` model and enhance Gemini CLI token handling
Unverified signature- Added `glm-4.6` model to registry and documentation. - Updated Gemini CLI executor to pass configuration to `prepareGeminiCLITokenSource` for improved token management.7dee760 -
feat(registry, executor): add support for `gemini-2.5-flash-image` model
Unverified signature- Introduced `gemini-2.5-flash-image` model with updated definitions in registry. - Enhanced model marker detection in Gemini CLI executor to include support for the new model.4e98339
-
fix(gemini): Disable thinking config for incompatible models
hkfires5c4667a