Repository navigation
docs(providers_anthropic): Opus 4.1 uses the json_tool_call fallback, not native output_format - #1852
Merged
Merged
Conversation
… not native output_format Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Anthropic provider page listed Claude Opus 4.1 as a native structured output model, saying
response_formatis translated to Anthropicoutput_formatfor it. On current litellm main,AnthropicConfig.map_openai_paramsonly takes the native path whensupports_native_structured_outputis set in the cost map, and noclaude-opus-4-1*Anthropic entry carries that flag (the direct Anthropic entries were removed from the cost map after their deprecation date in BerriAI/litellm#42435). Opus 4.1 requests therefore go through thejson_tool_callforced tool fallback with no structured outputs beta header. The flag is set for Sonnet 4.5 and later, Opus 4.5 and later, and Haiku 4.5, and those are the models that getoutput_formatThe page now lists those models as native, says Opus 4.1 and older use the
json_tool_callfallback, and fixes the info box, which named the target fieldoutput_schemaand described the tool fallback as part of the native path. Live test against real Anthropic confirmed the old text was wrong: Opus 4.1 got the tool fallback and nooutput_format, while Sonnet 4.5, Opus 4.5 and Haiku 4.5 gotoutput_formatplus thestructured-outputs-2025-11-13header and returned schema-valid JSON. Anthropic's API now returnsnot_found_errorforclaude-opus-4-1-20250805, which is a separate staleness issue with the model list at the top of the page and is not changed hereLinear ticket
Resolves LIT-8756
Live evidence
litellm main at 6f5ad78a1f, real Anthropic API, no stubs
SDK run, capturing the outbound Anthropic request body and headers via a
CustomLogger.log_pre_api_callhook, with the doc'scapital_responseschema:Proxy run (
uv run python litellm/proxy/proxy_cli.py --config cfg.yaml --port 4000 --detailed_debug,claude-opus-4-1->anthropic/claude-opus-4-1-20250805,claude-sonnet-4-5->anthropic/claude-sonnet-4-5-20250929), using the doc's curl:Cost map on main:
supports_native_structured_output: trueon claude-sonnet-4-5, claude-sonnet-4-6, claude-sonnet-5, claude-haiku-4-5, claude-opus-4-5, claude-opus-4-6, claude-opus-4-7, claude-opus-4-8, claude-opus-5, claude-opus-5-5. No anthropicclaude-opus-4-1*entry exists, and the bedrock Opus 4.1 entries do not set the flagLink to Devin session: https://app.devin.ai/sessions/4f05b13c62e24eadb57f2016c4d3b4f4
Open in Devin Desktop: https://app.devin.ai/desktop/session/4f05b13c62e24eadb57f2016c4d3b4f4?variant=devin
Requested by: @jesus-berri