Skip to content

feat(anthropic): add Claude Fable 5.1 - #39151

Closed
mateo-berri wants to merge 2 commits into
litellm_internal_stagingfrom
litellm_add_claude_fable_5_1
Closed

feat(anthropic): add Claude Fable 5.1#39151
mateo-berri wants to merge 2 commits into
litellm_internal_stagingfrom
litellm_add_claude_fable_5_1

Conversation

@mateo-berri

@mateo-berri mateo-berri commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • Claude Fable 5.1 (claude-fable-5-1) is unknown to LiteLLM
  • Requests with reasoning_effort get rejected with a 400
  • Cached and uncached requests are billed at $0
  • Forced tool calls get an opaque provider 400

How it solves it:

  • Adds the Anthropic cost map entry with Fable 5.1 pricing and capabilities
  • Cache reads priced at 0.025x input, a quarter of Fable 5
  • New supports_forced_tool_use: false flag gates tool_choice any/tool
  • Without drop_params that is a clear client-side 400, with it a downgrade to auto
  • Lists the model in the setup wizard and reasoning-effort grid
  • Registers the new flag in the cost map JSON schema

User Flow

Before: a developer pointing their app at Fable 5.1 gets 400s and $0 spend

  1. They add anthropic/claude-fable-5-1 to the proxy model list and send POST http://localhost:4000/v1/chat/completions with "reasoning_effort": "low"
  2. They get HTTP 400 saying anthropic does not support parameters: ['reasoning_effort']
  3. They drop reasoning_effort and resend with a cached system prompt: HTTP 200, but x-litellm-response-cost is 0 and https://litellm-domain/ui/?page=logs shows the request at $0 spend
  4. They send the same route with tools and "tool_choice": "required": HTTP 400 quoting the raw provider error tool_choice: type "tool" and "any" are not supported for this model

After: the same requests are priced and the forced tool call fails clearly or downgrades

  1. They add anthropic/claude-fable-5-1 to the proxy model list and send POST http://localhost:4000/v1/chat/completions with "reasoning_effort": "low"
  2. They get HTTP 200 with the answer and x-litellm-response-cost set (input $10/MTok, output $50/MTok)
  3. They resend with a cached system prompt: the first call bills the cache write at $12.50/MTok and the second bills the cache read at $0.25/MTok, and the logs page shows real spend
  4. They send the same route with tools and "tool_choice": "required": HTTP 400 saying claude-fable-5-1 does not support forced tool use and pointing them at tool_choice="auto" or drop_params
  5. On a deployment with drop_params: true, the same request gets HTTP 200 with a get_weather tool call and finish_reason: tool_calls

Relevant issues

Linear ticket

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Shared setup, real Anthropic API calls through a local proxy:

# fable_5_1_config.yaml
model_list:
  - model_name: claude-fable-5-1
    litellm_params:
      model: anthropic/claude-fable-5-1
      api_key: os.environ/ANTHROPIC_API_KEY
  - model_name: claude-fable-5-1-drop-params
    litellm_params:
      model: anthropic/claude-fable-5-1
      api_key: os.environ/ANTHROPIC_API_KEY
      drop_params: true

general_settings:
  master_key: sk-1234
python litellm/proxy/proxy_cli.py --config fable_5_1_config.yaml --port 4000

cache_body.json used by the prompt caching case (system prompt is 89 "Rule N: ..." sentences, about 3.4k tokens, prefixed with a fresh nonce per run so the first call is a cache write):

{
  "model": "claude-fable-5-1",
  "max_tokens": 50,
  "messages": [
    {"role": "system", "content": [{"type": "text", "text": "Session 3b46abb9. Rule 1: ... Rule 89: ...", "cache_control": {"type": "ephemeral"}}]},
    {"role": "user", "content": "Reply with the single word OK."}
  ]
}

Before (f2a4172)

Chat completion with reasoning_effort

  1. Command:
    curl -s http://localhost:4000/v1/chat/completions -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" \
      -d '{"model":"claude-fable-5-1","messages":[{"role":"user","content":"In one sentence, what model are you?"}],"reasoning_effort":"low","max_tokens":200}' -D -
  2. Output (HTTP 400):
    {"error": {"message": "litellm.UnsupportedParamsError: anthropic does not support parameters: ['reasoning_effort'], for model=claude-fable-5-1. To drop these, set `litellm.drop_params=True` or for proxy:\n\n`litellm_settings:\n drop_params: true`\n. \n If you want to use these params dynamically send allowed_openai_params=['reasoning_effort'] in your request.. Received Model Group=claude-fable-5-1\nAvailable Model Group Fallbacks=None", "type": "None", "param": null, "code": "400"}}
    x-litellm-response-cost: 0
    

