mysticalcomputer.com

The Mystical
Computer

A developer's field guide to Claude.

Ten short chapters, from the first request to agents that work on their own. Written for builders, checked against Anthropic's documentation, and kept on one quiet page with no trackers, no cookies and nothing loaded from anywhere else.

BEGIN ↓

I

The Family

Four names, one temperament: pick by the weight of the work.

Claude comes in tiers. Each tier is the same idea at a different scale: how much it thinks, how fast it answers, what it costs. Every current model reads a one-million-token context and can write up to 128K tokens in one reply. The model ID is the whole string. Never add a date to it.

Fable 5.2

The deepest. For the hardest, longest work.

ID
claude-fable-5-2
Input
$8 / M tokens
Output
$40 / M tokens
THE DEFAULT

Opus 5.5

The one to reach for first.

ID
claude-opus-5-5
Input
$4 / M tokens
Output
$20 / M tokens

Sonnet 5.5

Speed and skill for everyday code and agents.

ID
claude-sonnet-5-5
Input
$2 / M tokens
Output
$10 / M tokens

Haiku 5.5

The quick one. High volume, low cost.

ID
claude-haiku-5-5
Input
$0.10 / M tokens
Output
$0.50 / M tokens

Prices are Anthropic's first-party API rates as of November 2026, per million tokens. Haiku 5.5's price applies to prompts up to 100K tokens; longer prompts cost more. Earlier models such as Opus 5, Sonnet 5 and the 4.x line are still served, and prices change, so check the documentation before you budget. Claude Mythos 5.2 matches Fable 5.2 and is open only to verified organizations.

How to choose

  • Start with Opus 5.5. It is the default for a reason. Lower its effort (Chapter III) before you reach for a smaller model. One model also means one prompt cache.
  • Sonnet 5.5 when you need lots of calls quickly: coding loops, agents, enterprise pipelines.
  • Haiku 5.5 for classification, routing, extraction, and as a cheap worker under a larger model.
  • Fable 5.2 when the problem is genuinely hard and long, and a turn that runs for minutes is acceptable.

II

First Contact

One endpoint. Everything else is a feature of it.

Every conversation with Claude goes through a single endpoint, POST /v1/messages. Tools, thinking, structured output and caching are all options on that one request. Use the official SDK for your language. Don't hand-roll HTTP unless you are in a shell script.

pip install anthropic
import anthropic

client = anthropic.Anthropic()  # reads ANTHROPIC_API_KEY from the environment

response = client.messages.create(
    model="claude-opus-5-5",
    max_tokens=16000,
    messages=[{"role": "user", "content": "What is the capital of France?"}],
)

# content is a list of blocks: text, thinking, tool_use... check the type first
for block in response.content:
    if block.type == "text":
        print(block.text)

Keys stay out of code

The client finds its credentials by itself: ANTHROPIC_API_KEY, or a login profile from Anthropic's ant command-line tool. Never commit a key, and never put one in a front-end page.

Read the stop reason

Check response.stop_reason before you trust the content. end_turn means the reply is finished and max_tokens means it was cut off. tool_use means Claude is waiting for your tool, and refusal means it declined.


III

Thinking & Effort

You don't set how long it thinks. You set how hard it tries.

Current models use adaptive thinking: Claude decides when to reason, and how much. The old fixed "thinking budget" (budget_tokens) is gone on the current models, and sending it returns an error. You steer with one setting, effort, which takes low, medium, high, xhigh or max.

PYTHON
response = client.messages.create(
    model="claude-opus-5-5",
    max_tokens=16000,
    thinking={"type": "adaptive", "display": "summarized"},  # show a readable summary
    output_config={"effort": "high"},  # low | medium | high | xhigh | max
    messages=[{"role": "user", "content": "Solve this step by step..."}],
)

for block in response.content:
    if block.type == "thinking":
        print("Thinking:", block.thinking)
    elif block.type == "text":
        print("Answer:", block.text)
  • Opus 5.5 defaults to medium, one step below most other models. Set effort explicitly so you always know what you are getting.
  • Thinking can't be turned off on Opus 5.5. To make it cheaper or faster, lower the effort. On Sonnet 5.5, {"type": "between_tools"} is the thinking-off mode.
  • The reasoning is hidden by default. Thinking blocks arrive with empty text unless you ask for "display": "summarized". If users watch the stream, turn that on, or the start of the reply looks like a long pause.
  • Which level when: low for chat and sub-tasks, high to xhigh for coding and long agent work, max only when correctness matters more than cost. Measure before you raise a default.

