# Claude Fable 5.1

Claude Fable 5.1 is Anthropic's current Fable model for demanding reasoning and long-running agentic work. Send the official Anthropic Messages request to TokLab: change the base URL and the API key, keep the body. The same model also answers the OpenAI Chat Completions and Responses formats.

## Model ID

| Model ID           | Context window | Max output  | Thinking            | Default effort |
| ------------------ | -------------- | ----------- | ------------------- | -------------- |
| `claude-fable-5-1` | 1M tokens      | 128K tokens | Adaptive, always on | `high`         |

See the [pricing page](https://toklab.ai/pricing) for current prices.

## Quick example

```bash
curl https://api.toklab.ai/v1/messages \
  -H "x-api-key: $TOKLAB_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-fable-5-1",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Summarize the trade-offs of event sourcing in three bullet points."}]
  }'
```

```python
import os
import anthropic

client = anthropic.Anthropic(
    api_key=os.environ["TOKLAB_API_KEY"],
    base_url="https://api.toklab.ai",
)

message = client.messages.create(
    model="claude-fable-5-1",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Summarize the trade-offs of event sourcing in three bullet points."}],
)
print("".join(block.text for block in message.content if block.type == "text"))
```

```javascript
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: process.env.TOKLAB_API_KEY,
  baseURL: "https://api.toklab.ai",
});

const message = await client.messages.create({
  model: "claude-fable-5-1",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Summarize the trade-offs of event sourcing in three bullet points." }],
});
for (const block of message.content) if (block.type === "text") console.log(block.text);
```

```go
package main

import (
	"bytes"
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	body := []byte(`{"model": "claude-fable-5-1", "max_tokens": 1024,
		"messages": [{"role": "user", "content": "Summarize the trade-offs of event sourcing in three bullet points."}]}`)
	req, _ := http.NewRequest("POST", "https://api.toklab.ai/v1/messages", bytes.NewReader(body))
	req.Header.Set("x-api-key", os.Getenv("TOKLAB_API_KEY"))
	req.Header.Set("anthropic-version", "2023-06-01")
	req.Header.Set("Content-Type", "application/json")
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	out, _ := io.ReadAll(resp.Body)
	fmt.Println(string(out))
}
```

## Endpoints

| Format                  | Method and path                                  | Authentication                                                                |
| ----------------------- | ------------------------------------------------ | ----------------------------------------------------------------------------- |
| Anthropic Messages      | `POST https://api.toklab.ai/v1/messages`         | `x-api-key: <key>` or `Authorization: Bearer <key>`, plus `anthropic-version` |
| OpenAI Chat Completions | `POST https://api.toklab.ai/v1/chat/completions` | `Authorization: Bearer <key>`                                                 |
| OpenAI Responses        | `POST https://api.toklab.ai/v1/responses`        | `Authorization: Bearer <key>`                                                 |

The Messages endpoint forwards your request body as sent, including optional fields, and returns the official response. An `anthropic-beta` header is passed on as well. Keep the API key in server-side code.

## Parameters

| Name                                                                                                      | Type                | Required | Default                | Notes                                                                                                                                                                                                                               |
| --------------------------------------------------------------------------------------------------------- | ------------------- | -------- | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `model`                                                                                                   | string              | Yes      | —                      | `claude-fable-5-1`.                                                                                                                                                                                                                 |
| `max_tokens`                                                                                              | integer             | Yes      | —                      | 0–128000. Includes the tokens spent on thinking. `0` only pre-warms the prompt cache.                                                                                                                                               |
| `messages`                                                                                                | object\[]           | Yes      | —                      | Alternating `user` and `assistant` turns; `content` is a string or an array of content blocks. The last turn must be `user`. Exception: to continue a `pause_turn` response, send its content back as the last `assistant` message. |
| `system`                                                                                                  | string or object\[] | No       | —                      | System prompt.                                                                                                                                                                                                                      |
| `thinking`                                                                                                | object              | No       | `{"type": "adaptive"}` | Thinking is adaptive and always on. `display`: `omitted` (default) or `summarized`.                                                                                                                                                 |
| `output_config.effort`                                                                                    | enum                | No       | `high`                 | `low`, `medium`, `high`, `xhigh`, `max`. Steers how much the model thinks.                                                                                                                                                          |
| `output_config.format`                                                                                    | object              | No       | —                      | A JSON schema for structured output.                                                                                                                                                                                                |
| `stop_sequences`                                                                                          | string\[]           | No       | —                      | Stop when one of these strings is generated.                                                                                                                                                                                        |
| `stream`                                                                                                  | boolean             | No       | `false`                | Stream the response as server-sent events.                                                                                                                                                                                          |
| `temperature`                                                                                             | number              | No       | —                      | Only `1` (the default) is accepted, for backwards compatibility; any other value returns a 400 error. Leave it out.                                                                                                                 |
| `top_p`                                                                                                   | number              | No       | —                      | Only values from `0.99` to `1` are accepted, for backwards compatibility; any other value returns a 400 error. Leave it out.                                                                                                        |
| `top_k`                                                                                                   | integer             | No       | —                      | Not accepted: any value returns a 400 error. Leave it out.                                                                                                                                                                          |
| `tools`                                                                                                   | object\[]           | No       | —                      | Tool definitions.                                                                                                                                                                                                                   |
| `tool_choice`                                                                                             | object              | No       | —                      | `auto` or `none`; forcing a tool (`any` or `tool`) is not supported by this model.                                                                                                                                                  |
| `metadata.user_id`                                                                                        | string              | No       | —                      | An opaque id for your end user, up to 512 characters.                                                                                                                                                                               |
| `cache_control`                                                                                           | object              | No       | —                      | Top-level prompt-cache breakpoint.                                                                                                                                                                                                  |
| `container`, `context_management`, `mcp_servers`, `diagnostics`, `service_tier`, `inference_geo`, `speed` | —                   | No       | —                      | Forwarded as sent.                                                                                                                                                                                                                  |

## Thinking and effort

Claude Fable 5.1 always uses adaptive thinking: the model decides how much to think, and `output_config.effort` steers it. Higher effort usually means more output tokens, a longer wait and a higher cost. With `thinking.display` set to `summarized`, the response includes `thinking` blocks you can show; with `omitted`, they are left out. Thinking tokens are billed as output tokens.

## Media inputs

Images and PDFs go in a user turn's `content` as `image` and `document` blocks, with a `url` source or, as in the official API, a `base64` source:

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

Replace the example URL with a publicly reachable file of your own.

## Billing dimensions

See the [current rates on the pricing page](https://toklab.ai/pricing). A request is billed by the tokens it uses:

* input tokens,
* output tokens, including thinking,
* prompt-cache reads, and
* prompt-cache writes, with separate 5-minute and 1-hour rates.

The charge is taken from the `usage` reported with the finished response. A request that fails is not charged. Your account's usage records show the exact charge for every request.

## Output

A non-streaming request returns the official message object:

```json
{
  "id": "msg_...",
  "type": "message",
  "role": "assistant",
  "model": "claude-fable-5-1",
  "content": [{"type": "text", "text": "..."}],
  "stop_reason": "end_turn",
  "usage": {"input_tokens": 18, "output_tokens": 4, "cache_read_input_tokens": 0, "cache_creation_input_tokens": 0}
}
```

With `"stream": true` the response is a stream of the official events: `message_start`, `content_block_start`, `content_block_delta`, `content_block_stop`, `message_delta` and `message_stop`. The final `message_delta` carries the output token count.

## OpenAI-compatible formats

The same model answers the OpenAI formats, so existing OpenAI code only needs a new base URL and model ID:

```python
from openai import OpenAI

client = OpenAI(api_key="YOUR_TOKLAB_KEY", base_url="https://api.toklab.ai/v1")

chat = client.chat.completions.create(
    model="claude-fable-5-1",
    messages=[{"role": "user", "content": "Hello"}],
)
response = client.responses.create(model="claude-fable-5-1", input="Hello")
```

These requests are converted to the Messages format, so a field with no Messages counterpart has no effect. Their responses carry the official OpenAI fields and may include a few extra usage fields; read `usage.total_tokens` and the official fields.

## Errors

Errors on `/v1/messages` use the Anthropic shape, `{"type": "error", "error": {"type": "...", "message": "..."}}`; the other formats use `{"error": {"code": ..., "message": "..."}}`. The `code` is a code from the [common error catalog](https://toklab.ai/docs/api/errors). Failed requests are not charged.

## Tips

* Start with the default effort and raise it only for tasks that need more thinking; effort changes both quality and cost.
* Set `max_tokens` high enough for the thinking as well as the answer: it is one budget for both.
* Put long, reused context first and mark it with `cache_control` so later requests read it from the cache at the lower rate.

## Pricing

Every rate this model is billed at, read live from the price list billing uses. A tier applies when its condition matches, checked top to bottom.

### claude-fable-5-1

| Input (per 1M tokens) | Output (per 1M tokens) | Cache read (per 1M tokens) | Cache write (5 min) (per 1M tokens) | Cache write (1 h) (per 1M tokens) |
| --- | --- | --- | --- | --- |
| $3.00 | $15.00 | $0.075 | $3.75 | $6.00 |

Price tier AWSB (`claude-fable-5-1:claude-0.7`):

| Input (per 1M tokens) | Output (per 1M tokens) | Cache read (per 1M tokens) | Cache write (5 min) (per 1M tokens) | Cache write (1 h) (per 1M tokens) |
| --- | --- | --- | --- | --- |
| $7.00 | $35.00 | $0.175 | $8.75 | $14.00 |

Price tier Official (`claude-fable-5-1:claude-0.95`):

| Input (per 1M tokens) | Output (per 1M tokens) | Cache read (per 1M tokens) | Cache write (5 min) (per 1M tokens) | Cache write (1 h) (per 1M tokens) |
| --- | --- | --- | --- | --- |
| $9.50 | $47.50 | $0.2375 | $11.875 | $19.00 |

## Related

* [Claude Fable 5.1 pricing](https://toklab.ai/pricing)
* [Download OpenAPI](https://toklab.ai/docs/claude-fable-5-1.openapi.json)
* [Copyable Markdown](https://toklab.ai/docs/claude-fable-5-1.md)

## Optional LLM group

The groups you can use depend on your account permissions and the model. The [pricing page](https://toklab.ai/pricing) lists each group's prices.

API calls keep your API key and model ID. To select a group, send its exact name in the optional `X-SeedRouter-Group` request header, or append it to the model ID as `model:<group>` (see [Model tiers](https://toklab.ai/docs/api/model-tiers)). Replace `GROUP_NAME` below with one of your groups. Omit the header or use `auto` to keep the key's default behavior.

```http
X-SeedRouter-Group: GROUP_NAME
```

A restricted API key may have fewer group options than your account. Requests use the selected group's pricing and do not switch to another group if it is unavailable. This option supports HTTP LLM calls, including SSE; it does not apply to WebSocket, image or video calls.

To see the groups your key can use, call `GET /v1/models`: it lists `model:<group>` next to the model ID for every model your key can call in more than one group.
