To call the Claude Fable 5.2 API, send a POST request to Anthropic’s Messages endpoint with model claude-fable-5-2, your API key, max_tokens, and a user message. Read both the returned content blocks and stop_reason. A successful HTTP response alone doesn’t tell you whether the answer finished.
Anthropic released Fable 5.2 on November 9, 2026. This guide takes you from credentials to a small request, then shows how to read the result. If you’re maintaining an older integration, the Fable 5 API guide provides background, but use the current parameters below for 5.2.
Claude Fable 5.2 API model ID and requirements
| Setting | Value for this tutorial |
|---|---|
| Provider | Direct Claude API |
| Model ID | claude-fable-5-2 |
| Endpoint | POST https://api.anthropic.com/v1/messages |
| API version header | 2026-10-21 |
| Credentials | Claude Console API key |
| Thinking | Adaptive, always on |
The official model page lists a 1 million token context window and maximum output of 128,000 tokens. Those are capacity limits, not sensible starting values for a smoke test. Start with one short prompt and a bounded output budget.
Fable 5.2 targets demanding reasoning and long agent sessions. You don’t need tools, search, or an agent framework to send your first message. Keeping those out makes authentication and response problems easier to isolate.
The model also requires 30-day data retention unless Anthropic expressly authorizes zero data retention. Check your organization’s requirements before sending private material. Use a harmless API documentation question for your first call.

These examples use Anthropic’s direct endpoint. Cloud providers have their own authentication and deployment details; don’t combine a Bedrock model identifier with the direct API request below.
Get your Claude API key
- Open the Claude Console and select the intended organization and workspace.
- Create an API key and confirm the account has usable API billing or credits.
- Store the key in your local environment or server secret manager.
- Run the request from your terminal or backend, keeping the key out of browser code.
Anthropic’s quickstart offers both CLI authentication and API keys. This tutorial uses a key so the HTTP headers remain visible. In a macOS or Linux terminal, set:
export ANTHROPIC_API_KEY="your-api-key-here"
Replace the placeholder locally. Don’t paste a real key into an issue, shared request export, screenshot, or committed source file. The variable applies to the current shell and programs started from it; another terminal won’t automatically inherit it.
A subscription’s chat usage allowance isn’t evidence your API workspace can make this request. Check the Console’s billing and access state directly. If a credential was exposed, revoke it and replace it before continuing.

Send your first Claude Fable 5.2 request
Save the following JSON as request.json, then run the curl command from the same directory. The request asks for a short explanation, uses the verified model ID, and leaves optional generation controls out. The response and headers go into separate files so you can inspect failures without mixing them together.
{
"model": "claude-fable-5-2",
"max_tokens": 4096,
"messages": [
{
"role": "user",
"content": "Explain HTTP idempotency in three short bullet points."
}
]
}
curl --fail-with-body --silent --show-error \
https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2026-10-21" \
-H "content-type: application/json" \
--data-binary @request.json \
--dump-header response.headers \
--output response.json
x-api-key authenticates the request. anthropic-version selects the API contract; it isn’t the model’s release date. content-type tells the server the body is JSON. The version shown here follows the official quickstart checked on November 10, 2026.
max_tokens bounds generated output, including thinking. It doesn’t promise a response of that length. Because Fable 5.2 reasons before answering, an extremely small budget can leave little room for visible text. If the stop reason is max_tokens, treat the answer as incomplete and review the budget.
Don’t add temperature, top_p, or top_k from an older snippet. The model documentation says to omit them. You also can’t switch thinking off on Fable 5.2. Get this small request working before changing effort or adding other features.
Inspect the raw result with:
python3 -m json.tool response.json
If curl reports an HTTP failure, this file can contain an error object rather than a Message. Check that distinction before passing the file into your application parser.
Read content blocks and stop reasons
Read the top-level stop_reason before treating generated text as a finished answer. Then iterate content and select blocks whose type is text. Keep the full response separately if you need to continue the conversation; extracting display text and preserving conversation state are different jobs.
A Message includes a model identifier, content blocks, usage information, and a stop reason. Don’t assume content[0].text exists: thinking or another block type can appear before text, and a refusal can have an empty content array.
| Stop reason | What your first-request handler should do |
|---|---|
end_turn |
Read available text; the turn finished naturally |
max_tokens |
Mark the result incomplete and review the output budget |
refusal |
Handle the declined request and inspect stop_details |
| Anything else | Handle explicitly before treating it as a completed answer |
The stop-reason documentation covers additional states for tools and larger conversations. They become relevant when you extend this tutorial.

