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
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
| model | Which Claude model answers. It decides quality, speed and price per token. |
| max_tokens | The most tokens the reply may use, thinking included. Hit it and the reply is cut off with stop_reason max_tokens. |
| system | Instructions that frame the whole conversation: role, tone, rules. Sent once, applies to every turn. |
| messages | The conversation so far, oldest first, alternating user and assistant. The API keeps no memory between calls: you send the history every time. |
| output_config.effort | How hard the model works: low, medium, high, xhigh, max. Higher means more thinking, better answers on hard problems, more output tokens. |
| thinking | Current models think before answering. display 'omitted' (the default) returns an empty thinking block; 'summarized' returns a readable summary. You pay for thinking either way. |
| temperature | Randomness in word choice. Removed or fixed on the newest models (sending another value is an error); allowed on older ones. |
| stop_sequences | Text that ends the reply early if the model writes it. The sequence itself is not included. |
| tools | Functions 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_choice | auto 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. |
| stream | Send the reply as a series of events while it is written, instead of one JSON at the end. |
In the response
| id | A unique id for this message. Quote it when reporting a problem. |
| content | A list of blocks, not one string: thinking, text, tool_use. Always check each block's type. |
| thinking block | The model's reasoning. Empty when display is omitted; the signature lets the API verify it when you send it back. |
| tool_use block | The model asking you to run a tool: the tool's name, the input, and an id you must quote in your tool_result. |
| stop_reason | Why it stopped: end_turn (finished), max_tokens (cut off), stop_sequence, tool_use (waiting for you), pause_turn, or refusal. |
| stop_sequence | Which stop sequence ended the reply, or null. |
| usage.input_tokens | Tokens you sent: system, tools and the whole conversation. Billed at the input price. |
| usage.output_tokens | Tokens 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
- 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.
- The reply is a list of blocks, not a string. Thinking, text and tool requests arrive as separate blocks. Code that reads
content[0].textbreaks the day a thinking block comes first. - You pay for thinking, even when you can't see it. Raise effort and output tokens climb while the visible answer stays the same.
- Always check stop_reason.
max_tokensmeans the answer was cut off;tool_usemeans the model is waiting for you;refusalmeans it declined. Treating every response as a finished answer is a classic bug. - 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.