Plan a relaxed Saturday using these options: a park open 9am-6pm, a museum open 10am-5pm, and a cafe open 8am-8pm. Start at 10am, include a lunch break, and allow 30 minutes between stops. Return a timetable without inventing prices or opening hours.
Claude Sonnet 5 API: Online text generation, tutorials and integration guide
Connect to Claude Sonnet 5 in one click on RequestBeam. One API key connects AI and multiple data services, so you can focus on your business and explore new ideas.
Claude Sonnet 5 API pricing and billing
0-1M input tokens
Official price
- Input
-
$2.0000/M - Output
-
$10.0000/M - Cache input
-
$0.2000/M - Cache write (5m)
-
$2.5000/M - Cache write (1h)
-
$4.0000/M
Our price Save 45%
- Input
- $1.1000 /M
- Output
- $5.5000 /M
- Cache input
- $0.1100 /M
- Cache write (5m)
- $1.3750 /M
- Cache write (1h)
- $2.2000 /M
Claude Sonnet 5 online chat tool
Model settings
It includes completed, reusable turns from this conversation in your next request, so you can ask follow-up questions without repeating the context.
What happens when it is off?Only your new message and any system prompt are sent. Existing messages stay visible; turning memory back on includes eligible earlier turns again.
Is this long-term memory?No. This is conversation context, not memory across separate conversations. Failed, stopped, truncated, or non-reusable replies are excluded. More history can use more input tokens and increase cost.
Advanced parameters
Conversation

