Skip to content

fix(sse): keep output_config.format for the official Anthropic API-key provider - #16626

Merged
diegosouzapw merged 2 commits into
release/v3.8.52from
fix/port-pr-4050-output-config-format-anthropic
Oct 15, 2026
Merged

diegosouzapw merged 2 commits into
release/v3.8.52from
fix/port-pr-4050-output-config-format-anthropic

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Summary

  • The Claude passthrough strip of output_config.format (Fix fix: strip output_config.format for non-Anthropic Claude-format endpoints #1719) only exempted the Claude OAuth provider (claude), so structured output (json_schema) was silently dropped for the official Anthropic API-key provider (anthropic, https://api.anthropic.com/v1/messages).
  • Both first-party ids now keep output_config.format; Claude-compatible gateways (MiniMax, Alibaba MaaS, DeepSeek via aggregators…) still lose format and keep effort.

Attribution

Thanks to @raflyazf for the original implementation.

Changes

  • open-sse/handlers/chatCore/outputConfigFormatStrip.ts (new): pure helper stripOutputConfigFormatForCompat(body, provider) + FIRST_PARTY_ANTHROPIC_PROVIDERS = {claude, anthropic}.
  • open-sse/handlers/chatCore.ts: the inline fix: strip output_config.format for non-Anthropic Claude-format endpoints #1719 block in the Claude passthrough branch now calls the helper (same strip semantics: delete format, drop an emptied output_config).
  • tests/unit/chatcore-output-config-format-strip.test.ts (new): helper cases (anthropic keeps, claude keeps, compat strips format/keeps effort, format-only drops output_config, missing/null untouched) + an end-to-end handleChatCore passthrough to anthropic asserting the upstream body still carries output_config.format.

Not touched: MiniMax dropOutputConfig quirk, the output_config.effort strip for effort-encoded models, Bedrock/Vertex Claude (still stripped).

Test plan

  • TDD: with the helper extracted but the old claude-only guard, the new test file failed 3/7 (official anthropic API-key provider keeps output_config.format, first-party Anthropic ids…, Claude passthrough to the anthropic API-key provider forwards output_config.format upstream — upstream format was undefined). After the fix:
    • node --import tsx/esm --test tests/unit/chatcore-output-config-format-strip.test.ts → ℹ tests 7 ℹ pass 7 ℹ fail 0
  • Related suites (Claude passthrough / output_config / chatCore): claude-directive-midconv-passthrough, claude-directive-only-relocation, claude-passthrough-thinking-2454, chatcore-upstream-body, claude-code-compatible-request, cc-compatible-provider, claude-adaptive-thinking-normalize, antigravity-strip-output-config-1944, claude-helper-minimax-output-config, system-role-extraction, system-transforms-provider-scope, chatcore-sanitization, chatcore-reasoning-control, chatcore-model-output-cap-wiring, translator-openai-to-claude → ℹ tests 213 ℹ pass 213 ℹ fail 0
  • npx eslint --suppressions-location config/quality/eslint-suppressions.json <changed files> → clean; npx prettier --check <changed files> → all formatted
  • npm run typecheck:core → clean
  • GITHUB_BASE_REF=release/v3.8.52 node scripts/check/check-pr-test-policy.mjs → Result: PASS
  • GITHUB_BASE_REF=release/v3.8.52 npm run check:test-masking → OK — sem enfraquecimento

⚠️ base-red inherited: #15306 — unit/vitest/integration/package-artifact gates on release/v3.8.52

diegosouzapw and others added 2 commits October 14, 2026 19:50
…y provider

The Claude passthrough strip of output_config.format (#1719) only exempted
the Claude OAuth provider, so structured output silently disappeared for
first-party Anthropic API-key requests. Extract the strip into a pure helper
and exempt both first-party ids (claude, anthropic); Claude-compatible
gateways still lose format and keep effort.

Co-authored-by: Rafli Ahmad Zulfikar <flashzapper@gmail.com>
Inspired-by: decolua/9router#4050
@github-actions

Copy link
Copy Markdown
Contributor

CI Coverage Report

  • Coverage job: skipped
  • PR test policy: success

Coverage artifact was not available for this run.

@diegosouzapw
diegosouzapw merged commit 3de4743 into release/v3.8.52 Oct 15, 2026
39 of 51 checks passed
@diegosouzapw
diegosouzapw deleted the fix/port-pr-4050-output-config-format-anthropic branch October 18, 2026 23:50
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.

fix: strip output_config.format for non-Anthropic Claude-format endpoints

1 participant