Home › Simulators › Claude API Simulator

AI engineering · simulator · runs in your browser

The Claude API, request and response

Every app built on a language model makes the same call: send a request, get a response. Change the request on the left and watch everything update: the code in Python, TypeScript and cURL, the JSON that travels over the wire, the response that comes back, the tokens it used and what it cost.

Nothing here calls the real API, and nothing is stored. Answers are canned for the four examples; token counts are estimates (about four characters per token); error wording is illustrative. The field names, response shapes, model IDs, prices and per-model rules follow the Claude API reference as of 31 October 2026.

The request

Price per million tokens: input / output.

Try: raise effort and watch output tokens; set max_tokens to 20; type gate as a stop sequence on the haiku; set a temperature on Opus 5.5; switch on the tool and ask about the weather.

What you send


What comes back


Every field, in plain words

In the request

modelWhich Claude model answers. It decides quality, speed and price per token.
max_tokensThe most tokens the reply may use, thinking included. Hit it and the reply is cut off with stop_reason max_tokens.
systemInstructions that frame the whole conversation: role, tone, rules. Sent once, applies to every turn.
messagesThe conversation so far, oldest first, alternating user and assistant. The API keeps no memory between calls: you send the history every time.
output_config.effortHow hard the model works: low, medium, high, xhigh, max. Higher means more thinking, better answers on hard problems, more output tokens.
thinkingCurrent models think before answering. display 'omitted' (the default) returns an empty thinking block; 'summarized' returns a readable summary. You pay for thinking either way.
temperatureRandomness in word choice. Removed or fixed on the newest models (sending another value is an error); allowed on older ones.
stop_sequencesText that ends the reply early if the model writes it. The sequence itself is not included.
toolsFunctions the model may ask you to run: a name, a description and a JSON schema for the input. The model never runs them itself.
tool_choiceauto lets the model decide; none forbids tools. Forcing a tool ('any' or a named tool) returns an error on Opus 5.5 and Sonnet 5.5.
streamSend the reply as a series of events while it is written, instead of one JSON at the end.

In the response

idA unique id for this message. Quote it when reporting a problem.
contentA list of blocks, not one string: thinking, text, tool_use. Always check each block's type.
thinking blockThe model's reasoning. Empty when display is omitted; the signature lets the API verify it when you send it back.
tool_use blockThe model asking you to run a tool: the tool's name, the input, and an id you must quote in your tool_result.
stop_reasonWhy it stopped: end_turn (finished), max_tokens (cut off), stop_sequence, tool_use (waiting for you), pause_turn, or refusal.
stop_sequenceWhich stop sequence ended the reply, or null.
usage.input_tokensTokens you sent: system, tools and the whole conversation. Billed at the input price.
usage.output_tokensTokens the model wrote, thinking included. Billed at the output price, usually 5 times input.
usage.cache_*Tokens written to or read from the prompt cache. Cache reads cost a fraction of normal input.

Five things the simulator shows

  1. The API has no memory. Every call carries the whole conversation. Turn 2 of the weather example sends the first question, the model's tool request and your tool result again.
  2. The reply is a list of blocks, not a string. Thinking, text and tool requests arrive as separate blocks. Code that reads content[0].text breaks the day a thinking block comes first.
  3. You pay for thinking, even when you can't see it. Raise effort and output tokens climb while the visible answer stays the same.
  4. Always check stop_reason. max_tokens means the answer was cut off; tool_use means the model is waiting for you; refusal means it declined. Treating every response as a finished answer is a classic bug.
  5. The model never runs tools. It asks; your code runs the tool and sends the result back. That loop is the core of every agent; the Agent Harness Simulator shows it in a full agent.

Next: the Agent Harness course builds a whole agent around this one call, and what one conversation costs works through the token bill.