Forced tool_choice without drop_params

  1. Command:
    curl -s -w "\nHTTP %{http_code}\n" http://localhost:4000/v1/chat/completions -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" \
      -d '{"model":"claude-fable-5-1","messages":[{"role":"user","content":"What is the weather in Paris?"}],"tools":[{"type":"function","function":{"name":"get_weather","description":"Get weather for a city","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}],"tool_choice":"required","max_tokens":300}'
  2. Output, the raw provider error after a round trip to Anthropic:
    {"error":{"message":"litellm.BadRequestError: AnthropicException - {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"tool_choice: type \\\"tool\\\" and \\\"any\\\" are not supported for this model.\"},\"request_id\":\"req_011CedBqNQu6djk3P3sSGdTe\"}. Received Model Group=claude-fable-5-1\nAvailable Model Group Fallbacks=None","type":null,"param":null,"code":"400"}}
    HTTP 400
    

Forced tool_choice with drop_params

  1. Command:
    curl -s -w "\nHTTP %{http_code}\n" http://localhost:4000/v1/chat/completions -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" \
      -d '{"model":"claude-fable-5-1-drop-params","messages":[{"role":"user","content":"Use the get_weather tool to answer: what is the weather in Paris?"}],"tools":[{"type":"function","function":{"name":"get_weather","description":"Get weather for a city","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}],"tool_choice":"required","reasoning_effort":"low","max_tokens":300}'
  2. Output, drop_params does not help because nothing knows the param is unsupported:
    {"error":{"message":"litellm.BadRequestError: AnthropicException - {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"tool_choice: type \\\"tool\\\" and \\\"any\\\" are not supported for this model.\"},\"request_id\":\"req_011CedBqb1RrGf5hJumoFXwZ\"}. Received Model Group=claude-fable-5-1-drop-params\nAvailable Model Group Fallbacks=None","type":null,"param":null,"code":"400"}}
    HTTP 400
    

Prompt caching cost

  1. Command, run twice:
    for n in 1 2; do curl -s http://localhost:4000/v1/chat/completions -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" -d @cache_body.json -D headers_$n.txt | jq -c '{content: .choices[0].message.content, usage}'; grep -i "^x-litellm-response-cost" headers_$n.txt; done
  2. Output for request 1 (cache write, billed at $0):
    {"content": "OK", "prompt_tokens": 3401, "cache_creation_input_tokens": 3385, "cache_read_input_tokens": 0}
    x-litellm-response-cost-input: 0.0
    x-litellm-response-cost-output: 0.0
    
  3. Output for request 2 (cache read, billed at $0):
    {"content": "OK", "prompt_tokens": 3401, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 3385}
    x-litellm-response-cost-input: 0.0
    x-litellm-response-cost-output: 0.0
    

After (40cd92d)

Chat completion with reasoning_effort

  1. Command:
    curl -s http://localhost:4000/v1/chat/completions -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" \
      -d '{"model":"claude-fable-5-1","messages":[{"role":"user","content":"In one sentence, what model are you?"}],"reasoning_effort":"low","max_tokens":200}' -D -
  2. Output (HTTP 200), 19 x $10/MTok + 21 x $50/MTok:
    {"model": "claude-fable-5-1", "content": "I'm Claude, an AI model made by Anthropic.", "prompt_tokens": 19, "completion_tokens": 21}
    x-litellm-response-cost: 0.0012400000000000002
    x-litellm-response-cost-input: 0.00019
    x-litellm-response-cost-output: 0.0010500000000000002
    

Forced tool_choice without drop_params

  1. Command:
    curl -s -w "\nHTTP %{http_code}\n" http://localhost:4000/v1/chat/completions -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" \
      -d '{"model":"claude-fable-5-1","messages":[{"role":"user","content":"What is the weather in Paris?"}],"tools":[{"type":"function","function":{"name":"get_weather","description":"Get weather for a city","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}],"tool_choice":"required","max_tokens":300}'
  2. Output, rejected client-side before any provider call:
    {"error":{"message":"litellm.UnsupportedParamsError: claude-fable-5-1 does not support forced tool use (tool_choice='required' or a named tool). Use tool_choice='auto' and tell the model in the prompt when to call the tool, or set `litellm.drop_params = True` to downgrade to 'auto' automatically.. Received Model Group=claude-fable-5-1\nAvailable Model Group Fallbacks=None","type":"None","param":null,"code":"400"}}
    HTTP 400
    

Forced tool_choice with drop_params

  1. Command:
    curl -s -w "\nHTTP %{http_code}\n" http://localhost:4000/v1/chat/completions -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" \
      -d '{"model":"claude-fable-5-1-drop-params","messages":[{"role":"user","content":"Use the get_weather tool to answer: what is the weather in Paris?"}],"tools":[{"type":"function","function":{"name":"get_weather","description":"Get weather for a city","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}],"tool_choice":"required","reasoning_effort":"low","max_tokens":300}'
  2. Output, tool_choice downgraded to auto and the model still calls the tool:
    {"finish_reason": "tool_calls", "tool_calls": [{"index": 0, "caller": {"type": "direct"}, "function": {"arguments": "{\"city\": \"Paris\"}", "name": "get_weather"}, "id": "toolu_019Ysxs7ab6e1axvBYUEkqoa", "type": "function"}], "prompt_tokens": 386, "completion_tokens": 50}
    HTTP 200
    

