Part of #1. Pairs with #6 (chat-completions side) and #7 (responses side).
Goal
Today the Anthropic adapter actively suppresses thinking block output. With reasoning models live (gpt-5, o3, codex…), Anthropic clients (Claude Code, Anthropic SDK) lose all visibility into the model's chain of thought. We should emit thinking blocks whenever the upstream provides reasoning material.
Current state
src/routes/messages/non-stream-translation.ts:305 says verbatim:
// GitHub Copilot doesn't generate thinking blocks, so we don't include them in responses
That comment is stale as of the GPT-5 / codex rollout. Additionally the thinking_delta and signature_delta types declared in src/routes/messages/anthropic-types.ts:145–146 are dead code — no producer in the repo.
On the input side, thinking blocks are flattened into plain text:
src/routes/messages/anthropic-types.ts:21–24 — thinking? payload field is silently ignored
src/routes/messages/non-stream-translation.ts:146–154, :195–211 — inbound thinking content blocks → text
Tasks
Acceptance criteria
- Claude Code shows the model's thinking inline when running against
gpt-5 / o3 / gpt-5.3-codex
- Two-turn flow round-trips
thinking.signature byte-exact (no upstream verification errors)
- No regression on tests in
tests/anthropic-response.test.ts
File pointers
src/routes/messages/non-stream-translation.ts:305 — remove suppression
src/routes/messages/anthropic-types.ts:21–24, 145–146
src/routes/messages/stream-translation.ts — state machine
Part of #1. Pairs with #6 (chat-completions side) and #7 (responses side).
Goal
Today the Anthropic adapter actively suppresses
thinkingblock output. With reasoning models live (gpt-5, o3, codex…), Anthropic clients (Claude Code, Anthropic SDK) lose all visibility into the model's chain of thought. We should emitthinkingblocks whenever the upstream provides reasoning material.Current state
src/routes/messages/non-stream-translation.ts:305says verbatim:That comment is stale as of the GPT-5 / codex rollout. Additionally the
thinking_deltaandsignature_deltatypes declared insrc/routes/messages/anthropic-types.ts:145–146are dead code — no producer in the repo.On the input side,
thinkingblocks are flattened into plain text:src/routes/messages/anthropic-types.ts:21–24—thinking?payload field is silently ignoredsrc/routes/messages/non-stream-translation.ts:146–154,:195–211— inboundthinkingcontent blocks → textTasks
non-stream-translation.ts:305and emit{ type: 'thinking', thinking: '...', signature: '...' }blocks when:message.reasoning_contentis non-empty (depends on Preserve encrypted_content for multi-turn reasoning #6)output[]item withtype: 'reasoning'(depends on Add upstream Responses API service client #3)thinking_deltaandsignature_deltaevents. The Claude streaming spec orders them:content_block_start (type=thinking)→ repeatedthinking_delta→ finalsignature_delta(carries the opaque CoT signature) →content_block_stop.signatureto carryencrypted_contentfor the Responses path (Anthropic'ssignaturefield is the natural home for an opaque verifier blob; see Model-to-endpoint routing (chat vs responses) #5)thinkingblock withsignatureis included in history, don't flatten to text — preserve it as a reasoning item that gets forwarded upstream (cross-link Model-to-endpoint routing (chat vs responses) #5, Reasoning types & reasoning_effort passthrough in chat-completions #7)Acceptance criteria
gpt-5/o3/gpt-5.3-codexthinking.signaturebyte-exact (no upstream verification errors)tests/anthropic-response.test.tsFile pointers
src/routes/messages/non-stream-translation.ts:305— remove suppressionsrc/routes/messages/anthropic-types.ts:21–24, 145–146src/routes/messages/stream-translation.ts— state machine