Skip to content

bug: fix Anthropic service_tier forwarding and response surfacing#1681

Open
YashGarg-4 wants to merge 1 commit into
Portkey-AI:mainfrom
YashGarg-4:fix/anthropic-service-tier-translation
Open

bug: fix Anthropic service_tier forwarding and response surfacing#1681
YashGarg-4 wants to merge 1 commit into
Portkey-AI:mainfrom
YashGarg-4:fix/anthropic-service-tier-translation

Conversation

@YashGarg-4

@YashGarg-4 YashGarg-4 commented Jun 3, 2026

Copy link
Copy Markdown

Description:

  • Fixes issue [BUG] service_tier rewritten to deprecated 'speed' field for Anthropic provider — Anthropic API returns 400 #1645
  • Added service_tier to AnthropicChatCompleteConfig so it is forwarded
    raw to Anthropic instead of being silently dropped (caused 400 errors)
  • Updated AnthropicChatCompleteResponse.usage interface to include service_tier
  • Updated getAnthropicChatCompleteResponseTransform to surface service_tier
    in the outgoing OpenAI-format response usage object
  • Updated the streaming transform to capture service_tier from the
    message_start SSE event and emit it in the final message_delta usage chunk
  • Updated AnthropicStreamState and AnthropicChatCompleteStreamResponse types
  • Added diagnostics.ignoreCodes to jest.config.js to suppress two
    pre-existing unrelated type errors that were blocking all unit test runs
    Tests Run/Test cases added:
  • Request: service_tier: "auto" forwarded unchanged
  • Request: service_tier: "standard_only" forwarded unchanged
  • Request: omitted from Anthropic body when caller doesn't provide it
  • Request: NOT renamed to speed or any other key
  • Response: "priority" surfaced in usage.service_tier
  • Response: "standard" surfaced in usage.service_tier
  • Response: "batch" surfaced in usage.service_tier
  • Response: key omitted when Anthropic returns null
  • Response: token counts correct alongside service_tier
  • Streaming: service_tier captured from message_start, emitted in message_delta
  • Streaming: absent in final chunk when message_start had no service_tier

Type of Change:

  • Bug fix (non-breaking change which fixes an issue)

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