How can I help you today?
No response data yet Claude Sonnet 5 prompt examples
Draft a polite customer email for this situation: an order will arrive two days late, the revised delivery date is October 15, and tracking will be sent tomorrow. Apologize without inventing compensation. Include a subject line and keep the email under 120 words.
Turn these meeting notes into an action list: Maya will revise the proposal by Friday; Leo will confirm the venue next Monday; the budget needs approval, with no owner assigned. Use columns for task, owner, deadline, and open questions. Mark missing details as unknown.
What is Claude Sonnet 5
A Claude model for sustained coding and everyday knowledge work
We position Claude Sonnet 5 as a general-purpose model for everyday development and knowledge work, suitable for writing code, organizing information, and tasks that require multiple tool calls. Anthropic released this version on June 30, 2026, highlighting improvements in planning, sustained coding, tool use, and following through on subsequent steps. Anthropic's official announcement
A multimodal model with a million-token context and image input
The official Claude Sonnet 5 API offers a 1M-token context window and a standard maximum output of 128K tokens. It accepts text and image inputs and produces text output. Official model specifications
As a multimodal model, it has a much broader range of applications than a non-multimodal model, including OCR, frontend testing, VQA, and multimodal document parsing.
Adaptive thinking enabled by default, with five reasoning effort levels
Claude Sonnet 5 enables adaptive thinking by default. effort supports five levels: low, medium, high, xhigh, and max, with high as the official API default. This parameter adjusts reasoning effort, affecting answer quality, token consumption, and waiting time. Official Effort documentation · Sonnet 5 thinking settings
We recommend comparing medium and high on real business tasks first. For formatting or extracting short text, try lower levels as well; for coding tasks with multiple modules and constraints, start by testing high. As for xhigh and max, first check whether they reduce rework or solve problems that were previously out of reach before deciding to use them more broadly.
Claude Sonnet 5 online tools and API on RequestBeam
We hope you will try Claude Sonnet 5 on RequestBeam first to see whether it can handle the task in front of you. Sign in, create an API key, and add a small amount of credit to use the online tool without writing API integration code first. A short evaluation does not require a fixed subscription, and it saves you from registering and maintaining separate accounts across multiple model platforms.
Claude Sonnet 5 core capabilities and domain strengths
Project coding: implement features and make focused changes around a clear plan
We believe Claude Sonnet 5 can implement features, perform focused refactoring, or fix issues once the plan is clear. One customer told us that he generally used Sonnet for coordination and implementation, with Opus handling architecture and difficult problems. The project was ultimately completed, although he had to switch to Opus twice to keep going.
We think this division of work is worth considering: clarify interfaces, the scope of impact, and acceptance criteria before asking Sonnet 5 to begin. If an architectural change is needed, or the tests still fail after several rounds of changes, we recommend revisiting the plan and considering a different model. A lower unit price does not necessarily mean lower costs after repeated retries. Of course, this is only one customer's project, and we still recommend testing your actual business scenarios before switching to Sonnet 5.
Tool collaboration: recover from error feedback and continue execution
One of our customers shared his experience integrating an agent. According to him, Sonnet 5 could handle complex editing requirements in a single pass. After encountering an unclear error, it would call tools again to inspect the data structure, look for input problems, and attempt recovery. However, he also mentioned that the model once skipped another input it could not process without telling the user.
We believe that when using Sonnet 5, you need to check both the model's response and whether the data ultimately written is correct. Being fast does not mean the response meets your requirements.
Long-document analysis: work across specifications, code, and business materials
We use Sonnet 5's long context to cross-reference multiple sources: comparing versions of requirements, checking whether code follows interface agreements, or finding business conditions scattered across documents. In Artificial Analysis's AA-LCR v1.1 comparison, Sonnet 5 Max scores approximately 82%. This evaluation uses documents of roughly 10,000 to 100,000 tokens to assess whether models can extract information across passages, reason, and synthesize conclusions. Sonnet 5 long-document results · AA-LCR methodology
We recommend defining the question first, then organizing the input materials, and retaining file names, sections, and key quotations in the answer so that you can check whether it meets your requirements. When the input approaches a million tokens, we recommend separately checking for omissions. The 82% score comes from the document-length range described above. In actual business scenarios, however, we do not recommend inputs approaching a million tokens: in our own experience, this clearly affects output quality.
Business writing: turn established facts into explanations your readers can understand
One customer shared his use case with us: he uses Sonnet 5 in an API automation workflow to write customer emails and text messages, and to turn Git diffs into change summaries that nontechnical readers can understand. He rated these uses positively, particularly noting that the writing was readable and felt human, and that the model followed the system prompt's requirements.
We believe different business scenarios call for different standards of readability. Product updates, support ticket replies, and help documents tend to be less demanding in this respect. General articles or personal reflections, on the other hand, may require people to do most of the editing and refinement.
Interface development: use screenshots and design specifications to generate editable frontends
We would prioritize Sonnet 5 for modifying existing interfaces or building pages with clearly defined design requirements. Anthropic's prompting guide notes that overly open-ended frontend requests may lead the model to repeatedly use similar default visual styles. To get a different result, provide concrete design constraints that limit the model's improvisation. Official frontend prompting guidance
Feedback in our customer group is also mixed: some said that when they used Sonnet 5 to rebuild interfaces previously created with Sonnet 4.6, the visual results did not meet their expectations. Other customers, however, said Sonnet 5 performed quite well.
We therefore recommend providing page screenshots, component specifications, font requirements, and layout requirements together. Once the page is ready, check functionality, fidelity to the design, and how it displays on different screens separately. If the project already has a mature design system, we recommend reusing existing components and specifying the changes clearly rather than leaving the model to design and improvise from scratch.
Claude Sonnet 5 benchmarks and performance
Artificial Analysis's data uses the current v4.3.2 framework, and integer percentages from comparison pages are recorded as displayed. Task costs follow the evaluator's methodology and are not RequestBeam's actual charges; when calling through RequestBeam, charges depend on the selected service's prices and request usage.
Terminal tasks: approximately 14% in the independent Terminal-Bench 4.0 evaluation
- Sonnet 5 Max ~ 14%
- Sonnet 4.6 Max ~ 3%
In Artificial Analysis's like-for-like comparison, Sonnet 5 Max scores approximately 14% on Terminal-Bench 4.0, compared with approximately 3% for Sonnet 4.6 Max. The evaluation includes 66 terminal tasks, uses mini-swe-agent, repeats each task three times, and calculates the average single-attempt pass rate. A task counts as successful only when all its tests pass. Model score comparison · Terminal-Bench 4.0 methodology
We believe Sonnet 5 improves on the previous generation in this evaluation, but still cannot complete many difficult terminal tasks. We do not recommend Sonnet 5 for particularly complex tasks. When a task is clearly defined and broken into small units, however, Sonnet 5 may be a good choice.
Project coding: CursorBench 4.0 gains 3.3 percentage points from High to Max
- Sonnet 5 Medium 28.0%
- Sonnet 5 High 30.8%
- Sonnet 5 Max 34.1%
- Sonnet 5 Medium $2.31
- Sonnet 5 High $3.48
- Sonnet 5 Max $7.17
CursorBench 4.0 uses project tasks drawn from real development workflows. Some of the organizer's published Sonnet 5 results are shown below, with costs calculated from the corresponding tasks' token usage and public prices. Original CursorBench 4.0 leaderboard
| Thinking level | Score | Average cost per task |
|---|---|---|
| Medium | 28.0% | US$2.31 |
| High | 30.8% | US$3.48 |
| Max | 34.1% | US$7.17 |
We pay closer attention to the cost comparison between high and max: the score rises by 3.3 percentage points, but the average task cost more than doubles. We recommend comparing medium and high first for everyday development. If a problem repeatedly gets stuck in your scenario, we recommend using Opus 5.5 or Opus 5 to solve it rather than raising the thinking level further.
Knowledge work: 1465 Elo on GDPval-AA v2.1
- Sonnet 5 Max 1465
- Sonnet 4.6 Max 1234
In Artificial Analysis's GDPval-AA v2.1 comparison, Sonnet 5 Max scores 1465 Elo, versus 1234 Elo for Sonnet 4.6 Max. This evaluation uses 220 tasks spanning 44 occupations and 9 industries. Models work in a tool environment to submit deliverables such as documents, spreadsheets, and presentations, which are then scored through anonymous pairwise comparisons. Sonnet 5 and previous-generation results · GDPval-AA v2.1 methodology
We believe this result can help assess whether the model can produce documents, spreadsheets, and other files for other people to use. When evaluating report preparation, business analysis, or office assistants, we recommend giving it a complete task directly: did it use the necessary materials, are the numbers correct, can the files be opened, and can the intended readers use them?
Business automation: approximately 37% goal completion on AutomationBench-AA
- Sonnet 5 Max ~ 37%
- Sonnet 4.6 Max ~ 20%
In Artificial Analysis's comparison, Sonnet 5 Max scores approximately 37% on AutomationBench-AA, versus approximately 20% for Sonnet 4.6 Max. This evaluation covers 657 tasks performed in simulated business applications such as email, spreadsheets, and CRM systems. Model score comparison
The score first measures the proportion of goals completed in each task, then averages those proportions; a violation of task constraints receives a zero. Therefore, 37% does not mean that "37% of complete business workflows succeeded from start to finish." It also differs from the full-task completion rate on Zapier's own leaderboard, and the two measures must not be mixed. AutomationBench-AA scoring explanation
We recommend Sonnet 5 for business automation steps with clear, simple boundaries that require fast responses. If you need it to solve more complex problems, such as making decisions, we do not recommend Sonnet; you can use Opus 5.5 or Opus 5 instead.
Overall index and generation speed: a score of 38 and approximately 80.5 tokens per second
- Sonnet 5 Max 38
- Sonnet 5 Max ~ 80.5
- Sonnet 5 Max $5.09
Artificial Analysis's current model page gives Sonnet 5 Max a score of 38 on Intelligence Index v4.3.2 and measures Anthropic API output speed at approximately 80.5 tokens per second. The weighted average cost per task for the same index is US$5.09. Artificial Analysis model evaluation
For frequently used interactive features, we recommend trying lower thinking levels; comparing waiting time and output quality is essential. If the output at medium/high also fits your business scenario, I recommend using Sonnet 5.
Claude Sonnet 5 compared with Sonnet 4.6, GPT-6 Astra, and DeepSeek V4 Pro
Compared with Claude Sonnet 4.6: stronger capabilities, but higher task costs at Max
- Sonnet 5 Max 38
- Sonnet 4.6 Max 30
- Sonnet 5 Max $5.09
- Sonnet 4.6 Max $2.49
In Artificial Analysis's Max-configuration comparison, Sonnet 5 and Sonnet 4.6 score 38 and 30 on the overall index, with weighted average costs per task of US$5.09 and US$2.49, respectively. Their public input/output prices are US$2/US$10 and US$3/US$15 per million tokens, respectively. Sonnet 5 has lower per-token prices, but higher task costs in this evaluation. Sonnet 5 versus Sonnet 4.6
For teams still using Sonnet 4.6, we recommend first checking whether the upgrade improves tool collaboration and project execution, while readjusting thinking levels and output budgets. If Sonnet 5 can reliably complete tasks at medium or high, we do not think there is a need to keep using the highest level.
Compared with GPT-6 Astra: reevaluate complex engineering tasks using actual consumption
- Sonnet 5 Max 38
- GPT-6 Astra Max 53
- Sonnet 5 Max ~ 14%
- GPT-6 Astra Max ~ 59%
- Sonnet 5 Max $5.09
- GPT-6 Astra Max $3.26
In Artificial Analysis's Max-configuration comparison, GPT-6 Astra and Sonnet 5 score 53 and 38 on the overall index, with Terminal-Bench 4.0 scores of 59% and 14% after rounding as displayed on the page. Although Astra's per-token prices are higher, its weighted average cost per task in this overall evaluation is US$3.26, below Sonnet 5's US$5.09; its corresponding average output per task is also lower. GPT-6 Astra versus Sonnet 5
If your work mainly involves complex code changes, terminal operations, or engineering tasks requiring repeated verification, we recommend a close comparison with GPT-6 Astra. In our experience so far, GPT-6 Astra is a better choice than Sonnet 5 for complex engineering.
Compared with DeepSeek V4 Pro: a useful cost comparison for batch text tasks
- Sonnet 5 Max 38
- DeepSeek V4 Pro 0813 Max 36
- Sonnet 5 Max ~ 82%
- DeepSeek V4 Pro 0813 Max ~ 80%
- Sonnet 5 Max $5.09
- DeepSeek V4 Pro 0813 Max $0.67
In Artificial Analysis's Max-configuration comparison, DeepSeek V4 Pro 0813 and Sonnet 5 score 36 and 38 on the overall index, and approximately 80% and 82% on AA-LCR v1.1 long-document tasks; their weighted average costs per task are US$0.67 and US$5.09, respectively. Their input capabilities also differ: the DeepSeek V4 Pro evaluated here accepts text input, while Sonnet 5 supports text and image inputs. DeepSeek V4 Pro versus Sonnet 5
For organizing information, extracting text, and drafting in batches, we recommend including DeepSeek V4 Pro in your cost tests. If you want to test the multimodal capabilities of DeepSeek V4 PRO and Sonnet 5, we strongly recommend using real scenarios from your business. In customer feedback, some users found that Sonnet 5's multimodal capabilities did not meet their business requirements, while others said that DeepSeek V4 PRO was not capable enough to handle their work.
Claude Sonnet 5 API frequently asked questions
How do I call the Claude Sonnet 5 API through RequestBeam?
We recommend first signing in to RequestBeam and creating an API Key, then reading our documentation or asking AI to help you configure the connection.
We recommend completing a minimal generation test through the online tool first, then integrating according to RequestBeam's current Claude Sonnet 5 API documentation. This lets you verify whether the model meets your business needs before integration and helps avoid mistakenly carrying over endpoint paths and parameters from other providers into RequestBeam.
Why do old thinking or sampling parameters return 400 after migrating from Sonnet 4.6?
We recommend first checking thinking, budget_tokens, temperature, top_p, and top_k in your request. Sonnet 5 no longer supports the legacy thinking: {"type":"enabled","budget_tokens":N} format, and non-default sampling parameters also return 400. When migrating, we recommend removing these old settings and using output_config.effort to control reasoning effort instead. Sonnet 5 migration and parameter documentation
When thinking is omitted, Sonnet 5 enables adaptive thinking. If you really need to turn it off, set thinking: {"type":"disabled"}. We recommend explicitly setting effort according to your business needs, and controlling tone, formatting, and content scope through prompts and reference examples. Official thinking configuration
Why does a successful request have no answer text while output tokens still increase?
We recommend checking stop_reason and the returned content blocks first. Sonnet 5 does not display thinking text by default, so the thinking field may be empty even though thinking tokens still count toward output usage. When reading the answer, we recommend extracting text according to each content block's type rather than always reading content[0].text. Thinking display and billing explanation
Also check the output budget. max_tokens limits the combined output of thinking and answer text. With a high effort and a small budget, the model may reach the limit before finishing the answer. When you see stop_reason: "max_tokens", we recommend increasing the output budget or trying a lower thinking level, then checking whether the answer is complete. Sonnet 5 output budget documentation
Why does the task not continue after the model returns a tool call?
When using client-side tools, a model response with stop_reason: "tool_use" means it is waiting for the application to execute the tool and return the result. The application must first add the original assistant content to the message history, then return the execution result with tool_result. The tool_use_id must match the earlier call before you can request the model again. Official tool-use workflow
We recommend preserving all returned content blocks, particularly the relevant blocks and signatures when thinking is enabled, rather than retaining only the text visible to users. For integration testing, we recommend first completing one cycle of "request a tool, execute the operation, return the result, generate an answer" before expanding to multi-tool workflows. If tool execution fails, return the error information as well so that the model can adjust its next step. Thinking content block preservation requirements
Why use Claude Sonnet 5 through RequestBeam?
Usage-based billing and model cost optimization
Reliable service at prices lower than official rates. Top up on demand and use what you pay for.
Unified AI models and data APIs, with multi-model access in one place
One API key connects multiple AI models and data services, reducing integration costs and letting you switch with one click. Business applications need both AI and data.
Call logs and application access controls, with clarity on every call
Every API call is recorded in your dashboard. Create separate API keys for different applications.
Model capabilities without compromise
We do not water down our models. We cannot offer you the cheapest, but we are committed to offering you the best.
How to use Claude Sonnet 5 on RequestBeam
After creating an API key in the console, follow the documentation to get started with Claude Sonnet 5.
Prepare your account and test online
Sign in, confirm your balance, and create an API key.
Try it in the Playground
Explore the model's capabilities in the Playground to find the best way to use it.
Integrate Claude Sonnet 5 into your business
Follow our developer documentation to integrate Claude Sonnet 5 into your business.
Future model upgrades
When a new model is released, simply replace the model name with the new one to upgrade.
Claude Sonnet 5 RequestBeam API integration FAQ
Is Claude Sonnet 5 the same API model as Sonnet 4.6?
No. The API model name for Claude Sonnet 5 is claude-sonnet-5; the API model name for Claude Sonnet 4.6 is claude-sonnet-4-6. They are different models, so do not mix up their model parameters.
Why is thinking empty or the answer incomplete?
Native Sonnet 5 uses adaptive thinking by default and can omit thinking text. Empty thinking alone is not a failure. Disabling thinking requires the configuration supported by this model. For an incomplete answer, check the completion state and output allowance, leaving enough room for thinking and final text.
How should I troubleshoot authentication, balance, or access errors?
Follow the API error documentation to diagnose the issue.
Can I use OpenAI Responses for Claude Sonnet 5?
OpenAI Responses is not supported. Claude has its own Claude Messages format; see the documentation for details.
Can I force a tool call or edit a native Messages conversation?
Native Sonnet 5 supports forced tool_choice types any or tool with adaptive thinking. Follow the documentation for the interface you use. Take care when replaying preserved thinking after editing earlier messages. Keep native assistant content blocks and their signatures intact during tool continuations.
Is conversation memory permanent?
No. The API does not automatically retain conversation context for subsequent requests. Manage the history yourself and include the required context in each request. Long-term memory must be implemented by your application.
Related text APIs
Claude Sonnet 5 API specification and requests
Claude Sonnet 5 API quickstart
claude-sonnet-5Chat CompletionsPOST /v1/chat-completions
curl -X POST "https://api.requestbeam.com/v1/chat-completions" \
-H "Authorization: Bearer <API_KEY>" \
-H "Content-Type: application/json" \
-d '{"model":"claude-sonnet-5","messages":[{"role":"user","content":"Hello, introduce yourself in one sentence."}],"stream":false}'MessagesPOST /anthropic/v1/messages
Messages requires max_tokens. The allowance in this example is editable, not an upstream default or a model limit. Thinking may consume it before any answer text; adjust it for your task and check output costs.
curl -X POST "https://api.requestbeam.com/anthropic/v1/messages" \
-H "Authorization: Bearer <API_KEY>" \
-H "Content-Type: application/json" \
-H 'anthropic-version: 2023-06-01' \
-d '{"model":"claude-sonnet-5","max_tokens":4096,"messages":[{"role":"user","content":"Hello, introduce yourself in one sentence."}],"stream":false}'Family and protocol reference
Claude Messages
Full API documentationNative Claude Messages-compatible API. This endpoint uses Anthropic Messages request and response shapes, including tool calls and Anthropic SSE events.
https://api.requestbeam.com/anthropic/v1/messagesNative Claude Messages-compatible API. This endpoint uses Anthropic Messages request and response shapes, including tool calls and Anthropic SSE events.
POST https://api.requestbeam.com/anthropic/v1/messagesAuthentication
All requests require a RequestBeam API Key. Anthropic SDKs, Claude Code, and compatible clients usually use x-api-key; plain HTTP clients may also use Bearer Token authentication.
x-api-key: YOUR_REQUESTBEAM_API_KEY
anthropic-version: 2023-06-01Authorization: Bearer YOUR_REQUESTBEAM_API_KEY
anthropic-version: 2023-06-01Body
modelstringrequiredDefault: claude-sonnet-4-6Supported Claude model IDs.
claude-fable-5claude-fable-5-1claude-haiku-4-5claude-opus-4-5claude-opus-4-6claude-opus-4-7claude-opus-4-8claude-opus-5claude-opus-5-5claude-sonnet-4-5claude-sonnet-4-6claude-sonnet-5
Use GET https://api.requestbeam.com/v1/models for the models currently available to your API Key.
max_tokensintegerrequiredMaximum number of output tokens, as a positive safe integer. This budget includes both thinking and final text output tokens. Missing, zero, negative, fractional, string, or unsafe-integer values return HTTP 400 with invalid_request_error before generation or billing. The model may impose a lower maximum.
For models that produce thinking, a small budget such as 128 may yield only thinking blocks before ending with stop_reason: "max_tokens", without text output. Set an explicit budget for the task and the selected model, allowing room for thinking and the final answer. The values in the examples are editable allowances, not upstream defaults or model limits; larger allowances may increase output usage and cost.
messagesobject[]requiredConversation messages. Each message contains role and content.
role supports user and assistant. content may be a string or an array of content blocks.
systemstring | object[]System prompt. Anthropic Messages uses a top-level system field instead of a system role in messages.
streambooleanDefault: falseWhether to return Anthropic SSE events.
temperaturenumberSampling temperature. Accepted values and effects vary by the selected model.
top_pnumberNucleus sampling parameter. Acceptance does not guarantee that it changes generation behavior.
top_kintegerTop-k sampling parameter. Support depends on the selected model.
stop_sequencesstring[]Stop sequences.
Requests with nonempty stop sequences avoid model services known not to support them; if no compatible service is available, the request returns 400 before generation or billing.
toolsobject[]Anthropic tool definitions. Function tools usually include name, description, and input_schema.
tool_choiceobjectTool selection policy, such as { "type": "auto" } or { "type": "tool", "name": "..." }.
thinkingobjectNative Anthropic thinking configuration, subject to the selected model and provider's support. Claude 4.5 uses { "type": "enabled", "budget_tokens": 1024 }; Claude Sonnet/Opus 4.6 also support adaptive thinking. Do not apply a manual budget to every model version. In tool continuations, return the complete ordered assistant content, including thinking, signature, redacted_thinking and tool_use, unchanged. Keep the thinking configuration and required anthropic-beta headers consistent through the tool round trip. For SSE, concatenate signature_delta.signature fragments for the same content block; an empty thinking summary does not mean its signature can be discarded. A provider account access rejection is an upstream failure, not evidence of an invalid signature. Recognized Bedrock account access rejections return HTTP 502 with api_error; ordinary client validation errors retain HTTP 400. Acceptance still requires an enabled upstream account.
metadataobjectRequest metadata.
Prompt Caching
Add cache_control: { "type": "ephemeral" } to a system or message content block. Cache usage may include cache_creation_input_tokens, cache_read_input_tokens, and supported 5-minute or 1-hour creation buckets. A 1-hour TTL also requires the corresponding anthropic-beta header.
Request Examples
Non-Streaming
{
"model": "claude-sonnet-4-6",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello, introduce yourself in one sentence."
}
],
"stream": false
}Streaming
{
"model": "claude-haiku-4-5",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Reply exactly OK."
}
],
"stream": true
}Response
Non-streaming responses keep the Anthropic Message shape.
idstringResponse ID, such as msg_....
typestringObject type, usually message.
rolestringUsually assistant.
modelstringActual Claude model used.
contentobject[]Native output content blocks, including text, tool_use, and thinking when used.
stop_reasonstringStop reason, such as end_turn, max_tokens, stop_sequence, or tool_use.
usageobjectToken usage, including input_tokens and output_tokens. Cache token fields are included when present.
Success Example
{
"id": "msg_01...",
"type": "message",
"role": "assistant",
"model": "claude-sonnet-4-6",
"content": [
{
"type": "text",
"text": "Hello, I am Claude and can help with writing, coding, and analysis tasks."
}
],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 18,
"output_tokens": 24
}
}Streaming Response
When stream: true, the endpoint returns Anthropic SSE events. Common events include:
message_startcontent_block_startcontent_block_deltacontent_block_stoppingmessage_deltamessage_stop
Error Response
See Error Codes and Troubleshooting for the full code reference, protocol differences, and diagnostic steps.
Error responses use the Anthropic-style shape:
{
"type": "error",
"error": {
"type": "authentication_error",
"message": "Invalid credentials or API key has expired."
}
}