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: add cache-user-id toggle for Claude cloaking
matchchDefault to generating a fresh random user_id per request instead of reusing cached IDs. Add cache-user-id config option to opt in to the previous caching behavior. - Add CacheUserID field to CloakConfig - Extract user_id cache logic to dedicated file - Generate fresh user_id by default, cache only when enabled - Add tests for both paths94bf56c
-
Merge PR #1626 into codex/pr-1626
Unverified signatureb3b7752 -
Merge pull request #1628 from thebtf/fix/masquerading-headers
Unverified signaturefix: update Claude masquerading headers and configurable defaultsdce94b3 -
Merge pull request #1625 from thebtf/feat/tool-prefix-config
Unverified signaturefeat: add per-auth tool_prefix_disabled option521d529 -
Merge branch 'pr-1624' into dev
Unverified signature# Conflicts: # internal/runtime/executor/claude_executor.go # internal/runtime/executor/claude_executor_test.gof55e04e
-
fix: update Claude masquerading headers and make them configurable
Kirill TuranskiyUpdate hardcoded X-Stainless-* and User-Agent defaults to match Claude Code 2.1.44 / @anthropic-ai/sdk 0.74.0 (verified via diagnostic proxy capture 2026-02-17). Changes: - X-Stainless-Os/Arch: dynamic via runtime.GOOS/GOARCH - X-Stainless-Package-Version: 0.55.1 → 0.74.0 - X-Stainless-Timeout: 60 → 600 - User-Agent: claude-cli/1.0.83 (external, cli) → claude-cli/2.1.44 (external, sdk-cli) Add claude-header-defaults config section so values can be updated without recompilation when Claude Code releases new versions.dc57d0c -
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 -
feat: add per-auth tool_prefix_disabled option
Kirill TuranskiyAllow disabling the proxy_ tool name prefix on a per-account basis. Users who route their own Anthropic account through CPA can set "tool_prefix_disabled": true in their OAuth auth JSON to send tool names unchanged to Anthropic. Default behavior is fully preserved — prefix is applied unless explicitly disabled. Changes: - Add ToolPrefixDisabled() accessor to Auth (reads metadata key "tool_prefix_disabled" or "tool-prefix-disabled") - Gate all 6 prefix apply/strip points with the new flag - Add unit tests for the accessor54ee78e -
fix: skip proxy_ prefix for built-in tools in message history
Kirill TuranskiyThe proxy_ prefix logic correctly skips built-in tools (those with a non-empty "type" field) in tools[] definitions but does not skip them in messages[].content[] tool_use blocks or tool_choice. This causes web_search in conversation history to become proxy_web_search, which Anthropic does not recognize. Fix: collect built-in tool names from tools[] into a set and also maintain a hardcoded fallback set (web_search, code_execution, text_editor, computer) for cases where the built-in tool appears in history but not in the current request's tools[] array. Skip prefixing in messages and tool_choice when name matches a built-in.b7875c5
-
fix: skip built-in tools in tool_reference prefix + refactor to switch
Kirill Turanskiy- Collect built-in tool names (those with a "type" field like web_search, code_execution) and skip prefixing tool_reference blocks that reference them, preventing name mismatch. - Refactor if-else if chains to switch statements in all three prefix functions for idiomatic Go style.6547de8 -
fix: handle tool_reference nested inside tool_result.content[]
Kirill Turanskiytool_reference blocks can appear nested inside tool_result.content[] arrays, not just at the top level of messages[].content[]. The prefix logic now iterates into tool_result blocks with array content to find and prefix/strip nested tool_reference.tool_name fields.275c7bf -
fix: add proxy_ prefix handling for tool_reference content blocks (#1)
Kirill Turanskiy +1: Kirill TuranskiyapplyClaudeToolPrefix, stripClaudeToolPrefixFromResponse, and stripClaudeToolPrefixFromStreamLine now handle "tool_reference" blocks (field "tool_name") in addition to "tool_use" blocks (field "name"). Without this fix, tool_reference blocks in conversation history retain their original unprefixed names while tool definitions carry the proxy_ prefix, causing Anthropic API 400 errors: "Tool reference 'X' not found in available tools." Co-authored-by: Kirill Turanskiy <kt@novamedia.ru>5d1d154
-
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
-
Fixed: #1372 #1366
Unverified signaturefix(caching): ensure unique cache_control injection using count validation3495cd6
-
Merge pull request #1248 from shekohex/feat/responses-compact
Unverified signaturefeat(openai): add responses/compact supportd7805f3 -
fix(caching): ensure prompt-caching beta is always appended and add multi-turn cache control tests
Unverified signature2e16951
-
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>0f32d2c
-
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
-
fix(claude): skip built-in tools in OAuth tool prefix
Mauricio Allendeae2d70c -
feat(executor): apply payload rules using requested model
hkfires69a5340
-
refactor(claude): remove redundant system instructions check in Claude executor
Unverified signaturecaf9a06 -
Merge pull request #868
Unverified signaturedd8fe4a -
feat(registry): support provider-specific model info lookup
hkfires4771da8
-
refactor(claude): move max_tokens constraint enforcement to Apply method
hkfires40b5dfe
-
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(thinking): use LookupModelInfo for model data
hkfires96ba26c -
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
-
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.822b8e4 -
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 helperse57badb
-
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>89d5f4d
-
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
-
refactor(executor): resolve upstream model at conductor level before execution
hkfiresc37b7ba -
fix(executor): use upstream model for thinking config and payload translation
hkfires7559da4
-
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#630af8d546
-
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.65a5604
-
Merge pull request #481 from sususu98/fix/increase-buffer-size
Unverified signaturefix: increase buffer size for stream scanners to 50MB across multiple executorsa2d15c3 -
fix(runtime): unify claude thinking config resolution
hkfires70925fb
-
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.db58889 -
fix(executor): increase buffer size for stream scanners to 50MB across multiple executors
sususu864db07
-
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>38b64f1
-
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.6b81560 -
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.b3114b9
-
Merge branch 'dev' into feat/claude-thinking-and-beta-headers
Unverified signature70bcc0a -
**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.4329739 -
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 #32473a42c4