Skip to content

fix: Remove stale 'no thinking blocks' comment; update anthropic-types with signature + richer usage #43

@HXYerror

Description

@HXYerror

Part of #38. Small but important — fixes misleading documentation and missing types.

Background

non-stream-translation.ts:305 contains:

// GitHub Copilot doesn't generate thinking blocks, so we don't include them in responses

This comment is factually wrong as of Claude 4.5+ on the native Anthropic path. It was accurate for the OpenAI translation path (Copilot's /chat/completions doesn't return thinking), but confusing and misleading for anyone reading the code after #38 lands.

Additionally, anthropic-types.ts is missing fields that the native Anthropic path returns:

  • AnthropicThinkingBlock.signature?: string — the encrypted thinking signature for multi-turn
  • AnthropicMessagesResponse.usage.cache_creation.ephemeral_1h_input_tokens — returned by native path
  • AnthropicMessagesResponse.usage.cache_creation.ephemeral_5m_input_tokens — returned by native path

Tasks

  • In non-stream-translation.ts:305: replace the comment with:
    // Note: GitHub Copilot's /chat/completions endpoint does not return thinking blocks.
    // For Claude 4.5+ models, the native /v1/messages path (see create-messages-native.ts)
    // returns thinking blocks natively — no translation needed there.
  • In anthropic-types.ts:
    • Add signature?: string to AnthropicThinkingBlock (or AnthropicThinkingContentBlock)
    • Add cache_creation?: { ephemeral_1h_input_tokens: number; ephemeral_5m_input_tokens: number } to the usage field in AnthropicMessagesResponse
    • Add inference_geo?: string to usage (returned by haiku model in live test)
  • Search for any other hardcoded assumptions about Claude thinking that should be updated

Acceptance criteria

  • No grep "doesn't generate thinking" hits in the repo after this lands
  • TypeScript types correctly represent the native Anthropic response shape
  • No test regressions

File pointers

  • Touch: src/routes/messages/non-stream-translation.ts:305
  • Touch: src/routes/messages/anthropic-types.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    anthropicAnthropic Messages API compatibility

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions