Last weekend OpenAI's unreleased Astra model dispatched ten frontier open math problems in one sitting. Within 24 hours, Anthropic researcher Levent Alpöge had reproduced five of them using Claude Fable 5 — a model anyone with a standard API key can call. Weeks earlier, the same model overturned the 87-year-old Jacobian conjecture, producing an explicit three-dimensional counterexample that Terence Tao and other mathematicians checked and confirmed.
This is not a news roundup; it is a working signal: a model callable through an ordinary API now writes mathematical proofs that pass mechanical verification in the Lean kernel. Ten minutes from now you can have it running, and by the end of this guide you will know how to put it on formalization duty.
What Fable 5 Is, and Why It Earns the Hype
Fable 5 is Anthropic's Mythos-class flagship, released in June 2026. The identically architected Mythos 5 is restricted to a handful of customers; Fable 5 ships on the standard API, no gate. Its credentials in this niche are concrete:
- Math and formal verification: 80.3% on SWE-Bench Pro, against Opus 4.8's 69.2% — and its Lean proof ability sits in a tier of its own. Kevin Buzzard's PhD student used Fable to write 250,000 lines of Lean in two weeks, formalizing a modularity-lifting theorem.
- Long autonomous chains: the longer the task and the more steps involved, the wider its lead grows. Anthropic positions it as agentic-first, and the benchmarks back the label.
Pricing is $10 per million input tokens and $50 per million output — 60% cheaper than Mythos Preview. The short version: for math, coding, and long-horizon tasks, it is currently the strongest public option.
Step 1: Set Up
You need an Anthropic API key from console.anthropic.com and Python 3.10+:
pip install -U anthropic
export ANTHROPIC_API_KEY="sk-ant-..."Step 2: The Minimal Call
import anthropic
client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY automatically
message = client.messages.create(
model="claude-fable-5", # exact model ID — a typo returns 404
max_tokens=4096, # always set this explicitly!
messages=[{
"role": "user",
"content": "Prove or disprove: for every positive integer n, "
"n² + n + 41 is prime whenever n < 40. "
"Give a rigorous proof or an explicit counterexample."
}]
)
print(message.content[0].text)
print(f"Usage: {message.usage.input_tokens} in / {message.usage.output_tokens} out")Three things to internalize: model must be exactly claude-fable-5; max_tokens caps the response budget, and leaving it unset risks a single response burning 30,000 tokens; and log message.usage on every call — it is the only reliable way to catch a cost anomaly before it becomes a bill.
Step 3: Lean Proofs — the Main Event
The heavyweight use case is autoformalization: turning a natural-language theorem into Lean 4 code and letting the Lean kernel verify it mechanically. This is exactly what Fable did when reproducing Astra's results — the compiler decides whether a proof holds, and there is no room to argue with it.
import anthropic
client = anthropic.Anthropic()
# Ask for Lean 4 + Mathlib style formal proofs
response = client.messages.create(
model="claude-fable-5",
max_tokens=8192,
system=[{
"type": "text",
"text": (
"You are a Lean 4 formalization expert. For every "
"mathematical statement the user provides:\n"
"1. Write a theorem declaration in Lean 4 syntax (Mathlib allowed)\n"
"2. Provide a tactic proof that passes the kernel\n"
"3. If the statement is false, produce a counterexample as Lean code\n"
"4. Output a complete, compilable .lean file — no explanatory prose"
),
"cache_control": {"type": "ephemeral"} # cache the system prompt, saves ~90% input cost
}],
messages=[{
"role": "user",
"content": "Theorem: every natural number greater than 1 has a prime factor."
}]
)
print(response.content[0].text)Then verify the output locally:
# Install Lean 4 + Mathlib (first build is slow)
curl -fsSL https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh | bash
elan default stable
lake new demo math # project template with Mathlib
# Save the model's output to Demo/Test.lean, then:
lake build # a clean build means the proof holdsThe mental model that makes this work: return verification to the machine, leave ideation to the model. You state the theorem precisely, Fable 5 generates the proof, the Lean kernel accepts or rejects it — three parties, three jobs, with a green lake build as the only arbiter.
Step 4: Stream Anything Long
Fable 5 routinely runs past 60 seconds on complex tasks, and a non-streaming call means staring at a frozen terminal:
with client.messages.stream(
model="claude-fable-5",
max_tokens=8192,
messages=[{"role": "user", "content": "Refactor the following 200-line "
"Python module into four testable units and return the "
"complete diff: ..."}],
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)
final = stream.get_final_message()
print(f"\nUsage: {final.usage.input_tokens} in / {final.usage.output_tokens} out")Pitfalls Worth Knowing
- 404 on claude-fable-5: either your API tier has not received the model yet — it rolls out region by region, so wait 24–48 hours — or your SDK is stale. Run
pip install -U anthropicfirst. - Truncated responses:
stop_reason: "max_tokens"means the budget cut the output mid-proof. Raisemax_tokens, or pass the truncated text back as an assistant message with a one-word "continue." - Safety routing: prompts touching cybersecurity or biology get routed to Opus 4.8 automatically, with a note in the response. That is by design, not a bug.
- Data retention: traffic on Mythos-class models is retained for 30 days — for safety monitoring only, not training. Privacy-sensitive organizations should factor this in.
How to Actually Get Good Results
- Start with small lemmas. Do not open with an unsolved problem. Formalize minor theorems already in Mathlib, close the generate-then-
lake buildloop, and only then raise the difficulty. - Decompose everything. Terence Tao learned this the hard way doing formalization with Claude Code: one giant task derails. Split into lemma 1, 2, 3, verify each — success rates climb sharply.
- Prompt caching is a budget essential. Long system prompts and tool definitions get resent on every call; wrap them in
cache_controland input cost drops to roughly 10%. - When a proof stalls, hunt for a counterexample. Asking Fable 5 to disprove first is one of its strongest plays — it is precisely how the Jacobian conjecture fell.
The Takeaway
Formal methods always promised a world where proofs were checked by machines rather than trusted to reviewers' patience. The bottleneck was never the verifier — it was the scarcity of people who could speak Lean fluently enough to feed it. That bottleneck just moved. State the theorem precisely, let the model draft, let the kernel judge: the whole discipline now fits in one API call and a lake build.
Start small, verify everything, and keep the counterexample play in your back pocket. Documentation lives at docs.anthropic.com, the Python SDK on GitHub, and Lean 4 with its Mathlib library at lean-lang.org.
