How to Use the Claude Fable 5 API (with Python)
A working Claude Fable 5 API guide — first call, the 5 params that 400 if you code it like an older model, refusal handling, and what it costs.

TL;DR
- Call Claude Fable 5 through Anthropic's Messages API with the model ID
claude-fable-5— install theanthropicSDK, setANTHROPIC_API_KEY, and send amessages.createrequest - The catch: code written for older Claude (or GPT) models breaks on Fable 5.
temperature,top_p,top_k,budget_tokens,thinking: {type:"disabled"}, and assistant prefills all return a 400 - Thinking is always on — control depth with
output_config.effort(low→max), not a token budget. Handle therefusalstop reason and turn on fallbacks - Fable 5 needs 30-day data retention (ZDR orgs get a 400 on every request) and costs $10 / $50 per 1M input/output tokens — about 2× Opus 4.8
- Want to skip the Anthropic account, tier, and retention setup? Call
claude-fable-5through Velokey's OpenAI-compatible endpoint with one key — same $10/$50 price, none of the parameter traps below
Most "how to call the API" guides show you a three-line hello-world and stop. That's fine until Fable 5 returns a 400 on the first real request because you passed temperature out of habit, or your code reads response.content[0] and crashes on a refusal. Fable 5 is Anthropic's most capable model, but it has a stricter request surface than anything before it. Here's the working call, then the five things that will actually break your integration.

What do you need to call the Claude Fable 5 API?
You need a paid Anthropic account, the anthropic SDK, and — this one bites people — an organization data-retention setting of at least 30 days. Fable 5 is not available under zero data retention (ZDR); a ZDR org gets a 400 invalid_request_error on every Fable 5 request no matter how clean the payload.
The model ID is claude-fable-5. It has a 1M-token context window (the default and the max) and up to 128K output tokens. Install and authenticate:
pip install anthropic
export ANTHROPIC_API_KEY="sk-ant-..." # never hardcodeBefore your first call, confirm:
| Requirement | Why it matters |
|---|---|
| Paid account, sufficient tier | Fable 5 is above Opus-tier; check model access |
| Data retention ≥ 30 days | ZDR orgs 400 on every request |
anthropic SDK installed | Use the official SDK, not an OpenAI-compatible shim |
Model ID claude-fable-5 | Exact string — no date suffix |
How do you make your first Claude Fable 5 API call?
You call client.messages.create() with model="claude-fable-5" and a messages list. Don't pass a thinking parameter — thinking is always on — and control reasoning depth with output_config.effort instead.
import anthropic
client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY from the environment
response = client.messages.create(
model="claude-fable-5",
max_tokens=16000,
output_config={"effort": "high"}, # low | medium | high | xhigh | max
messages=[
{"role": "user", "content": "Explain the tradeoffs of event sourcing in two paragraphs."}
],
)
# Always check stop_reason before reading content (see refusals below)
if response.stop_reason != "refusal":
for block in response.content:
if block.type == "text":
print(block.text)That's the whole hello-world. effort is the main quality/latency dial — high is a good default, xhigh is the sweet spot for coding and agentic work, and low/medium are fine for routine tasks and often beat older models' top settings. The raw chain of thought is never returned; if you want a readable reasoning summary, pass thinking={"type": "adaptive", "display": "summarized"}.
How do you call Claude Fable 5 through Velokey (no Anthropic account)?
If you'd rather skip the Anthropic account, the usage tier, and the 30-day-retention requirement, call Fable 5 through [Velokey](/model/claude-fable-5)'s OpenAI-compatible endpoint. Point any OpenAI client at Velokey's base URL, swap in your Velokey key, and set the model to claude-fable-5 — it's a standard chat completion, so the parameter traps in the next section don't apply.
from openai import OpenAI
client = OpenAI(
base_url="https://api.velokey.ai/v1",
api_key="sk-velokey-...", # your Velokey key — not an Anthropic key
)
response = client.chat.completions.create(
model="claude-fable-5",
messages=[{"role": "user", "content": "Explain the tradeoffs of event sourcing in two paragraphs."}],
)
print(response.choices[0].message.content)Same $10 / $50 per-1M pricing as calling Anthropic directly, billed from Velokey credits, with one key across every model you use — and none of the Anthropic-specific setup. It's the fastest path to a working Fable 5 call. The rest of this guide covers the direct-Anthropic route and the request quirks that come with it, which the OpenAI-compatible endpoint smooths over.
What breaks when you call Claude Fable 5 like an older model?
Calling Anthropic directly, five request parameters that worked on older Claude or GPT models now return a 400 on Fable 5. This is the part that turns a "quick swap" into an afternoon of debugging (and the friction the Velokey path above skips).
Parameters that 400 on Fable 5:
| What you're used to | On Fable 5 | Fix |
|---|---|---|
temperature, top_p, top_k | 400 | Remove them — steer with the prompt instead |
thinking: {type:"enabled", budget_tokens: N} | 400 | Omit it; use output_config.effort |
thinking: {type:"disabled"} | 400 | Omit the thinking param entirely |
Assistant-turn prefill (last message role:"assistant") | 400 | Use output_config.format (structured outputs) |
| Any request from a ZDR org | 400 | Enable ≥30-day data retention |
*Source: Anthropic Claude Fable 5 API documentation, 2026.*
The mental model: Fable 5 removed the sampling knobs and the fixed thinking budget on purpose. There's no temperature=0 for determinism and no budget_tokens ceiling — you shape behavior through the prompt and cap depth with effort. If you're migrating a working Opus or GPT integration, delete those parameters first, before you touch anything else.
How do you handle Claude Fable 5 refusals?
Fable 5 runs safety classifiers that can decline a request — and a decline is not an HTTP error. It returns a successful 200 with stop_reason: "refusal" and an empty (or partial, mid-stream) content array. Code that reads response.content[0].text unconditionally will crash on it.
Two things to do. First, always branch on stop_reason before reading content. Second, opt into fallbacks so a false-positive decline doesn't just fail — benign work in security tooling or life-sciences can trip the classifier, so this matters even for legitimate apps:
response = client.beta.messages.create(
model="claude-fable-5",
max_tokens=16000,
betas=["server-side-fallback-2026-06-01"],
fallbacks=[{"model": "claude-opus-4-8"}], # re-served in the same call on a decline
output_config={"effort": "high"},
messages=[{"role": "user", "content": "..."}],
)
if response.stop_reason == "refusal":
# The whole chain (Fable 5 + fallback) declined — surface it, don't retry as-is
handle_refusal(response)
else:
print(next(b.text for b in response.content if b.type == "text"))With the server-side fallbacks parameter, a declined request is transparently re-run on claude-opus-4-8 inside the same call, and billing is credited so you're not double-charged. A decline before any output isn't billed at all. Turn this on by default in new Fable 5 code — it's opt-in, so without it a refusal simply stops.
How much does the Claude Fable 5 API cost?
Fable 5 costs $10 per 1M input tokens and $50 per 1M output tokens — roughly 2× Claude Opus 4.8 ($5 / $25). It's priced for the hardest reasoning and long-horizon agentic work, not high-volume everyday calls.
What a single request costs:
| Model | 10K in + 2K out | Relative |
|---|---|---|
claude-fable-5 | $0.20 | 2× |
claude-opus-4-8 | $0.10 | 1× |
*Per-token math on published rates. Fable 5: 10K×$10/1M + 2K×$50/1M = $0.20.*

