Commit History
-
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.7e8afbe -
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.8953a28
-
Fixed: #1372 #1366
Unverified signaturefix(caching): ensure unique cache_control injection using count validationbf10a0c
-
Merge pull request #1248 from shekohex/feat/responses-compact
Unverified signaturefeat(openai): add responses/compact support1094f8a -
fix(caching): ensure prompt-caching beta is always appended and add multi-turn cache control tests
Unverified signature7808a6c
-
feat(caching): implement Claude prompt caching with multi-turn support
Martin Schneeweiss +1: Claude Opus 4.5- Add ensureCacheControl() to auto-inject cache breakpoints - Cache tools (last tool), system (last element), and messages (2nd-to-last user turn) - Add prompt-caching-2024-07-31 beta header - Return original payload on sjson error to prevent corruption - Include verification test for caching logic Enables up to 90% cost reduction on cached tokens. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>bc71fff
-
feat(openai): add responses/compact support
Shady KhalifaUnverified signature642da09
-
feat(executor): add request_id to error logs
hkfiresExtract error.message from JSON error responses when summarizing error bodies for debug logsc122a46
-
fix(claude): skip built-in tools in OAuth tool prefix
Mauricio Allende339abb4 -
feat(executor): apply payload rules using requested model
hkfiresba27e38
-
refactor(claude): remove redundant system instructions check in Claude executor
Unverified signature9ae0b9f -
Merge pull request #868
Unverified signature59ebdef -
feat(registry): support provider-specific model info lookup
hkfiresa0b18a6
-
refactor(claude): move max_tokens constraint enforcement to Apply method
hkfires4300f05
-
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.0d5d901
-
fix(thinking): use LookupModelInfo for model data
hkfires0053257 -
fix(executor): properly handle thinking application errors
hkfires6e62482 -
refactor: improve thinking logic
hkfiresc44624a
-
feat(executor): add HttpRequest support across executors for better http request handling
Unverified signature0268c3b
-
Use unprefixed Claude request for translation
Ben VargasKeep the upstream payload prefixed for OAuth while passing the unprefixed request body into response translators. This avoids proxy_ leaking into OpenAI Responses echoed tool metadata while preserving the Claude OAuth workaround.61e69ba -
Fix Claude OAuth tool name mapping
Ben VargasPrefix tool names with proxy_ for Claude OAuth requests and strip the prefix from streaming and non-streaming responses to restore client-facing names. Updates the Claude executor to: - add prefixing for tools, tool_choice, and tool_use messages when using OAuth tokens - strip the prefix from tool_use events in SSE and non-streaming payloads - add focused unit tests for prefix/strip helpers5d70236
-
feat(claude): add native request cloaking for non-claude-code clients
maoring24 +1: Claude Opus 4.5integrate claude-cloak functionality to disguise api requests: - add CloakConfig with mode (auto/always/never) and strict-mode options - generate fake user_id in claude code format (user_[hex]_account__session_[uuid]) - inject claude code system prompt (configurable strict mode) - obfuscate sensitive words with zero-width characters - auto-detect claude code clients via user-agent 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>5930ce7
-
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.b08e245
-
refactor(executor): resolve upstream model at conductor level before execution
hkfires5a7ca8b -
fix(executor): use upstream model for thinking config and payload translation
hkfires3d1d6fa
-
Fix: disable thinking when tool_choice forces tool use
Ben VargasAnthropic API does not allow extended thinking when tool_choice is set to "any" or a specific tool. This was causing 400 errors when using features like Amp's /handoff command which forces tool_choice. Added disableThinkingIfToolChoiceForced() that removes thinking config when incompatible tool_choice is detected, applied to both streaming and non-streaming paths. Fixes router-for-me/CLIProxyAPI#630e71fd19
-
fix(claude_executor): update header logic for API key handling
Unverified signatureRefined header assignment to use `x-api-key` for Anthropic API requests, ensuring correct authorization behavior based on request attributes and URL validation.3d551fc
-
Merge pull request #481 from sususu98/fix/increase-buffer-size
Unverified signaturefix: increase buffer size for stream scanners to 50MB across multiple executors7e58114 -
fix(runtime): unify claude thinking config resolution
hkfires7028b73
-
feat(util): implement dynamic thinking suffix normalization and refactor budget resolution logic
Unverified signature- Added support for parsing and normalizing dynamic thinking model suffixes. - Centralized budget resolution across executors and payload helpers. - Retired legacy Gemini-specific thinking handlers in favor of unified logic. - Updated executors to use metadata-based thinking configuration. - Added `ResolveOriginalModel` utility for resolving normalized upstream models using request metadata. - Updated executors (Gemini, Codex, iFlow, OpenAI, Qwen) to incorporate upstream model resolution and substitute model values in payloads and request URLs. - Ensured fallbacks handle cases with missing or malformed metadata to derive models robustly. - Refactored upstream model resolution to dynamically incorporate metadata for selecting and normalizing models. - Improved handling of thinking configurations and model overrides in executors. - Removed hardcoded thinking model entries and migrated logic to metadata-based resolution. - Updated payload mutations to always include the resolved model.996d35a -
fix(executor): increase buffer size for stream scanners to 50MB across multiple executors
sususud811e5f
-
fix(claude): ensure max_tokens exceeds thinking budget for thinking models
nestharus +1: ClaudeFixes an issue where Claude thinking models would return 400 errors when the thinking.budget_tokens was greater than or equal to max_tokens. Changes: - Add MaxCompletionTokens: 128000 to all Claude thinking model definitions - Add ensureMaxTokensForThinking() function in claude_executor.go that: - Checks if thinking is enabled with a budget_tokens value - Looks up the model's MaxCompletionTokens from the registry - Ensures max_tokens is set to at least the model's MaxCompletionTokens - Falls back to budget_tokens + 4000 buffer if registry lookup fails This ensures Anthropic API constraint (max_tokens > thinking.budget_tokens) is always satisfied when using extended thinking features. Fixes: #339 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>b5d9864
-
Fixed: #339
Unverified signature**feat(handlers, executor): add Gemini 3 Pro Preview support and refine Claude system instructions** - Added support for the new "Gemini 3 Pro Preview" action in Gemini handlers, including detailed metadata and configuration. - Removed redundant `cache_control` field from Claude system instructions for cleaner payload structure.0e56654 -
Fixed: #337
Unverified signature**fix(executor): replace redundant commented code with `checkSystemInstructions` helper** - Replaced commented-out `sjson.SetRawBytes` lines with the new `checkSystemInstructions` function. - Centralized system instruction handling for better code clarity and reuse. - Ensured consistent logic for managing `system` field across Claude executor flows.2efdf5a
-
Merge branch 'dev' into feat/claude-thinking-and-beta-headers
Unverified signature3de5ca6 -
**fix(executor): comment out redundant code for setting Claude system instructions**
Unverified signature- Commented out multiple instances of `sjson.SetRawBytes` for setting `system` key to Claude instructions as they are redundant. - Code cleanup to improve clarity and maintainability without affecting functionality.de775c7 -
feat(claude): add thinking model variants and beta headers support
nestharus- Add Claude thinking model definitions (sonnet-4-5-thinking, opus-4-5-thinking variants) - Add Thinking support for antigravity models with -thinking suffix - Add injectThinkingConfig() for automatic thinking budget based on model suffix - Add resolveUpstreamModel() mappings for thinking variants to actual Claude models - Add extractAndRemoveBetas() to convert betas array to anthropic-beta header - Update applyClaudeHeaders() to merge custom betas from request body Closes #3240a572e1
-
**fix(runtime): simplify scanner buffer allocation in executor implementations**
Unverified signature211886e
-
**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.3374794
-
feat(config): support HTTP headers across providers
hkfires2881a1b
-
fix(executor): adjust `Anthropic-Beta` header handling for consistent API requests
Unverified signaturedeec028 -
fix(executor): ensure consistent header application in Claude API requests
Unverified signature5b36e97
-
refactor(executor): summarize API error bodies of html in debug logs
hkfires4db8974
-
feat(runtime): add User-Agent headers to codex and claude executors
Unverified signature- Standardized User-Agent strings for Codex and Claude executors to improve request tracing and compatibility. - Updated header insertion logic in both executors for consistency.ea3a8ca
-
Fixed: #172
Unverified signaturefeat(runtime): add Brotli and Zstd compression support, improve response handling - Implemented Brotli and Zstd decompression handling in `FileRequestLogger` and executor logic for enhanced compatibility. - Added `decodeResponseBody` utility for streamlined multi-encoding support (Gzip, Deflate, Brotli, Zstd). - Improved resource cleanup with composite readers for proper closure under all conditions. - Updated dependencies in `go.mod` and `go.sum` to include Brotli and Zstd libraries.d6661bc
-
feat(claude): add model alias mapping and improve key normalization
Unverified signature- Introduced model alias mapping for Claude configurations, enabling upstream and client-facing model name associations. - Added `computeClaudeModelsHash` to generate a consistent hash for model aliases. - Implemented `normalizeClaudeKey` function to standardize input API key configuration, including models. - Enhanced executor to resolve model aliases to upstream names dynamically. - Updated documentation and configuration examples to reflect new model alias support.6442491
-
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.1d017d0
-
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.676719c
-
fix: add Claude→Claude passthrough to prevent SSE event fragmentation
Unverified signatureWhen from==to (Claude→Claude scenario), directly forward SSE stream line-by-line without invoking TranslateStream. This preserves the multi-line SSE event structure (event:/data:/blank) and prevents JSON parsing errors caused by event fragmentation. Resolves: JSON parsing error when using Claude Code streaming responses fix: correct SSE event formatting in Handler layer Remove duplicate newline additions (\n\n) that were breaking SSE event format. The Executor layer already provides properly formatted SSE chunks with correct line endings, so the Handler should forward them as-is without modification. Changes: - Remove redundant \n\n addition after each chunk - Add len(chunk) > 0 check before writing - Format error messages as proper SSE events (event: error\ndata: {...}\n\n) - Add chunkIdx counter for future debugging needs This fixes JSON parsing errors caused by malformed SSE event streams. fix: update comments for clarity in SSE event forwarding6f7580f
-
feat(registry/runtime): add Gemini 2.5 model and increase buffer sizes
Unverified signature- Added new "Gemini 2.5 Flash Image Preview" model definition, with enhanced image generation capabilities. - Increased scanner buffer size to 20,971,520 bytes across executors and translators to handle larger payloads.2f0e897