IV

Tools

Give it hands, and it reaches into the world.

You describe a function. Claude decides when to call it and returns a tool_use block with the arguments. You run the function and send back a tool_result, and the loop continues until Claude has its answer. The SDK's tool runner runs that loop for you.

PYTHON · TOOL RUNNER (BETA)
import anthropic
from anthropic import beta_tool

client = anthropic.Anthropic()

@beta_tool
def get_weather(location: str, unit: str = "celsius") -> str:
    """Get current weather for a location.

    Args:
        location: City and state, e.g., San Francisco, CA.
        unit: Temperature unit, either "celsius" or "fahrenheit".
    """
    return f"72°F and sunny in {location}"  # your real lookup goes here

runner = client.beta.messages.tool_runner(
    model="claude-opus-5-5",
    max_tokens=16000,
    tools=[get_weather],
    messages=[{"role": "user", "content": "What's the weather in Paris?"}],
)

for message in runner:  # one message per turn; stops when Claude is done
    print(message)

Tools Anthropic runs for you

ToolTypeWhat it does
Web searchweb_search_20260209Searches the web and cites what it found, filtering results as it goes
Web fetchweb_fetch_20260209Reads a page whose URL is already in the conversation
Code executioncode_execution_20260521Runs code in a sandbox Anthropic hosts
Tool searchtool_search_tool_bm25_20251119Lets Claude find the right tool among hundreds without loading them all
  • strict: true on a tool definition guarantees the arguments match its schema. The schema also needs additionalProperties: false and a required list.
  • Parallel calls: one reply can hold several tool_use blocks. Run them all, then send every result back in a single message. If a tool fails, return its result with is_error: true rather than dropping it.
  • Forcing a tool is gone on the newest models. tool_choice any or tool returns an error on Opus 5.5, Sonnet 5.5 and Fable 5.2. Use auto, name the tool in the prompt, and use structured outputs when all you need is JSON.
  • Parse tool input as JSON and never match against the raw string, because escaping differs between models.

V

Memory of the Machine

What it has read once, it need not read at full price again.

Prompt caching stores the start of your request, so the next request that begins the same way reads it at a fraction of the price and much faster. The match is a strict prefix: change one byte early on and everything after it is recomputed. Order is tools, then system, then messages. Put what never changes first and what always changes last.

PYTHON
response = client.messages.create(
    model="claude-opus-5-5",
    max_tokens=16000,
    cache_control={"type": "ephemeral"},  # cache everything up to the last block
    system="You are an expert on this large document...",
    messages=[{"role": "user", "content": "Summarize the key points"}],
)

# Proof it worked: this should be above zero on the second identical call
print(response.usage.cache_read_input_tokens)
  • Silent cache-breakers: a timestamp in the system prompt, JSON whose keys come out in a different order each time, or a tool list that changes between requests. If cache_read_input_tokens stays at zero, look for one of these.
  • Short prompts don't cache. There is a minimum length per model, and a shorter prefix just isn't cached, with no error.
  • Changing instructions mid-conversation: on current models you can add a {"role": "system"} message to messages instead of editing the top-level system prompt. The cached history stays valid.
  • Compaction (beta) summarizes old turns when a long conversation nears its limit. Append the whole response.content back each turn, not just the text, or the compaction state is lost.

VI

Form

Ask for a shape, and the answer arrives in it.

Structured outputs make the reply match a schema you give. In Python, describe the shape as a Pydantic model and the SDK returns a validated object. Without the SDK, put the schema in output_config.format; the older output_format parameter on create() is deprecated.

PYTHON
from pydantic import BaseModel

class ContactInfo(BaseModel):
    name: str
    email: str
    plan: str
    interests: list[str]
    demo_requested: bool

response = client.messages.parse(
    model="claude-opus-5-5",
    max_tokens=16000,
    messages=[{"role": "user", "content":
        "Extract: Jane Doe (jane@co.com) wants Enterprise, "
        "interested in API and SDKs, wants a demo."}],
    output_format=ContactInfo,
)

contact = response.parsed_output  # a validated ContactInfo
print(contact.name, contact.interests)