A classifier refusal can arrive with HTTP 200. Anthropic’s refusal and fallback guide describes explicit fallback options. The minimal request here doesn’t enable server-side fallback, so don’t assume the API silently substitutes another model.
For multi-turn work, preserve thinking blocks exactly as received when the API requires you to send them back. A filtered list of text blocks is suitable for display, not a replacement for the original assistant message.
Call Claude Fable 5.2 from Python
Install the official SDK in a virtual environment, then create a client that reads ANTHROPIC_API_KEY. Use the same model, prompt, and token budget as your curl request. Keeping those inputs stable lets you compare the HTTP example with the SDK without introducing a second debugging problem.
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade anthropic
Save this as first_request.py:
import anthropic
client = anthropic.Anthropic(
default_headers={"anthropic-version": "2026-10-21"}
)
try:
message = client.messages.create(
model="claude-fable-5-2",
max_tokens=4096,
messages=[{
"role": "user",
"content": "Explain HTTP idempotency in three short bullet points.",
}],
)
except anthropic.APIStatusError as error:
print("HTTP status:", error.status_code)
print("Request ID:", error.request_id)
raise
else:
print("Stop reason:", message.stop_reason)
print("Usage:", message.usage)
if message.stop_reason != "end_turn":
raise RuntimeError("Handle this unfinished or declined turn separately")
for block in message.content:
if block.type == "text":
print(block.text)
Run python first_request.py from the shell containing your key. The explicit stop check keeps a truncated or declined turn from flowing into code that expects a finished answer. Add a separate connection-error handler when you integrate this into a service.
[VERIFY] These examples were checked against current official documentation and validated locally for syntax. A live Fable 5.2 inference call still needs an authorized API key; no live output is claimed here.
Fix common Claude Fable 5.2 API errors
| Status | Check first |
|---|---|
| 400 | JSON shape, unsupported parameters, and configured spend limits |
| 401 | Missing, expired, revoked, or malformed API key |
| 402 | Billing or payment information |
| 403 | Organization and workspace permissions |
| 404 | Endpoint path and resource identifiers |
| 429 | Rate limits or spend caps |
| 500, 504, 529 | Server failure, timeout, or temporary overload |
Use the returned error type and message alongside the status, following Anthropic’s error guide. Save the request-id response header for support. Log status and request IDs without recording credentials.
For a 400, return to the minimal body above. Removing optional parameters is easier than debugging an example carrying settings from several model generations. Forced tool selection also produces a 400 on Fable 5.2, so leave it out when you later add tools.
The SDK retries certain transient failures twice by default. Avoid wrapping it in an unlimited retry loop. A 429 caused by a spend cap without retry-after won’t be resolved by rapid retries. For long responses, move to streaming instead of assuming an idle connection will remain open indefinitely.
Understand the first request’s cost
Standard Fable 5.2 pricing is $8 per million input tokens and $40 per million output tokens, checked on the official model page on November 10, 2026. A hypothetical uncached request using 1,000 input tokens and 500 output tokens costs $0.028: $0.008 plus $0.020.
That’s illustrative arithmetic, not a measured bill for this tutorial. Use the response’s usage data and account billing reports for actual spend. Caching, batch processing, fast mode, and fallback can change the calculation. Keep the first request small before trying long-context workloads.
Once it works, save the request contract and expected completion states for regression testing. For an agent-driven next step, the Apidog CLI in Codex guide explains the agent setup; keep the full Fable testing workflow separate from this first-call tutorial.
FAQ
What is the Claude Fable 5.2 API model name?
Use claude-fable-5-2 on the direct Claude API. Copy provider-specific identifiers from the official model page when using another platform.
Can I disable thinking for a shorter answer?
No. Adaptive thinking is always on. Control depth through the documented effort setting and ask for concise visible output.
Why did HTTP 200 return no answer?
Inspect stop_reason and the content blocks. A classifier refusal is a normal HTTP 200 response and can contain no text.
Can I reuse my Fable 5 request unchanged?
Review the model ID, API version, and generation controls. The older Fable 5 tutorial provides context, but Fable 5.2 has different parameter restrictions.
Where should I keep my API key?
Keep it in a server environment variable or secret manager. Send requests through your backend when building a browser application.



