Claude Fable 5

Text Generation • Anthropic

anthropic/claude-fable-5

  • Third-party

Claude Fable 5 is Anthropic's most capable widely released model, built for the most demanding reasoning and long-horizon agentic work. Adaptive thinking is always on, and the model supports a 1M token context window with up to 128k output tokens per request.

Model Info
Context Window ↗ 1,000,000 tokens
Terms and License link ↗
More information link ↗
Request formats Anthropic Messages
Pricing <ul><li>Input (per 1M tokens)$10.00</li><li>Output (per 1M tokens)$50.00</li><li>Cached input (per 1M tokens)$1.00</li><li>Cache creation (per 1M tokens)$12.50</li></ul>

Usage

const response = await env.AI.run(
  'anthropic/claude-fable-5',
  {
    max_tokens: 1024,
    messages: [{ content: 'What are the three laws of thermodynamics?', role: 'user' }],
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/messages \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "anthropic/claude-fable-5",
  "max_tokens": 1024,
  "messages": [
    {
      "content": "What are the three laws of thermodynamics?",
      "role": "user"
    }
  ]
}'
# The Three Laws of Thermodynamics

## First Law: Conservation of Energy
Energy cannot be created or destroyed—only converted from one form to another. The total energy of an isolated system remains constant.

**Formula:** ΔU = Q − W (change in internal energy = heat added − work done by the system)

**Example:** When you burn fuel in an engine, chemical energy converts to heat and mechanical work, but the total energy is conserved.

## Second Law: Entropy Increases
The entropy (disorder) of an isolated system always increases over time. Heat flows spontaneously from hot objects to cold ones, never the reverse.

**Key implications:**
- No heat engine can be 100% efficient
- Natural processes are irreversible
- It explains why time seems to have a direction ("arrow of time")

**Example:** An ice cube melts in warm water, but you'll never see warm water spontaneously form an ice cube.

## Third Law: Absolute Zero
As a system approaches absolute zero (0 Kelvin, or −273.15°C), its entropy approaches a minimum constant value. It's impossible to reach absolute zero in a finite number of steps.

**Example:** Scientists can get extremely close to absolute zero (billionths of a degree above), but never quite reach it.

---

**Bonus — The Zeroth Law:** Added later but considered more fundamental: if two systems are each in thermal equilibrium with a third system, they're in equilibrium with each other. This is what makes thermometers work!

A popular summary: *"You can't win (1st), you can't break even (2nd), and you can't quit the game (3rd)."*
{
  "id": "msg_01TEGjkVwYzfuHrCs5V1Q9de",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "thinking",
      "thinking": "",
      "signature": "CAISqAIKYggOGAIqQOscSUEIqskVCTFKJ0i4W90Fia0m32aS+8j6gvpJQkVwCImYZvUlLT0ngohDiWPGx+uORrrkI5qUFGBXijU7UVkyDmNsYXVkZS1mYWJsZS01OAFCCHRoaW5raW5nEgwqVZaKUtMPjtT1ZB8aDHzMnpu8xeeshAEKESIwKiCTZBZGAysSVswoEkB20VfYeJeeMBAqcVEwop/ut0LXzwhnDUAEAYUg4kSv39yWKnTO/ICIz4jCyl7L4SMQd616l3PD2uCuyJRUtqnFLO40PxXgwz8fizzEJMSwFXcjTAkEOdo16C6bHJ7kahwYdjcrrvbQV8OFn0555bExOWsJYiTZVdRrO9XgzDVohWsByfew+FJU7cg/MhO5wA3FikOmOP01pBgB"
    },
    {
      "type": "text",
      "text": "# The Three Laws of Thermodynamics\n\n## First Law: Conservation of Energy\nEnergy cannot be created or destroyed—only converted from one form to another. The total energy of an isolated system remains constant.\n\n**Formula:** ΔU = Q − W (change in internal energy = heat added − work done by the system)\n\n**Example:** When you burn fuel in an engine, chemical energy converts to heat and mechanical work, but the total energy is conserved.\n\n## Second Law: Entropy Increases\nThe entropy (disorder) of an isolated system always increases over time. Heat flows spontaneously from hot objects to cold ones, never the reverse.\n\n**Key implications:**\n- No heat engine can be 100% efficient\n- Natural processes are irreversible\n- It explains why time seems to have a direction (\"arrow of time\")\n\n**Example:** An ice cube melts in warm water, but you'll never see warm water spontaneously form an ice cube.\n\n## Third Law: Absolute Zero\nAs a system approaches absolute zero (0 Kelvin, or −273.15°C), its entropy approaches a minimum constant value. It's impossible to reach absolute zero in a finite number of steps.\n\n**Example:** Scientists can get extremely close to absolute zero (billionths of a degree above), but never quite reach it.\n\n---\n\n**Bonus — The Zeroth Law:** Added later but considered more fundamental: if two systems are each in thermal equilibrium with a third system, they're in equilibrium with each other. This is what makes thermometers work!\n\nA popular summary: *\"You can't win (1st), you can't break even (2nd), and you can't quit the game (3rd).\"*"
    }
  ],
  "model": "claude-fable-5",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 20,
    "output_tokens": 577
  },
  "stop_sequence": null,
  "stop_details": null,
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}

Examples

<details>

<summary>With System Message — Using a system message to set context</summary>

const response = await env.AI.run(
  'anthropic/claude-fable-5',
  {
    max_tokens: 1024,
    messages: [{ content: 'How do I read a JSON file in Python?', role: 'user' }],
    system: 'You are a helpful coding assistant specializing in Python.',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/messages \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "anthropic/claude-fable-5",
  "max_tokens": 1024,
  "messages": [
    {
      "content": "How do I read a JSON file in Python?",
      "role": "user"
    }
  ],
  "system": "You are a helpful coding assistant specializing in Python."
}'

````

Reading a JSON File in Python

Use the built-in json module with the json.load() function:

import json

with open("data.json", "r", encoding="utf-8") as file:
    data = json.load(file)

print(data)

Key Points

  • json.load(file) — reads JSON from a file object
  • json.loads(string) — parses JSON from a string (note the "s")
  • The with statement automatically closes the file when done

Accessing the Data

JSON objects become Python dictionaries, and JSON arrays become lists:

```python