Prefill is gone. Ending the conversation with a half-written assistant reply to force a format now returns an error on current models. Use structured outputs or say what you want in the system prompt.


VII

Scale

When one request becomes ten thousand.

NeedReach forWhy
Lots of work, no hurryMessage BatchesRuns asynchronously at half the price. Results come back in any order, so match them by custom_id.
Same file, many requestsFiles APIUpload once and refer to it by file_id. Out of beta, no header needed.
Answers soonerFast modespeed: "fast" on Opus 5.5 gives up to 2.5× faster output at double the price.
An agent that knows its budgetTask budgets (beta)Claude sees a token countdown and finishes cleanly instead of being cut off.
Long repliesStreamingRequired for very large max_tokens. Use the SDK's final-message helper if you don't need each event.
What does it cost?Token countingPOST /v1/messages/count_tokens gives exact counts before you send.

Opus 5.5 can also run on Amazon Bedrock, Google Cloud and Microsoft Foundry through each platform's own SDK client. Features and prices vary by platform, so check before you rely on one.


VIII

Agents

Not one answer, but a sequence of choices.

An agent is Claude in a loop, choosing its own next tool call. Build one only when the job is truly open-ended, the result is worth the extra cost, and mistakes can be caught. A single call or a fixed workflow covers most things. When you do build one, the real question is who runs the loop and who hosts it.

ApproachYou writeRuns onChoose it when
Manual loopThe whole while stop_reason == "tool_use" loopYour serversYou want to control every step
Tool runnerJust the tool functionsYour serversYou host it but don't want to write the loop
Managed Agents (beta)An agent config, plus your own toolsAnthropic: the loop and a sandbox for each sessionLong-running, scheduled or multi-agent work, with nothing to host
Claude Agent SDKA prompt and optionsYour servers, with Claude Code's built-in toolsYou want a ready-made coding and file agent of your own

MCP: one plug for every tool

The Model Context Protocol is an open standard for connecting a model to tools and data: a database, a ticket tracker, your own API. Write an MCP server once and Claude Code, the Claude apps, the Agent SDK and the API's MCP connector can all use it.

The tool runner and the Agent SDK sound alike but are different packages. The tool runner lives in the regular anthropic SDK and only loops over tools you define. The Agent SDK is Claude Code packaged as a library. Its documentation is at code.claude.com.


IX

Claude Code

The model, given a terminal and the patience of a colleague.

Claude Code is Anthropic's agent for software work. It reads your repository, runs commands, edits files and opens pull requests, and asks first before anything you haven't allowed. It runs in the terminal, the desktop app on Mac and Windows, the web at claude.ai/code (where sessions run in a cloud container), and VS Code and JetBrains.

PartWhat it is
CLAUDE.mdThe project's memory. A file in the repository that every session reads first: how to build, what never to touch, where the traps are.
SkillsPackaged instructions for a recurring job, such as a review checklist or a deploy runbook, loaded when the task calls for them.
SubagentsHelpers with their own context for searches and side tasks, so the main conversation stays focused.
HooksYour own scripts, run by the harness before or after a tool call: format on save, block a dangerous command.
MCP serversYour tools and data, connected through the standard from Chapter VIII.
PluginsSkills, hooks, commands and servers bundled together and shared with a team.

Write CLAUDE.md as you would brief a sharp new colleague. Record what is true and what has gone wrong before. Skip the pep talk.


X

The Traps

Everyone falls into these once. Fall into them here instead.

  • Old habits that now fail: budget_tokens, assistant prefill, temperature (removed from the newest models), and forcing a tool with tool_choice. Each of these returns an error on the newest models.
  • Setting max_tokens too low cuts the reply off partway. Use about 16,000 without streaming and about 64,000 with it.
  • Watch for refusals. A declined request still returns HTTP 200, with stop_reason: "refusal". Check for it before you read the content. The newest models can retry on another model automatically (the beta fallbacks parameter).
  • Catching every error the same way. 429 and 5xx errors are worth retrying; 400 and 404 are not. Catch the SDK's specific error classes, most specific first.
  • Cutting input to make it fit. If a document is too long, chunk it or summarize it, and say so. Don't silently drop the end.
  • Building an agent too early. If you can write the steps down in advance, it's a workflow, and a workflow is cheaper, faster and easier to test.