Two levers keep the bill sane. Drop effort to medium or low on routine work — Fable 5 at low effort often matches older models at their ceiling. And use [prompt caching](/blog/claude-api-pricing-2026) for repeated context; cached reads bill at roughly a tenth of the input rate. One more operational note: single requests on hard tasks can run several minutes, so stream anything with a large max_tokens to avoid client timeouts:
with client.messages.stream(
model="claude-fable-5",
max_tokens=64000,
output_config={"effort": "xhigh"},
messages=[{"role": "user", "content": "..."}],
) as stream:
message = stream.get_final_message()If you'd rather not manage an Anthropic account and 30-day-retention settings directly, a unified gateway like [Velokey](/model/claude-fable-5) exposes claude-fable-5 through one OpenAI-compatible endpoint alongside other models — you call it with the same key you use for everything else. For how Fable 5 stacks up on price against other frontier models, see our Claude API pricing guide, the GPT-5.6 tier breakdown, and the GLM-5.2 vs GPT-5.5 vs Opus 4.8 comparison.
Frequently Asked Questions
What is the Claude Fable 5 API model ID?
The model ID is claude-fable-5 — the exact string, with no date suffix. It's Anthropic's most capable widely released model, with a 1M-token context window (the default and maximum) and up to 128K output tokens. Call it through the Messages API (client.messages.create) with the official anthropic SDK.
Why does my Claude Fable 5 request return a 400?
The usual causes are parameters Fable 5 removed: temperature, top_p, top_k, thinking: {budget_tokens}, thinking: {type:"disabled"}, or an assistant-turn prefill — each returns a 400. A separate cause is a zero-data-retention org, which 400s on every Fable 5 request. Remove the sampling/thinking params and confirm ≥30-day retention.
How do I control thinking depth on Claude Fable 5?
Use output_config.effort — low, medium, high, xhigh, or max. Thinking is always on and can't be disabled or given a fixed budget_tokens (both 400). high is a solid default; xhigh suits coding and agentic tasks. To see a reasoning summary, add thinking={"type":"adaptive","display":"summarized"}.
How much does the Claude Fable 5 API cost?
$10 per 1M input tokens and $50 per 1M output tokens — about 2× Claude Opus 4.8. A 10K-input/2K-output request runs about $0.20. Lower effort and prompt caching (cached reads bill ~10% of input) are the main ways to reduce spend on high-volume work.
How do I handle a Claude Fable 5 refusal?
Check response.stop_reason before reading content — a refusal returns HTTP 200 with stop_reason: "refusal" and empty or partial content. Enable the server-side fallbacks parameter (with betas=["server-side-fallback-2026-06-01"]) so a decline is re-served on claude-opus-4-8 in the same call instead of failing.
Can I use the Claude Fable 5 API without an Anthropic account?
Not directly — Fable 5 requires a paid Anthropic account with 30-day data retention. You can reach it through a unified API gateway that handles the upstream Anthropic access, so you call claude-fable-5 via one OpenAI-compatible endpoint without managing the account or retention settings yourself.
Want Claude Fable 5 without managing an Anthropic account? [Get your Velokey API key](/model/claude-fable-5) and call claude-fable-5 through one OpenAI-compatible endpoint — same key, alongside every other model you use.
*Last updated: July 13, 2026. API details are from Anthropic's Claude Fable 5 documentation at the time of writing. Pricing, parameters, and model behavior are set by Anthropic and may change — verify against the official docs before shipping to production.*

