Introduction
Claude Sonnet 4.5 is an Anthropic chat model served here on one OpenAI-compatible endpoint at /v1/chat/completions. It reads up to 198,000 tokens and replies in up to 64,000 - about three tokens in for every one out, which is the shape of a scene or a chapter: a character sheet and a transcript in, several thousand words of prose back.
The request takes temperature (0 to 1, default 1) and top_p; there is no reasoning-effort setting on this endpoint. Message content is text and images, up to 128 tool schemas fit in one call, and stream: true returns the opening line while the rest is still being written.
Key features & highlights
A window sized for one arc
198,000 tokens holds a character sheet, the rules of the world and a long transcript without a summarisation step every few turns. Keep whatever must not drift - voice, temperament, canon - in the system message and let the user message carry the scene.
64,000 tokens of reply
The reply ceiling is 64,000 tokens, so a chapter never stops mid-paragraph for lack of room. max_tokens defaults to 4,096, a few hundred words, so raise it when you want a scene written out in full.
Streaming for turn-taking
Roleplay is turn-taking, and someone is watching the cursor. With stream: true the reply arrives as Server-Sent Events chunks, so the first sentence can be on screen while the rest is still being generated.
Request parameters
| Parameter | Required | Description |
|---|---|---|
messages | Yes | Ordered conversation turns. Content is a string, or an array of text and |
max_tokens | No | Caps the reply at 64,000. The default of 4,096 is a few hundred words, so raise it when you want a scene written out in full. |
stop | No | Up to 4 sequences, as a string or an array. The reply ends as soon as the model writes one of them, and the matched text itself is left out. at least 1 characters · at least 1 items · at most 4 items |
temperature | No | 0 to 1, default 1. Hold it near 0 whenever the reply is parsed by code. |
top_k | No | 1 to 500. Samples only from the k most likely next tokens: 1 makes replies close to repeatable, larger values loosen the choice. |
top_p | No | 0.01 to 1. Adjust this or temperature, never both in the same comparison. |
tools | No | Up to 128 function definitions per request. at most 128 items |
parallel_tool_calls | No | true or false, default true: the model may request several tool calls in one turn. Default: |
tool_choice | No | auto, none, required, or an object naming one function. |
Pricing
Input $2.70 / Output $13.50 per 1 million tokens
Use cases
A long-running roleplay session
Character sheet and world rules stay in the system message while the transcript grows in the messages array. 198,000 tokens is a whole arc's worth of scenes, so the voice holds without being summarised back into shape.
One chapter of interactive fiction
Branching fiction is read-then-write: a few thousand tokens of state and history in, a scene of prose out. Three to one is exactly that shape, and the 64,000-token ceiling leaves room for the chapter to finish.
An ensemble of NPCs in one thread
Give each character a section of the system message and let the user message say who is on stage. Because every NPC is described in the same request, they stay consistent with one another and not only with themselves.
Prompt guide & pro tips
Put the character in the system message
Character sheet, voice and the rules of the world go in the system message; the scene goes in the user message. When you trim for length later, you trim the transcript and the character stays exactly as written.
Tune temperature to the task
Keep temperature near 1 for dialogue that should feel alive, and lower it for a continuity pass or a recap of what happened. top_p narrows word choice further when a scene has to hold a tight register.
Structured output and hard limits
There is no response_format here: define a tool whose parameters are the JSON schema you want, point tool_choice at it and validate the arguments that come back. max_tokens above 64,000 fails validation, and video and audio parts are rejected.
API quick start
curl --fail-with-body -sN https://api.spicyapi.ai/v1/chat/completions \
-H "Authorization: Bearer $SPICY_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "anthropic/claude-sonnet-4.5/chat",
"messages": [
{
"role": "user",
"content": "Summarise the following release notes into three bullet points."
}
],
"stream": true
}' \
| jq --unbuffered -Rrj 'select(startswith("data: ")) | .[6:] | select(. != "[DONE]") | fromjson | if .error then "\n[error] \(.error.message)\n" else (.choices[0].delta.content? // empty) end'
See the API reference for authentication, the complete schema, polling, and error handling.














