feat(anthropic): add opt-in native passthrough - #133
Draft
srnnkls wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claude Code can switch between native Claude and Codex within the same session when
aliasProvideris set toanthropic. Requests remain visible in the existing monitor. The default Codex/Kimi routing and session-affinity behavior remain unchanged.The provider forwards the authentication, beta headers and original request representation supplied by Claude Code, with no keychain access or Anthropic credential store. It handles Messages and token counting, preserves streaming/status/error responses, and disables redirects. HTTP clients are injected for local mock-server tests; request conversion is a pure transformation.
Native Claude thinking (including redacted blocks) is preserved. Foreign visible reasoning becomes tagged text when changing providers; native Codex encrypted replay remains intact. The Anthropic direction recognizes both Codex and encoded Kimi/OpenCode proxy signatures. Switching during an unfinished tool-use turn remains subject to provider history validation.
Inspired by the Anthropic passthrough and reasoning preservation in fcakyon/claude-code-with-codex. This ports the behavior onto current upstream without its branding, credential-store changes, or removal of other providers.
Related: #4, #11, #117. This adds a provider using the existing opt-in alias setting; it does not implement the routes proposal.
Validation:
cargo test --all --locked --offline: 1,039 tests passed.cargo fmt --all -- --check,cargo clippy --all-targets --locked --offline -- -D warnings, andcargo build --all --locked --offlinepassed.