Skip to content

feat(anthropic): add opt-in native passthrough - #133

Draft
srnnkls wants to merge 1 commit into
raine:mainfrom
srnnkls:feat/anthropic-passthrough
Draft

feat(anthropic): add opt-in native passthrough#133
srnnkls wants to merge 1 commit into
raine:mainfrom
srnnkls:feat/anthropic-passthrough

Conversation

@srnnkls

@srnnkls srnnkls commented Sep 7, 2026

Copy link
Copy Markdown

Claude Code can switch between native Claude and Codex within the same session when aliasProvider is set to anthropic. 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:

  • Full cargo test --all --locked --offline: 1,039 tests passed.
  • Targeted Anthropic tests passed after adding the encoded Kimi-signature regression case.
  • cargo fmt --all -- --check, cargo clippy --all-targets --locked --offline -- -D warnings, and cargo build --all --locked --offline passed.
  • Integration tests use local mock servers, including delayed SSE, token counting, response errors and dashboard accounting. No live subscription requests were made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant