Claude Fable 5.2
claude-fable-5.2Claude Fable 5.2 supports long-context analysis, reasoning, coding assistance, and tool-assisted workflows. Its published specifications include a 1 million-token context window, up to 128,000 output tokens, multimodal input, and content caching. Access it on OpenAny using the public model ID claude-fable-5.2 through the configured Claude Messages endpoint.
Auto route pricing
Route source: Neolink
This route has conditional pricing. Review its tiers and requirements before calling.
- Published rate
- Conditional pricing
- Billing unit
- / 1M tokens
- Context / Max output
- 1000K / 128K
- Live routes
- 1
On this page
Overview
Overview for Neolink
Claude Fable 5.2: Long-Context Analysis, Coding, and Tool Workflows
Bring documents, code, and a clear task into one conversation. Claude Fable 5.2 has a published 1 million-token context window and supports reasoning, tool calling, content caching, and multimodal input. Its maximum published output is 128,000 tokens per response. On OpenAny, call claude-fable-5.2 through the Messages interface.
Start with a task whose answer you can check: find a defect in a function, compare sections of a document, or request a structured investigation using tools you supply. The examples below show how to turn those tasks into reviewable requests.
Explore the workflows
The three illustrations below are general workflow diagrams published by Anthropic. They help explain application patterns; they are not Fable 5.2 benchmark results or outputs generated by this OpenAny configuration.
1. Bring relevant context and tools to the model
Workflow illustration: connect a language model to retrieval, tools, and memory
Attach the source material your task depends on. Retrieval, external tools, and persistent memory are application integrations around the model; they need to be supplied by your application.
For a document review, give each source a title or section marker, state the questions, and ask the model to separate findings from missing information. The context window sets a capacity ceiling; it does not replace source selection or answer verification.
Read the supplied release notes and migration guide.
1. Identify incompatible API changes.
2. Cite the relevant source section for each finding.
3. List questions the supplied material cannot answer.
Return a concise migration checklist.2. Split a long task into stages you can inspect
Workflow illustration: process a task in stages with an intermediate check
Turn a complex deliverable into extraction, review, and drafting stages. Check each intermediate result before passing it to the next request.
Stage | What to provide | What to check |
|---|---|---|
Extract | The source documents and a list of required facts. | Every extracted claim points to supplied material. |
Review | The extracted facts and your acceptance criteria. | Conflicts, gaps, and assumptions are explicit. |
Draft | The reviewed material and the desired output format. | The result follows your structure and preserves the checked facts. |
Each stage is a separate model request with its own token usage. This pattern can help you locate an error before it reaches the final document.
3. Check coding changes against real results
Workflow illustration: review a coding task using tool results and tests
For coding tasks, provide the relevant files and a reproducible failure. Use tests or tool results to evaluate a proposed change before accepting it.
Diagrams: Anthropic, Building effective agents. These illustrate general application architecture. Tool execution, retrieval, memory, and tests must be implemented by the application; the API does not run local project commands merely because they appear in a prompt.
Code review: a captured Dev example
The supplied Dev request asks the model to review a short averaging function. This is a concrete example you can inspect alongside the full response in the API tab.
def average(values):
return sum(values) / len(values)Input or concern | Finding in the supplied response |
|---|---|
Empty collection | The denominator becomes zero; the response proposes an explicit ValueError. |
Generator or iterator | Generators have no len(); the proposed correction first materializes the iterable. |
Floating-point summation | The response proposes math.fsum for summing floating-point values. |
Non-numeric input | The response notes that inappropriate values can raise TypeError. |
The completed correction below is reproduced from the user-provided response:
import math
def average(values):
values = list(values) # allows generators and other iterables
if not values:
raise ValueError("average() requires at least one value")
return math.fsum(values) / len(values)Review the implementation against your requirements. Converting an iterable to a list uses memory proportional to its size; choose an alternative if your application needs streaming input. The captured response later stops partway through an additional fallback example because it reaches max_tokens=1024. The full response is preserved with that ending.
Choose a task and output budget
Task | Provide | Ask for |
|---|---|---|
Code review | A function or relevant files, expected behavior, and failure inputs. | Findings, a proposed correction, and test cases. |
Long-document analysis | Named source sections and a focused question. | Grounded findings with source references and unresolved gaps. |
Tool-assisted investigation | Tool schemas and a clear success condition. | Calls to application tools, then a conclusion based on returned results. |
Repeated-context work | Stable shared context and a changing question. | Answers using that context; use supported cache controls when available. |
Use max_tokens to reserve an output budget for the task. The captured request uses 1,024; that value was insufficient for its full response. A larger budget may allow a longer completion. Model-specific reasoning parameters and accepted media formats should follow the current endpoint contract.
Model specifications
Specification | Published value |
|---|---|
Public model ID |
|
Context window | 1,000,000 tokens |
Maximum output | 128,000 tokens per response |
Release date | November 10, 2026 |
Listed capabilities | Reasoning, tool calling, content caching, multimodal input |
These model specifications come from the supplied model-center capture. The multimodal label does not identify every supported media format; confirm the request contract before supplying media.
Quickstart
Set OPENANY_API_KEY to your OpenAny API key, then send a Messages request using the public model ID. The request below was supplied with a Dev response. It uses balanced routing and does not pin a provider.
curl 'https://api-dev.openany.si/v1/messages' \
-H "Authorization: Bearer $OPENANY_API_KEY" \
-H 'Content-Type: application/json' \
--data-raw '{
"max_tokens": 1024,
"messages": [
{
"content": "Review this function for edge cases, explain the issue, and suggest a corrected version:\n\ndef average(values):\n return sum(values) / len(values)",
"role": "user"
}
],
"model": "claude-fable-5.2",
"route_mode": "balanced"
}'Adapt the prompt to your task and choose an appropriate max_tokens budget. For this code-review example, check whether the response handles an empty list and explains the expected behavior. The user supplied a response for this Dev request. It stopped at the configured max_tokens limit; the actual upstream provider was not identified by the supplied response.
User-provided Dev response
The archived API example contains the original response supplied by the user, including content blocks, usage, and reported cost. The excerpt below summarizes that same response.
{
"id": "msg_011CgzhFMty6QU47yxS964pD",
"model": "claude-fable-5-2",
"role": "assistant",
"type": "message",
"stop_reason": "max_tokens",
"usage": {
"cache_creation": {
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 0
},
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"inference_geo": "global",
"input_tokens": 53,
"output_tokens": 1024,
"output_tokens_details": {
"thinking_tokens": 460
},
"service_tier": "standard",
"speed": "standard"
},
"openany_cost": 289688
}Output limit reached: stop_reason is max_tokens. The response used 1,024 output tokens, including 460 thinking tokens reported by the upstream usage object, and ends partway through a code example. Increase the output budget if a complete answer is required. No additional request has been made here.
The request used route_mode=balanced without route.provider. This capture does not establish which upstream provider served it. The reported openany_cost is preserved exactly as received; settlement and its unit have not been independently verified.
Connect application tools
A tool workflow consists of a model request, an application operation, and a follow-up request carrying the operation's result. Your application supplies the tool schema and performs the operation. Check tool arguments before execution, then return the actual result so the next model response can use it.
The general Messages tool cycle is documented in Claude's tool-use overview. The selected OpenAny provider route must support the tool fields you send. This package includes no separate captured tool-call or multimodal test.
Pricing and caching
Usage category | USD / 1M tokens |
|---|---|
Input | 8.000000 |
Output | 40.000000 |
Standard cache creation | 10.000000 |
Cache read / hit | 0.200000 |
Conversion: source CNY amount / 7, rounded to the nearest micro-USD using half-up rounding. The one-hour cache-write quote is retained as evidence only.
Common questions
Which model ID should I send?
Use claude-fable-5.2 in the OpenAny request. The configured route maps it to cl-fa-5.2.
Are the illustrations generated by this model?
No. They are attributed workflow diagrams from Anthropic's published article. The code-review response is a separate user-provided Dev capture.
Why does the example answer stop mid-code?
The response reports stop_reason: max_tokens at 1,024 output tokens, including 460 thinking tokens in its usage object. Increase the output budget for a subsequent request if the task needs a longer response.
Did the captured request pin Neo?
No. It used route_mode: balanced without route.provider. The response alone does not establish the selected upstream provider. The package retains the Neo route configuration separately.
What has been verified?
The supplied Dev request and original response are archived. No additional model request was made while preparing this article. The capture does not independently verify tool calling, media input, cache billing, or final settlement.
Playground
Code review using the Messages format. The user-provided Dev response ended at max_tokens. The captured balanced request did not pin a supplier; Playground route selection may adapt the request.
Other parameters (1)
Result preview
Neolink · 4843ms
Response example. Run to see the actual response.
{
"id": "msg_011CgzhFMty6QU47yxS964pD",
"role": "assistant",
"type": "message",
"model": "claude-fable-5-2",
"usage": {
"speed": "standard",
"input_tokens": 53,
"service_tier": "standard",
"inference_geo": "global",
"output_tokens": 1024,
"cache_creation": {
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 0
},
"output_tokens_details": {
"thinking_tokens": 460
},
"cache_read_input_tokens": 0,
"cache_creation_input_tokens": 0
},
"content": [
{
"type": "thinking",
"thinking": "",
"signature": "CAQSuw8KEAgTGAI4AUIIdGhpbmtpbmcSDMxRNoZn5V+snbK2IxoMVH8lQFQj9NcoTdy/IjCs7c6WbkpzQFfF+VpMg0uRLVh3RcArX1+HaQsMu2Y/ES/xGTWYMWxwX6+GY0UrWqUq2A6NVEQC8Kts7YBU6TJFNQCbB4Z1oMXD/70M7Rg3P59YQlnZCZTqc+gwMPwk573vl6Vt/zLNWIoDp+JhQyeQ9033MR6BMjcEgvNrmq27nlOTTR34dD7xZGS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+chsZhGEWfF7kmdYiVwjidT9KhqJASSOFE6GapnHYKLfdKpM8SJRruMV+0odMRli+8Lg+sRZWPiQ1rlPvbgnEdXdz7nWlAdRryHrGX9n0nzNKtjJQIFGObm0SXSgDadmWlDv42FCdw1Vf0BhWbGH4UdaYk68ElNqcMvhqwnLHDlZ3KIvWyMOUCmGPxPnerxCF54as3Ge6C3ZLEFy5i9ImSDYfoksdD41kj8WaJe0MXuxgB"
},
{
"text": "## The main issue: empty input\n\nIf `values` is empty, `len(values)` is `0` and the function raises a `ZeroDivisionError`:\n\n```python\naverage([]) # ZeroDivisionError: division by zero\n```\n\nThe error message is misleading because it doesn't tell the caller what actually went wrong, which is that an empty collection was passed.\n\n## Other edge cases\n\n- **Generators and iterators:** `average(x for x in data)` fails with `TypeError` because generators have no `len()`.\n- **Floating-point precision:** `sum()` accumulates rounding error. For example, `sum([0.1] * 10)` gives `0.9999999999999999`, not `1.0`.\n- **`None` or non-numeric input:** these raise a `TypeError`. That is usually acceptable, but worth knowing.\n\n## Corrected version\n\n```python\nimport math\n\ndef average(values):\n values = list(values) # allows generators and other iterables\n if not values:\n raise ValueError(\"average() requires at least one value\")\n return math.fsum(values) / len(values)\n```\n\nThis version makes three changes:\n\n- **`list(values)`** lets the function accept any iterable, not just sequences.\n- **The explicit check** replaces the confusing `ZeroDivisionError` with a clear `ValueError`.\n- **`math.fsum`** does precision-preserving summation, so `average([0.1] * 10)` returns exactly `0.1`.\n\n## Design choice: raise or return a default?\n\nAn empty average is mathematically undefined, so I'd raise an exception by default, because it keeps bugs from passing silently. If your use case calls for a fallback value instead, make it explicit:\n\n```python\ndef average(values, default=None):\n values = list(values)\n if not values:",
"type": "text"
}
],
"container": null,
"diagnostics": null,
"stop_reason": "max_tokens",
"openany_cost": 289688,
"stop_details": null,
"stop_sequence": null,
"input_transformations": []
}Agent handoff preview
Providers
| Provider | Pricing | Latency | Uptime | Supply | Route |
|---|---|---|---|---|---|
Live | Input $7.600 / 1M tokens Output $38.000 Cache read $0.200 Cache write $16.000 | 4843ms | — | Verified |
- Input
- $7.600
- Output
- $38.000
- Cache read
- $0.200
- Cache write
- $16.000
Source: the selected provider route in OpenAny's public model catalog. A price update timestamp is not supplied.
API
- Base URL
https://api.openany.si/v1- POST
/v1/messages- Authentication
Authorization: Bearer $OPENANY_API_KEY
Request parameters
| Parameter | Type / range | Default value | Required | Description |
|---|---|---|---|---|
prompt | string | Review this function for edge cases, explain the issue, and suggest a corrected version:
def average(values):
return sum(values) / len(values) | Yes | Prompt |
max_tokens | integer · 1 ~ 128000 | 1024 | Yes | Maximum output tokens |
No optional parameters returned.
Request example
curl 'https://api.openany.si/v1/messages' \
-H "Authorization: Bearer $OPENANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"max_tokens": 1024,
"messages": [
{
"content": "Review this function for edge cases, explain the issue, and suggest a corrected version:\n\ndef average(values):\n return sum(values) / len(values)",
"role": "user"
}
],
"model": "claude-fable-5.2",
"route_mode": "balanced"
}'Response example
Configured response example · not a live result
{
"id": "msg_011CgzhFMty6QU47yxS964pD",
"role": "assistant",
"type": "message",
"model": "claude-fable-5-2",
"usage": {
"speed": "standard",
"input_tokens": 53,
"service_tier": "standard",
"inference_geo": "global",
"output_tokens": 1024,
"cache_creation": {
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 0
},
"output_tokens_details": {
"thinking_tokens": 460
},
"cache_read_input_tokens": 0,
"cache_creation_input_tokens": 0
},
"content": [
{
"type": "thinking",
"thinking": "",
"signature": "CAQSuw8KEAgTGAI4AUIIdGhpbmtpbmcSDMxRNoZn5V+snbK2IxoMVH8lQFQj9NcoTdy/IjCs7c6WbkpzQFfF+VpMg0uRLVh3RcArX1+HaQsMu2Y/ES/xGTWYMWxwX6+GY0UrWqUq2A6NVEQC8Kts7YBU6TJFNQCbB4Z1oMXD/70M7Rg3P59YQlnZCZTqc+gwMPwk573vl6Vt/zLNWIoDp+JhQyeQ9033MR6BMjcEgvNrmq27nlOTTR34dD7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6KmN+chsZhGEWfF7kmdYiVwjidT9KhqJASSOFE6GapnHYKLfdKpM8SJRruMV+0odMRli+8Lg+sRZWPiQ1rlPvbgnEdXdz7nWlAdRryHrGX9n0nzNKtjJQIFGObm0SXSgDadmWlDv42FCdw1Vf0BhWbGH4UdaYk68ElNqcMvhqwnLHDlZ3KIvWyMOUCmGPxPnerxCF54as3Ge6C3ZLEFy5i9ImSDYfoksdD41kj8WaJe0MXuxgB"
},
{
"text": "## The main issue: empty input\n\nIf `values` is empty, `len(values)` is `0` and the function raises a `ZeroDivisionError`:\n\n```python\naverage([]) # ZeroDivisionError: division by zero\n```\n\nThe error message is misleading because it doesn't tell the caller what actually went wrong, which is that an empty collection was passed.\n\n## Other edge cases\n\n- **Generators and iterators:** `average(x for x in data)` fails with `TypeError` because generators have no `len()`.\n- **Floating-point precision:** `sum()` accumulates rounding error. For example, `sum([0.1] * 10)` gives `0.9999999999999999`, not `1.0`.\n- **`None` or non-numeric input:** these raise a `TypeError`. That is usually acceptable, but worth knowing.\n\n## Corrected version\n\n```python\nimport math\n\ndef average(values):\n values = list(values) # allows generators and other iterables\n if not values:\n raise ValueError(\"average() requires at least one value\")\n return math.fsum(values) / len(values)\n```\n\nThis version makes three changes:\n\n- **`list(values)`** lets the function accept any iterable, not just sequences.\n- **The explicit check** replaces the confusing `ZeroDivisionError` with a clear `ValueError`.\n- **`math.fsum`** does precision-preserving summation, so `average([0.1] * 10)` returns exactly `0.1`.\n\n## Design choice: raise or return a default?\n\nAn empty average is mathematically undefined, so I'd raise an exception by default, because it keeps bugs from passing silently. If your use case calls for a fallback value instead, make it explicit:\n\n```python\ndef average(values, default=None):\n values = list(values)\n if not values:",
"type": "text"
}
],
"container": null,
"diagnostics": null,
"stop_reason": "max_tokens",
"openany_cost": 289688,
"stop_details": null,
"stop_sequence": null,
"input_transformations": []
}Error handling
400Check the model ID and request fields.429Retry with exponential backoff.5xxRetry only temporary provider failures.JSON Schema
{
"type": "object",
"required": [
"model",
"max_tokens",
"messages"
],
"properties": {
"model": {
"type": "string",
"default": "claude-fable-5.2"
},
"messages": {
"type": "array",
"items": {
"type": "object",
"required": [
"role",
"content"
],
"properties": {
"role": {
"enum": [
"user",
"assistant"
],
"type": "string"
},
"content": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "object"
}
}
]
}
},
"additionalProperties": true
},
"minItems": 1
},
"max_tokens": {
"type": "integer",
"default": 1024,
"maximum": 128000,
"minimum": 1
},
"route_mode": {
"type": "string",
"default": "balanced",
"description": "Routing mode used in the user-provided Dev request."
}
},
"additionalProperties": true
}Examples
Request example
POST /v1/messagescurl 'https://api.openany.si/v1/messages' \
-H "Authorization: Bearer $OPENANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"max_tokens": 1024,
"messages": [
{
"content": "Review this function for edge cases, explain the issue, and suggest a corrected version:\n\ndef average(values):\n return sum(values) / len(values)",
"role": "user"
}
],
"model": "claude-fable-5.2",
"route_mode": "balanced"
}'