# Claude Fable 5.2 API (https://wanapi.app/docs/claude-fable-5-2)





This reference covers **Claude Fable 5.2** and its own Messages parameters. Use `claude-fable-5-2` with `POST https://api.wanapi.app/v1/messages`. [Compare Claude models](/docs/claude-api).

## Model settings [#model-settings]

| Setting                            | Claude Fable 5.2                  |
| ---------------------------------- | --------------------------------- |
| Model ID                           | `claude-fable-5-2`                |
| Context window                     | 1M tokens                         |
| Maximum synchronous output         | 128000 tokens, including thinking |
| Thinking modes                     | Adaptive, always on               |
| Default effort                     | `high`                            |
| Forced tool calls (`any` / `tool`) | Not supported                     |

## Connect and send a request [#connect-and-send-a-request]

Create a key in [API key settings](/settings/apikeys). One API key works across all models and groups. Keep it in your server environment as `WAN_API_KEY`. Send `anthropic-version: 2023-06-01`; add `anthropic-beta` only for features that require it.

```bash
curl https://api.wanapi.app/v1/messages \
  -H "x-api-key: $WAN_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-fable-5-2",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Explain the purpose of a database index in three sentences."}]
  }'
```

```python
import os
import anthropic

client = anthropic.Anthropic(
    api_key=os.environ["WAN_API_KEY"],
    base_url="https://api.wanapi.app",
)
message = client.messages.create(
    model="claude-fable-5-2",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Explain the purpose of a database index in three sentences."}],
)
print("".join(block.text for block in message.content if block.type == "text"))
```

## Current API coverage [#current-api-coverage]

The table below describes this model's native contract. Wan API currently forwards requests through a compatibility layer. **Use a positive `max_tokens` value**: the gateway currently replaces `0` with a generation budget, so it cannot be used for cache-only prewarming here.

The current gateway does not forward `diagnostics`, `compaction`, `fallbacks`, `fallback_credit_token` or `thread`. It also filters `speed`, `service_tier` and `inference_geo` in the current channel configuration. These fields are documented below to explain the model's contract, but they are not available through this connection yet. A successful response does not mean an ignored field took effect. Beta features that need these fields share the same limitation.

## Parameters [#parameters]

| Field                   | Type / default              | Constraint                                                                                          |
| ----------------------- | --------------------------- | --------------------------------------------------------------------------------------------------- |
| `model`                 | Required string             | `claude-fable-5-2`. Use the exact ID; grouping is automatic.                                        |
| `max_tokens`            | Required integer            | 0–128000, including thinking. Zero cannot accompany stream true, structured output or forced tools. |
| `messages`              | Required array              | 1–100000 official turns; empty only for a thread continuation after pause\_turn.                    |
| `system`                | String or text-block array  | Omit entirely on thread continuation.                                                               |
| `thinking`              | Object, adaptive by default | Only adaptive. display: omitted (default), summarized, updates or null.                             |
| `output_config`         | Object                      | effort: low, medium, high (default), xhigh, max or null. Optional format and task\_budget.          |
| `output_format`         | Object or null              | Deprecated structured-output alias; prefer output\_config.format.                                   |
| `stop_sequences`        | String array                | Not nullable; incompatible with on-demand compaction.                                               |
| `stream`                | Boolean, false              | SSE when true; not nullable.                                                                        |
| `tools`                 | Array                       | Official client tools and server tools/toolsets. Client tools are executed by your application.     |
| `tool_choice`           | Object                      | auto or none; forced tool calls are rejected.                                                       |
| `metadata`              | Object                      | user\_id string or null, up to 512 characters.                                                      |
| `cache_control`         | Object or null              | type ephemeral, ttl 5m or 1h.                                                                       |
| `container`             | String, object or null      | Optional id and up to 20 skills.                                                                    |
| `context_management`    | Object or null              | Official context edits; requires the appropriate beta.                                              |
| `mcp_servers`           | Array                       | Up to 20 HTTPS servers; requires the appropriate MCP beta.                                          |
| `diagnostics`           | Object or null              | previous\_message\_id string or null, up to 256 characters.                                         |
| `service_tier`          | auto or standard\_only      | Optional; not nullable.                                                                             |
| `inference_geo`         | String or null              | global or us, subject to account availability.                                                      |
| `speed`                 | String or null              | standard, fast or null; fast needs no beta.                                                         |
| `compaction`            | Object or null              | type summarize, optional instructions up to 16384 Unicode characters.                               |
| `fallbacks`             | default, array or null      | Up to three distinct targets; official server-side-fallback beta required.                          |
| `fallback_credit_token` | String, object or null      | Token up to 2048 characters; official credit beta required; cannot accompany fallbacks.             |
| `thread`                | Object or null              | create, or continue with previous\_message\_id; message-threads-2026-08-12 required.                |

## Thinking and tools [#thinking-and-tools]

Claude Fable 5.2 uses adaptive thinking with high effort by default. It does not support enabled, disabled or between\_tools thinking, or budget\_tokens. `thinking.display: updates` needs `thinking-display-updates-2026-08-18`. `thinking.block_binding` allows prefix\_mismatch\_behavior error, drop\_block or null with `thinking-binding-controls-2026-08-01`.

