---
name: fable-5-migration
description: "Migrate Claude API apps to Fable 5 (claude-fable-5) — model IDs, breaking changes, eval-gated rollout. Moves your Claude API / Anthropic SDK codebase to Fable 5 the safe way: updates model IDs (claude-fable-5), audits prompts for behaviour drift, re-tunes max_tokens and thinking budgets, runs before/after evals, and ships a gradual rollout with automatic fallback to Opus 4.8 on regression."
license: MIT
---

# Fable 5 Migration

Moves an existing Claude API / Anthropic SDK codebase onto **Claude Fable 5** (`claude-fable-5`) without the usual day-one breakage. Fable 5 is Anthropic's most capable widely released model, but it has a different request surface than the Opus family — always-on thinking, no sampling params, a `refusal` stop reason, and a 30-day data-retention requirement. This skill handles the model-ID swap, the breaking-change edits, prompt re-tuning, and an eval-gated rollout with automatic fallback. For teams already running on Opus 4.6/4.7/4.8 (or `claude-mythos-preview`) who explicitly chose Fable 5 — it is not the default "upgrade" target, since pricing exceeds Opus tier.

## When to use it
- You decided to move a service to `claude-fable-5` and want the breaking changes applied correctly the first time.
- Your code still sends `thinking: {type: "enabled", budget_tokens: N}`, `temperature`/`top_p`/`top_k`, or assistant-turn prefills — all of which now 400.
- You read `response.content[0]` unconditionally and need refusal handling before it crashes on a declined request.
- You want before/after evals and a gradual cutover rather than flipping every call site at once.

## What it does
1. **Confirms scope first** — never edits blindly; asks which files/dirs unless you named them.
2. **Swaps model IDs** to `claude-fable-5` (or `claude-mythos-5` for Project Glasswing).
3. **Applies the [BLOCKS] edits:** removes all `thinking` config (Fable 5 thinks always-on; even `{type:"disabled"}` 400s — omit the param), strips `temperature`/`top_p`/`top_k`, replaces prefills with `output_config.format` structured outputs, and confirms the org meets 30-day retention (ZDR orgs 400 on every request).
4. **Re-tunes `max_tokens`, `output_config.effort`, and Task Budgets** (`task-budgets-2026-03-13`) — Fable 5 turns can run minutes; it re-baselines token counts with `count_tokens`.
5. **Audits prompts** for behaviour drift (over-prescriptive scaffolding hurts Fable 5; adds anti-overplanning, grounded-progress, and boundary snippets where useful).
6. **Adds refusal handling + fallback by default** — server-side `fallbacks: [{model: "claude-opus-4-8"}]` under the `server-side-fallback-2026-06-01` beta, or the SDK `BetaRefusalFallbackMiddleware` on Bedrock/Vertex/Foundry.
7. **Runs before/after evals** and ships a staged rollout.

## Usage example
```python
# After migration — adaptive thinking is implicit; effort replaces budget_tokens.
resp = client.beta.messages.create(
    model="claude-fable-5",
    max_tokens=16000,
    output_config={"effort": "high"},
    betas=["server-side-fallback-2026-06-01"],
    fallbacks=[{"model": "claude-opus-4-8"}],
    messages=[{"role": "user", "content": "..."}],
)
if resp.stop_reason == "refusal":
    handle_refusal(resp.stop_details)   # category: "cyber" | "bio" | null ...
else:
    print(resp.content[0].text)
```

## Tips & gotchas
- **Branch on `stop_reason`, never `stop_details`** — `stop_details` can be `null` even on a refusal; reading `content[0]` first crashes on pre-output declines (empty `content`, unbilled).
- **Fallbacks are opt-in.** Without the `fallbacks` param a refused request simply stops — ship it on by default.
- **Same tokenizer as Opus 4.8**, so counts are roughly flat from 4.7/4.8 — but per-token pricing differs; re-baseline cost, not token math. From 4.6/Sonnet/Haiku, re-measure with `count_tokens`.
- **De-prescribe migrated prompts** — step-by-step scaffolding tuned for older models lowers Fable 5 output quality. A/B with it removed.

## FAQ
**Is Fable 5 the right upgrade from Opus 4.8?** Only if you explicitly want it — pricing is above Opus tier. For generic "latest model" requests the target stays `claude-opus-4-8`.

**Can I keep `budget_tokens` during migration?** No. The 4.6 transitional escape hatch does not apply to Fable 5 — `budget_tokens` is fully removed and 400s. Control depth with `output_config.effort` (`low`–`max`).

**What if my org uses zero data retention?** Fable 5 requires 30-day retention; ZDR orgs get `400 invalid_request_error` on every request regardless of payload. Fix retention before debugging anything else.