Prompt caching cost

  1. Command, run twice:
    for n in 1 2; do curl -s http://localhost:4000/v1/chat/completions -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" -d @cache_body.json -D headers_$n.txt | jq -c '{content: .choices[0].message.content, usage}'; grep -i "^x-litellm-response-cost" headers_$n.txt; done
  2. Output for request 1, cache write: 3395 x $12.50/MTok = 0.0424375, plus 16 uncached input and 4 output tokens:
    {"content": "OK", "prompt_tokens": 3411, "cache_creation_input_tokens": 3395, "cache_read_input_tokens": 0}
    x-litellm-response-cost: 0.0427975
    x-litellm-response-cost-input: 0.00016000000000000042
    x-litellm-response-cost-output: 0.0002
    
  3. Output for request 2, cache read: 3395 x $0.25/MTok = 0.00084875, plus the same 16 input and 4 output tokens:
    {"content": "OK", "prompt_tokens": 3411, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 3395}
    x-litellm-response-cost: 0.0012087500000000002
    x-litellm-response-cost-input: 0.0001600000000000001
    x-litellm-response-cost-output: 0.0002
    

Type

🆕 New Feature

Caveats (if any)

Medium

  • The forced tool_choice guard covers /v1/chat/completions only
    • Native /v1/messages requests with tool_choice any/tool still get the provider's own 400

Low

  • Anthropic direct only: Bedrock, Vertex AI and Azure AI entries come in a follow-up
  • supports_forced_tool_use is a new cost map flag, only Fable 5.1 sets it so far
  • Tests that needed an unmapped Fable id now use claude-fable-5-2 as the placeholder

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Registers claude-fable-5-1 in the cost maps so the model prices, reports its
1M/128K limits, and advertises adaptive always-on thinking instead of falling
through the generalization rules at zero cost. Pricing matches Fable 5 at
$10/$50 per MTok except cache reads, which Anthropic prices at 0.025x base
input ($0.25/MTok) on this model instead of 0.1x.

Fable 5.1 rejects forced tool use (tool_choice type any/tool) with a 400
because thinking is always on and a forced call would skip it. A new
supports_forced_tool_use flag on the entry drives the Anthropic chat
transformation to downgrade such a tool_choice to auto when drop_params is
set, and otherwise raise a clean client-side UnsupportedParamsError that
explains the workaround.

Anthropic API only for now. Adds the model to the setup wizard and the
reasoning effort e2e grid, and moves the tests that used claude-fable-5-1 as
an unmapped placeholder id onto claude-fable-5-2.
@codspeed-hq

codspeed-hq Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_add_claude_fable_5_1 (40cd92d) with litellm_internal_staging (82dd36c)

Open in CodSpeed

@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds Claude Fable 5.1 support for Anthropic, including pricing, capabilities, reasoning-effort coverage, and model discovery.

  • Registers direct Anthropic pricing, caching rates, context limits, and capability metadata.
  • Rejects unsupported forced tool choices clearly or downgrades them to auto when parameter dropping is enabled.
  • Adds setup-wizard registration, schema support, and focused configuration and transformation tests.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
litellm/llms/anthropic/common_utils.py Adds a model-capability-driven guard that rejects or downgrades unsupported forced tool choices.
litellm/llms/anthropic/chat/transformation.py Applies the forced-tool-choice guard after normalizing OpenAI tool-choice inputs.
model_prices_and_context_window.json Registers Claude Fable 5.1 pricing, limits, and Anthropic capability metadata.
litellm/model_prices_and_context_window_backup.json Keeps the bundled backup cost map synchronized with the primary model registry.
model_prices_and_context_window.schema.json Adds schema validation for the forced-tool-use capability flag.
litellm/setup_wizard.py Adds Claude Fable 5.1 to the established hand-maintained Anthropic model list.
tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py Covers forced-tool rejection, downgrade behavior, parallel-tool preservation, and unaffected models.
tests/test_litellm/test_claude_fable_5_1_config.py Validates Fable 5.1 pricing, caching, capabilities, bundled-map synchronization, and provider resolution.

Reviews (2): Last reviewed commit: "chore(model-prices): register supports_f..." | Re-trigger Greptile

Comment thread litellm/setup_wizard.py
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor Author

Superceded by #39148

@mateo-berri mateo-berri closed this Sep 1, 2026
@mateo-berri
mateo-berri deleted the litellm_add_claude_fable_5_1 branch September 1, 2026 21:05
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