`output_config.task_budget` requires `task-budgets-2026-03-13`, type tokens, integer total of at least 20000, and optional nonnegative integer remaining. Omit remaining when using compaction or replaying a signed compaction block. On-demand compaction requires `compact-2026-09-04` and cannot accompany context\_management, stop\_sequences, structured output or forced tools. Threshold compaction uses `compact-2026-01-12`, with an input\_tokens trigger of at least 50000.

Per-message effort on system messages requires mid-conversation-output-config-2026-07-01. Final assistant prefill is rejected; official pause\_turn and compaction continuations remain valid.

Use computer\_toolset\_20260801 for computer use. Advisor tools require advisor-tool-2026-03-01 and a supported target. Your application controls tool execution and permissions.

Thread continuation sends only new messages and must omit system and tools. It cannot accompany compaction or context edits other than keeping all thinking. State expires after five minutes without a request; retain your conversation locally. State-dependent constraints are checked when continuing.

Fable 5.2 fallback targets are Claude Opus 4.8 and Claude Opus 5. Advanced beta execution and fast-mode charging require live verification; the request schema is not a measured capability guarantee.

## Media input [#media-input]

For images and PDFs, use publicly accessible HTTP(S) URLs in a user message's `content` blocks. Host your files yourself; this integration does not provide a Files API or uploads. Example image input:

```json
{"role":"user","content":[
  {"type":"image","source":{"type":"url","url":"https://example.com/chart.png"}},
  {"type":"text","text":"What does this chart show?"}
]}
```

Use a `document` block for a PDF. Keep tool-use IDs, complete thinking blocks and signatures unchanged when continuing a conversation. Your application executes client tools and returns their results; declaring a tool does not execute it.

## Pricing [#pricing]

USD per 1 million tokens

Current rates include each group’s multiplier. Prices are cached for up to 2 minutes.

One API key works across all models and groups. Default marks the first eligible group in the automatic routing order; the request is billed at the rates of the group actually selected.

### Claude Fable 5.2

`claude-fable-5-2`

| Billable tokens | claude · Default · All input lengths |
| --- | ---: |
| Input (uncached) | $4 |
| Output | $20 |
| Cache read | $0.1 |
| Cache write · 5 minutes | $5 |
| Cache write · 1 hour | $8 |

— means no verified quote is available; it does not mean free.

Cache rates apply only when the response reports the corresponding cache usage. Do not count cached tokens again as uncached input.

Multiply each billable token count by its matching rate and divide the total by 1,000,000. Thinking tokens are included in output tokens, not charged a second time. Cache reads, 5-minute writes and 1-hour writes have separate rates. For length-based pricing, choose the applicable band before calculating the request cost.

## Response and streaming [#response-and-streaming]

A completed message includes `id`, `type`, `role`, `model`, `content`, `stop_reason` and `usage`. Read text blocks from `content`; the first block may instead be thinking or a tool call. This example is illustrative:

```json
{
  "id": "msg_example",
  "type": "message",
  "role": "assistant",
  "model": "claude-fable-5-2",
  "content": [{"type": "text", "text": "A database index helps locate rows without scanning the whole table."}],
  "stop_reason": "end_turn",
  "usage": {"input_tokens": 24, "output_tokens": 18}
}
```

Set `stream: true` for SSE and use `curl -N`. Handle `message_start`, `content_block_start`, `content_block_delta`, `content_block_stop`, `message_delta` and `message_stop`, plus `ping` and stream errors. Read final usage rather than treating every chunk as a complete response.

## OpenAI-compatible formats [#openai-compatible-formats]

The same model ID works with `POST /v1/chat/completions` and `POST /v1/responses`. Use `Authorization: Bearer YOUR_API_KEY` and the OpenAI SDK base URL `https://api.wanapi.app/v1`. Chat Completions uses `messages`; Responses uses `input`. Their fields are converted to Messages, so use `/v1/messages` for the native parameters documented above.

```bash
curl https://api.wanapi.app/v1/chat/completions \
  -H "Authorization: Bearer $WAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-fable-5-2","max_tokens":256,"messages":[{"role":"user","content":"Reply with OK."}]}'
```

## Usage logs and errors [#usage-logs-and-errors]

[LLM logs](/usage) show completed calls from the last 7 days, with the model, input tokens, output tokens and cost. Refresh after a call and filter by `claude-fable-5-2`. Use [Task logs](/tasks) for images and videos.

Inspect the HTTP status and `error` object when a request fails. Check the key, [balance](/docs/balance), model ID and supported parameter combinations. A refusal or output-limit stop is different from an HTTP error. If a request or stream is interrupted, check the logs before retrying: a new request can incur another charge.

## Model references [#model-references]

* [Model overview](https://platform.claude.com/docs/en/models/fable-5-2/overview)
* [Messages reference](https://platform.claude.com/docs/en/api/beta/messages/create)
* [Thinking](https://platform.claude.com/docs/en/build-with-claude/thinking)
