Follow Discord
Sweep 22 Oct 2026 · 04:32Z Build v2.1.308 527 read Stable v2.1.308 Latest v2.1.308 Next v2.1.308 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One capture · api

One read of Claude Developer Platformapi-20261022T020713Z

168 pages moved out of 808 read.

Pages moved 168 significant first
Pages read 808 in this capture
Captured 02:07 UTC
Corpus hash f3f082ef7981 index-hash

What this read moved

26-50 of 168, page 2 of 7

This capture is too large to show at once. Changes 26-50 of 168 are below, significant first; the rest are on the following screens.

build-with-claude/claude-platform-on-aws Changed · +6 / -5 lines

from line 96
9696 Access to the Claude Console is federated through AWS IAM:
9797 
9898 1. Assume an IAM role with the `aws-external-anthropic:AssumeConsole` permission. See [Console access](https://platform.claude.com/docs/en/api/claude-platform-on-aws-iam-actions#console-access).
99 2. From the **Claude Platform on AWS** service page, choose **Open Claude Console**. The AWS Console issues a JWT and redirects you to `platform.claude.com`.
99 2. From the **Claude Platform on AWS** service page, click **Open Claude Console**. The AWS Console issues a JWT and redirects you to `platform.claude.com`.
100100 3. On first sign-in, you're prompted for an email address. Enter your work email. The platform provisions your Claude Console user just-in-time.
101101 
102102 When you're signed in through the AWS Console, the Claude Console scopes to your Claude Platform on AWS organization. An **Account managed by AWS** indicator appears in the bottom-left of the Claude Console sidebar.
from line 200
200200Generate API keys in the **AWS Console** under **Claude Platform on AWS → API keys**. Click **Generate a key**, then copy the key value. Grant the `aws-external-anthropic:CallWithBearerToken` IAM action to the principals that should be allowed to use API key authentication.
201201 
202202<Note>
203 API keys for Claude Platform on AWS are managed in the AWS Console, not the Claude Console. Keys created in the standard Claude Console at [platform.claude.com](https://platform.claude.com) (for first-party API access) don't work with the Claude Platform on AWS endpoint.
203 API keys for Claude Platform on AWS are managed in the AWS Console, not the Claude Console. Keys created in the standard Claude Console at [platform.claude.com](https://platform.claude.com/) (for first-party API access) don't work with the Claude Platform on AWS endpoint.
204204</Note>
205205 
206206#### Short-term API keys
from line 794
794794 
795795## Using the Claude Console
796796 
797Claude Platform on AWS uses the standard Claude Console at [platform.claude.com](https://platform.claude.com). When you sign in from the AWS Console, an **Account managed by AWS** indicator appears in the bottom-left of the Claude Console sidebar and the Console scopes to your Claude Platform on AWS organization. It provides usage analytics, cost breakdowns, rate limit visibility, workspace management, and pages for managing files, Agent Skills, batch jobs, and Claude Managed Agents resources (agents, sessions, environments, credential vaults, memory stores, and webhooks).
797Claude Platform on AWS uses the standard Claude Console at [platform.claude.com](https://platform.claude.com/). When you sign in from the AWS Console, an **Account managed by AWS** indicator appears in the bottom-left of the Claude Console sidebar, and the Console scopes to your Claude Platform on AWS organization. It provides usage analytics, cost breakdowns, rate limit visibility, workspace management, and pages for managing files, Agent Skills, batch jobs, and Claude Managed Agents resources (agents, sessions, environments, credential vaults, memory stores, and webhooks).
798798 
799799### Signing in
800800 
from line 805
8058053. Click **Open Claude Console**. The AWS Console issues a JWT and redirects you to `platform.claude.com`.
8068064. On first sign-in, you're prompted for an email address. Enter your work email. The platform provisions your Claude Console user just-in-time.
807807 
808Two Claude Console roles are available: **Admin** and **Developer**. The Admin role grants access to all Claude Console pages and settings available for Claude Platform on AWS. The Developer role grants read access to usage, cost, rate limit, and workspace information. Contact your Anthropic account representative to assign the Admin or Developer role to a principal.
808Two Claude Console roles are available: **Admin** and **Developer**. The Admin role grants access to all Claude Console pages and settings available for Claude Platform on AWS. The Developer role grants read access to usage, cost, request log, rate limit, and workspace information. Contact your Anthropic account representative to assign the Admin or Developer role to a principal.
809809 
810810### Available pages
811811 
from line 816
816816| **Usage** | Yes | No | View token usage by model, workspace, and dimension. Data can take a few minutes to appear after a request. |
817817| **Cost** | Yes | No | View cost breakdowns by model and workspace. AWS Cost Explorer shows the aggregated [Claude Consumption Unit (CCU)](https://platform.claude.com/docs/en/build-with-claude/claude-platform-on-aws#billing) line item. |
818818| **Rate limits** | Yes | No | View rate limits (read-only). Tier increases go through your Anthropic account representative; see [Rate limits and quotas](https://platform.claude.com/docs/en/build-with-claude/claude-platform-on-aws#rate-limits-and-quotas). |
819| **Logs** | Yes | No | View per-request metadata such as time, model, workspace, token counts, and status. Log entries do not include prompts or responses. |
819820| **Workspaces** | Yes | Yes (except spend limits) | View per-region workspaces. With the Admin role, you can also create, rename, and archive workspaces, and set per-workspace [spend limits](https://platform.claude.com/docs/en/build-with-claude/claude-platform-on-aws#spend-limits). |
820821| **Encryption keys** | Yes | Yes | A section of the [Data retention](https://platform.claude.com/settings/privacy#encryption-keys) page (`platform.claude.com/settings/privacy`) in the Claude Console, shown while **Organization** is selected in the dropdown menu at the top of the page. Register AWS KMS keys there (Admin role), as described in [Set up CMEK on Claude Platform on AWS](https://platform.claude.com/docs/en/manage-claude/cmek-claude-platform-on-aws). To attach a registered key to a workspace, select the workspace from that dropdown menu, then select the key under **Encryption key**. |
821822| **Files** | Yes | Yes | View and manage uploaded files. |
from line 1207
12061207## Additional resources
12071208 
12081209<CardGroup cols={2}>
1209 <Card title="Claude Console" icon="browser" href="https://platform.claude.com">
1210 <Card title="Claude Console" icon="browser" href="https://platform.claude.com/">
12101211 View usage, cost, and workspaces in the Claude Console. Sign in through the AWS Console.
12111212 </Card>
12121213 

build-with-claude/context-editing Changed · +4 / -4 lines

from line 1735
17351735 
17361736You can see which context edits were applied to your request using the `context_management` response field, along with helpful statistics about the content and input tokens cleared.
17371737 
1738```json Output
1738```text Output wrap
17391739{
17401740 "id": "msg_013Zva2CMHLNnXjNJJKqJ2EF",
17411741 "type": "message",
from line 1767
17671767 
17681768For streaming responses, the context edits are included in the final `message_delta` event:
17691769 
1770```json Streaming Response
1770```text Streaming Response wrap
17711771{
17721772 "type": "message_delta",
17731773 "delta": {
from line 2069
20692069 ```
20702070</CodeGroup>
20712071 
2072```json Output
2072```text Output wrap
20732073{
20742074 "input_tokens": 25000,
20752075 "context_management": {
from line 2798
27982798 
27992799For example, after a web search operation, the API response might show:
28002800 
2801```json Output
2801```text Output wrap
28022802{
28032803 "usage": {
28042804 "input_tokens": 63000,

build-with-claude/embeddings Changed · +5 / -5 lines

from line 8
88 
99When selecting an embeddings provider, there are several factors you can consider depending on your needs and preferences:
1010 
11* Dataset size and domain specificity: size of the model training dataset and its relevance to the domain you want to embed. Larger or more domain-specific data generally produces better in-domain embeddings
12* Inference performance: embedding lookup speed and end-to-end latency. This is a particularly important consideration for large-scale production deployments
13* Customization: options for continued training on private data, or specialization of models for very specific domains. This can improve performance on unique vocabularies
11* Dataset size and domain specificity: size of the model training dataset and its relevance to the domain you want to embed. Larger or more domain-specific data generally produces better in-domain embeddings.
12* Inference performance: embedding lookup speed and end-to-end latency. This is a particularly important consideration for large-scale production deployments.
13* Customization: options for continued training on private data, or specialization of models for very specific domains. This can improve performance on unique vocabularies.
1414 
1515## How to get embeddings with Anthropic
1616 
from line 88
8888 
8989For more detail, see [Voyage AI quick start](https://www.mongodb.com/docs/voyageai/quickstart/) in the MongoDB documentation.
9090 
91You can obtain the embeddings by either using the official [`voyageai` Python package](https://github.com/voyage-ai/voyageai-python) or HTTP requests, as described in the following sections. Voyage AI also has an official TypeScript client. To use it with a model API key from Atlas, set its `environment` option to `https://ai.mongodb.com/v1`, as described in [TypeScript client](https://www.mongodb.com/docs/voyageai/api-and-clients/#typescript-client) in the MongoDB documentation.
91You can obtain the embeddings by using either the official [`voyageai` Python package](https://github.com/voyage-ai/voyageai-python) or HTTP requests, as described in the following sections. Voyage AI also has an official TypeScript client. To use it with a model API key from Atlas, set its `environment` option to `https://ai.mongodb.com/v1`, as described in [TypeScript client](https://www.mongodb.com/docs/voyageai/api-and-clients/#typescript-client) in the MongoDB documentation.
9292 
9393### Voyage AI Python library
9494 
from line 142
142142 
143143The response is a JSON object containing the embeddings and the token usage:
144144 
145```json
145```text wrap
146146{
147147 "object": "list",
148148 "data": [

build-with-claude/fast-mode Changed · +3 / -3 lines

from line 222
222222 
223223Fast mode pricing stacks with other pricing modifiers:
224224 
225* [Prompt caching multipliers](https://platform.claude.com/docs/en/about-claude/pricing#prompt-caching) apply on top of fast mode pricing
226* [Data residency](https://platform.claude.com/docs/en/manage-claude/data-residency) multipliers apply on top of fast mode pricing
225* [Prompt caching multipliers](https://platform.claude.com/docs/en/about-claude/pricing#prompt-caching) apply on top of fast mode pricing.
226* [Data residency](https://platform.claude.com/docs/en/manage-claude/data-residency) multipliers apply on top of fast mode pricing.
227227 
228228For complete pricing details, see the [Pricing](https://platform.claude.com/docs/en/about-claude/pricing#fast-mode-pricing) page.
229229 
from line 373
373373 ```
374374</CodeGroup>
375375 
376```json Output
376```text Output wrap
377377{
378378 "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
379379 "type": "message",

build-with-claude/files Changed · +18 / -18 lines

from line 143
143143 
144144The response from uploading a file includes:
145145 
146```json Response
146```text Response wrap
147147{
148148 "id": "file_011CNha8iCJcU1wXNR6q4V8w",
149149 "type": "file",
from line 375
375375 
376376The Files API supports different file types that correspond to different content block types:
377377 
378| File type | MIME type | Content block type | Use case |
379| --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | ------------------ | ---------------------------------- |
380| PDF | `application/pdf` | `document` | Text analysis, document processing |
381| Plain text | `text/plain` | `document` | Text analysis, processing |
382| Images | `image/jpeg`, `image/png`, `image/gif`, `image/webp` | `image` | Image analysis, visual tasks |
383| [Datasets, others](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#upload-and-analyze-your-own-files) | Varies | `container_upload` | Data analysis, visualization |
378| File type | MIME type | Content block type | Use case |
379| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | ------------------ | ---------------------------------- |
380| PDF | `application/pdf` | `document` | Text analysis, document processing |
381| Plain text | `text/plain` | `document` | Text analysis, processing |
382| Images | `image/jpeg`, `image/png`, `image/gif`, `image/webp` | `image` | Image analysis, visual tasks |
383| Datasets, others (see [Upload and analyze your own files](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#upload-and-analyze-your-own-files)) | Varies | `container_upload` | Data analysis, visualization |
384384 
385385#### Document blocks
386386 
from line 415
415415 
416416#### Container upload blocks
417417 
418To send a file to the [code execution tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#upload-and-analyze-your-own-files), use the `container_upload` content block:
418To [send a file to the code execution tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#upload-and-analyze-your-own-files), use the `container_upload` content block:
419419 
420420```json
421421{
from line 426
426426 
427427### Working with other file formats
428428 
429For file types that the `document` block doesn't support (for example, .docx and .xlsx), convert the files to plain text and include the content directly in your message. Files that are already plain text, such as .csv and .md files, can either be read in this way or uploaded through the Files API with an explicit `text/plain` content type. To analyze datasets instead of reading them as text, upload them for the [code execution tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#upload-and-analyze-your-own-files) using a `container_upload` block.
429For file types that the `document` block doesn't support (for example, .docx and .xlsx), convert the files to plain text and include the content directly in your message. Files that are already plain text, such as .csv and .md files, can either be read in this way or uploaded through the Files API with an explicit `text/plain` content type. To analyze datasets instead of reading them as text, upload them for the code execution tool using a `container_upload` block (see [Upload and analyze your own files](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#upload-and-analyze-your-own-files)).
430430 
431431The following examples read a text file and send its contents as plain text:
432432 
from line 988
988988 
989989Common errors when using the Files API include:
990990 
991* **File not found (404):** The specified `file_id` doesn't exist or you don't have access to it
992* **Invalid file type (400):** The file type doesn't match the content block type (for example, using an image file in a document block)
993* **Not downloadable (400):** Files you upload have `"downloadable": false` and cannot be downloaded. Only files created by skills or the code execution tool can be downloaded
994* **Exceeds context window size (400):** The file is larger than the context window size (for example, using a 500 MB plain text file in a `/v1/messages` request)
995* **Invalid file name (400):** The file name doesn't meet the length requirements (1–255 characters) or contains forbidden characters (`<`, `>`, `:`, `"`, `|`, `?`, `*`, `\`, `/`, or Unicode characters 0–31)
996* **File too large (413):** File exceeds the 500 MB limit
997* **Storage limit exceeded (400):** Your organization has reached the 1 TB storage limit
991* **File not found (404):** The specified `file_id` doesn't exist or you don't have access to it.
992* **Invalid file type (400):** The file type doesn't match the content block type (for example, using an image file in a document block).
993* **Not downloadable (400):** Files you upload have `"downloadable": false` and cannot be downloaded. Only files created by skills or the code execution tool can be downloaded.
994* **Exceeds context window size (400):** The file is larger than the context window size (for example, using a 500 MB plain text file in a `/v1/messages` request).
995* **Invalid file name (400):** The file name doesn't meet the length requirements (1–255 characters) or contains forbidden characters (`<`, `>`, `:`, `"`, `|`, `?`, `*`, `\`, `/`, or Unicode characters 0–31).
996* **File too large (413):** The file exceeds the 500 MB limit.
997* **Storage limit exceeded (400):** Your organization has reached the 1 TB storage limit.
998998 
999```json Output
999```text Output wrap
10001000{
10011001 "type": "error",
10021002 "error": {

build-with-claude/handling-stop-reasons Changed · +3 / -3 lines

from line 24
2424 
2525The `stop_reason` field is part of every successful Messages API response. Unlike errors, which indicate failures in processing your request, `stop_reason` tells you why Claude completed its response generation.
2626 
27```json Example response
27```text Example response wrap
2828{
2929 "id": "msg_01234",
3030 "type": "message",
from line 1476
14761476 With [programmatic tool calling](https://platform.claude.com/docs/en/agents-and-tools/tool-use/programmatic-tool-calling), the same response shape means something different. The client `tool_use` block comes from code that is running in the `code_execution` tool rather than from Claude directly, and its `caller` field names the `code_execution` block that called it. That code has already started: it is paused waiting for your `tool_result` blocks, and sending them resumes the execution instead of starting a deferred tool. The `code_execution` block's own result block arrives once the code completes, which can take more than one round of tool results. The follow-up user message itself is the same in both cases; with programmatic tool calling, also pass back the `id` from the response's `container` field, as that page shows.
14771477</Note>
14781478 
1479```json A mixed tool_use response
1479```text A mixed tool_use response wrap
14801480{
14811481 "stop_reason": "tool_use",
14821482 "content": [
from line 2318
23182318 
23192319### Implement retry logic for pause\_turn
23202320 
2321When using [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools), the API might return `pause_turn` if the server-side sampling loop reaches its iteration limit (default 10). Handle this by continuing the conversation:
2321When you use [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools), the API might return `pause_turn` if the server-side sampling loop reaches its iteration limit (default 10). Handle this by continuing the conversation:
23222322 
23232323<CodeGroup exclude="shell">
23242324 ```python Python

build-with-claude/preserved-thinking Changed · +8 / -8 lines

from line 53
5353 
5454With the `thinking-binding-controls-2026-08-01` [beta header](https://platform.claude.com/docs/en/api/beta-headers), the response lists each dropped block in a top-level `input_transformations` array with `reason: "model_binding_mismatch"`:
5555 
56```json
56```text wrap
5757{
5858 "input_transformations": [
5959 {
from line 116
116116That setting requires the `thinking-binding-controls-2026-08-01` value in the `anthropic-beta` header.
117117```
118118 
119It usually ends with a sentence naming what changed, for example that the `system` prompt or the `tools` list differs from when the block was created. [Troubleshooting thinking](https://platform.claude.com/docs/en/build-with-claude/thinking-troubleshooting#error-thinking-block-signature) describes what that sentence can name.
119It usually ends with a sentence naming what changed, for example that the `system` prompt or the `tools` list differs from when the block was created. For what that sentence can name, see [A 400 error says a thinking block signature is invalid](https://platform.claude.com/docs/en/build-with-claude/thinking-troubleshooting#error-thinking-block-signature) in Troubleshooting thinking.
120120 
121121A tampered or undecryptable signature is a different failure. It always returns a 400 (``Invalid `signature` in `thinking` block`` with no sentence about the conversation), and `prefix_mismatch_behavior` doesn't apply to it.
122122 
from line 716
716716 
717717Log `input_transformations` on every turn of your own integration. When the API drops a block, the entry looks like the following:
718718 
719```json
719```text wrap
720720{
721721 "input_transformations": [
722722 {
from line 746
746746 
747747On an older account, you can also watch production traffic without opting into enforcement: send the beta header, leave `block_binding` out, and log `input_transformations`. Sending the header alone doesn't change what the model receives. Every thinking block that comes after the content you edited fails the check and gets its own `thinking_mismatch_allowed` entry, with the same `path` and `reason` fields as a `thinking_dropped` entry. Blocks before the edit still pass. An edit to `system` or `tools` comes before every block, so it fails every thinking block in the request. One entry looks like this:
748748 
749```json
749```text wrap
750750{
751751 "input_transformations": [
752752 {
from line 1107
11071107 
11081108### Send per-turn reminders as turn-scoped system messages
11091109 
1110A common prefix edit is the per-turn nudge: a line such as "request independent reads together" or "you haven't updated the user in a while" that your code appends after each batch of tool results. To keep reminders from piling up, send each nudge as a [mid-conversation system message](https://platform.claude.com/docs/en/build-with-claude/mid-conversation-system-messages) with `clear_at: "next_user_message"`, placed after the `tool_result` user message. `clear_at` requires the beta header `mid-conversation-system-clear-at-2026-08-21`. The following `messages` array is the request after two tool calls and their results. `messages[3]` is the previous request's nudge, left in place, and `messages[6]` is this request's copy:
1110A common prefix edit is the per-turn nudge: a line such as "request independent reads together" or "you haven't updated the user in a while" that your code appends after each batch of tool results. To keep reminders from piling up, send each nudge as a [mid-conversation system message](https://platform.claude.com/docs/en/build-with-claude/preserved-thinking#new-instructions) with `clear_at: "next_user_message"`, placed after the `tool_result` user message. `clear_at` requires the beta header `mid-conversation-system-clear-at-2026-08-21`. The following `messages` array is the request after two tool calls and their results. `messages[3]` is the previous request's nudge, left in place, and `messages[6]` is this request's copy:
11111111 
11121112```json
11131113[
from line 1165
11651165 
11661166You have two ways to use these blocks:
11671167 
1168* **Declare every tool up front.** Put every tool the session might need in `tools` on the first request, with `defer_loading: true` on any that shouldn't be offered to the model yet. Then turn tools on and off with `tool_addition` and `tool_removal` blocks that name them.
1168* **Declare every tool up front.** Put every tool the session might need in `tools` on the first request, with `defer_loading: true` on any that you don't want to offer to the model yet. Then turn tools on and off with `tool_addition` and `tool_removal` blocks that name them.
11691169* **Start with a snapshot and add tools as you go.** Put the tools you know about in `tools` on the first request. When you learn about another tool, define it inside a `tool_addition` block instead of editing `tools`.
11701170 
11711171Either way, `tools` never changes, so earlier thinking stays valid and the prompt cache still hits, with the one exception noted later in this section.
from line 1475
14751475 
14761476The response carries the new assistant turn as usual, plus one `input_transformations` entry for each dropped block. For the history in the diagram, that's the thinking on assistant turns 3 and 4:
14771477 
1478```json
1478```text wrap
14791479{
14801480 "input_transformations": [
14811481 {
from line 1544
15441544 </Accordion>
15451545 
15461546 <Accordion title="How do I handle instruction files such as AGENTS.md or CLAUDE.md that change mid-session?">
1547 Load them once at session start and keep the top-level `system` prompt and `tools` fixed. When a file changes, append the new version at that point in `messages` instead of editing the original. Use a [mid-conversation system message](https://platform.claude.com/docs/en/build-with-claude/mid-conversation-system-messages) for instructions that come from you as the operator. For file text you treat as untrusted, which shouldn't carry system-prompt authority, put the content in the next `user` turn instead. See [Add instructions with a mid-conversation system message](https://platform.claude.com/docs/en/build-with-claude/preserved-thinking#new-instructions) and [Limitations](https://platform.claude.com/docs/en/build-with-claude/mid-conversation-system-messages#limitations).
1547 Load them once at session start and keep the top-level `system` prompt and `tools` fixed. When a file changes, append the new version at that point in `messages` instead of editing the original. Use a mid-conversation system message for instructions that come from you as the operator. For file text you treat as untrusted, which shouldn't carry system-prompt authority, put the content in the next `user` turn instead. See [Add instructions with a mid-conversation system message](https://platform.claude.com/docs/en/build-with-claude/preserved-thinking#new-instructions) and [Limitations](https://platform.claude.com/docs/en/build-with-claude/mid-conversation-system-messages#limitations).
15481548 </Accordion>
15491549 
15501550 <Accordion title="Can I resume a saved session later, after a restart or the next day?">

build-with-claude/prompt-caching Changed · +4 / -4 lines

### Replacing the `max_tokens=1` workaround ### Replacing the max\_tokens=1 workaround

from line 819
819819 
820820The response includes detailed cache information like the following:
821821 
822```json Output
822```text Output wrap
823823{
824824 "usage": {
825825 "input_tokens": 2048,
from line 850
850850* When you want to improve your rate limit utilization, because cache hits are not deducted against your rate limit.
851851 
852852<Note>
853 The 5-minute and 1-hour cache behave the same with respect to latency. You generally see improved time-to-first-token for long documents.
853 The 5-minute and 1-hour caches behave the same with respect to latency. You generally see improved time-to-first-token for long documents.
854854</Note>
855855 
856856### Mixing different TTLs
from line 1088
10881088 
10891089The API returns an empty `content` array:
10901090 
1091```json Output
1091```text Output wrap
10921092{
10931093 "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
10941094 "type": "message",
from line 1522
15221522 
15231523`max_tokens: 0` is also rejected inside a [Message Batches](https://platform.claude.com/docs/en/build-with-claude/batch-processing) request. Pre-warming targets time-to-first-token, which does not apply to batch processing, and a cache entry written during batch processing would likely expire before the follow-up request runs.
15241524 
1525### Replacing the max\_tokens=1 workaround
1525### Replacing the `max_tokens=1` workaround
15261526 
15271527Before `max_tokens: 0` was available, some applications used `max_tokens: 1` warm-up calls to achieve the same effect. The `max_tokens: 0` approach is preferred: no output is produced, so there is no single-token reply to discard, no output tokens are billed, and the intent of the request is unambiguous.
15281528 

build-with-claude/prompt-engineering/prompting-claude-opus-4-8 Changed · +3 / -3 lines

from line 90
9090 
9191## Design and frontend defaults
9292 
93Claude Opus 4.8 has strong design instincts, with a consistent default house style: warm cream/off-white backgrounds (\~`#F4F1EA`), serif display type (Georgia, Fraunces, Playfair), italic word-accents, and a terracotta/amber accent. This reads well for editorial, hospitality, and portfolio briefs, but feels off for dashboards, dev tools, fintech, healthcare, or enterprise apps. The default appears in slide decks and web UIs.
93Claude Opus 4.8 has strong design instincts, with a consistent default house style: warm cream/off-white backgrounds (\~`#F4F1EA`), serif display type (Georgia, Fraunces, Playfair), italic word-accents, and a terracotta/amber accent. This reads well for editorial, hospitality, and portfolio briefs, but is a poor fit for dashboards, dev tools, fintech, healthcare, or enterprise apps. The default appears in slide decks and web UIs.
9494 
9595This default is persistent. Generic instructions ("don't use cream," "make it clean and minimal") tend to shift the model to a different fixed palette rather than producing variety. Two approaches work reliably:
9696 
from line 141
141141 
142142## Code review harnesses
143143 
144Claude Opus 4.8 is meaningfully better at finding bugs than prior models, and has both higher recall and precision in internal evals. However, if your code-review harness was tuned for an earlier model, you may initially see lower recall. This is likely a harness effect, not a capability regression. When a review prompt says things like "only report high-severity issues," "be conservative," or "don't nitpick," Claude Opus 4.8 may follow that instruction more faithfully than earlier models did: it may investigate the code just as thoroughly, identify the bugs, and then not report findings it determines to be below your stated bar. This can show up as the model doing the same depth of investigation but converting fewer investigations into reported findings, especially on lower-severity bugs. Precision typically rises, but measured recall can fall even though the model's underlying bug-finding ability has improved.
144Claude Opus 4.8 is meaningfully better at finding bugs than prior models, and has both higher recall and precision in internal evals. However, if your code-review harness was tuned for an earlier model, you might initially see lower recall. This is likely a harness effect, not a capability regression. When a review prompt says things such as "only report high-severity issues," "be conservative," or "don't nitpick," Claude Opus 4.8 might follow that instruction more faithfully than earlier models did: it might investigate the code just as thoroughly, identify the bugs, and then not report findings it determines to be below your stated bar. This can show up as the model doing the same depth of investigation but converting fewer investigations into reported findings, especially on lower-severity bugs. Precision typically rises, but measured recall can fall even though the model's underlying bug-finding ability has improved.
145145 
146146Some recommended prompt language:
147147 
from line 151
151151 
152152This prompt can be used without having an actual second step, but moving confidence filtering out of the finding step often helps. If your harness has a separate verification, deduplication, or ranking stage, tell the model explicitly that its job at the finding stage is coverage rather than filtering.
153153 
154If you do want the model to self-filter in a single pass, be concrete about where the bar is rather than using qualitative terms such as "important": for example, "report any bugs that could cause incorrect behavior, a test failure, or a misleading result; only omit nits like pure style or naming preferences."
154If you do want the model to self-filter in a single pass, be concrete about what the reporting threshold is rather than using qualitative terms such as "important": for example, "report any bugs that could cause incorrect behavior, a test failure, or a misleading result; only omit nits like pure style or naming preferences."
155155 
156156Iterate on prompts against a subset of your evals or test cases to validate recall or F1 score gains.
157157 

build-with-claude/prompt-engineering/prompting-claude-sonnet-5 Changed · +3 / -3 lines

from line 82
8282 
8383## Design and frontend defaults
8484 
85Claude Sonnet 5 might settle into a consistent default visual style on open-ended frontend and design briefs. A default house style can read well for some briefs but feel off for dashboards, dev tools, fintech, healthcare, or enterprise apps.
85Claude Sonnet 5 might settle into a consistent default visual style on open-ended frontend and design briefs. A default house style can read well for some briefs but be a poor fit for dashboards, dev tools, fintech, healthcare, or enterprise apps.
8686 
8787Generic instructions ("don't use that color," "make it clean and minimal") tend to shift the model to a different fixed palette rather than producing variety. Two approaches work reliably:
8888 
from line 133
133133 
134134## Code review harnesses
135135 
136If your code-review harness was tuned for an earlier model, you may initially see lower recall on Claude Sonnet 5. This is likely a harness effect, not a capability regression. When a review prompt says things like "only report high-severity issues," "be conservative," or "don't nitpick," Claude Sonnet 5 may follow that instruction more faithfully than earlier models did: it may investigate the code just as thoroughly, identify the bugs, and then not report findings it determines to be below your stated bar. This can show up as the model doing the same depth of investigation but converting fewer investigations into reported findings, especially on lower-severity bugs. Precision typically rises, but measured recall can fall even though the model's underlying bug-finding ability has improved.
136If your code-review harness was tuned for an earlier model, you might initially see lower recall on Claude Sonnet 5. This is likely a harness effect, not a capability regression. When a review prompt says things such as "only report high-severity issues," "be conservative," or "don't nitpick," Claude Sonnet 5 might follow that instruction more faithfully than earlier models did: it might investigate the code just as thoroughly, identify the bugs, and then not report findings it determines to be below your stated bar. This can show up as the model doing the same depth of investigation but converting fewer investigations into reported findings, especially on lower-severity bugs. Precision typically rises, but measured recall can fall even though the model's underlying bug-finding ability has improved.
137137 
138138Some recommended prompt language:
139139 
from line 143
143143 
144144This prompt can be used without having an actual second step, but moving confidence filtering out of the finding step often helps. If your harness has a separate verification, deduplication, or ranking stage, tell the model explicitly that its job at the finding stage is coverage rather than filtering.
145145 
146If you do want the model to self-filter in a single pass, be concrete about where the bar is rather than using qualitative terms such as "important": for example, "report any bugs that could cause incorrect behavior, a test failure, or a misleading result; only omit nits like pure style or naming preferences."
146If you do want the model to self-filter in a single pass, be concrete about what the reporting threshold is rather than using qualitative terms such as "important": for example, "report any bugs that could cause incorrect behavior, a test failure, or a misleading result; only omit nits like pure style or naming preferences."
147147 
148148Iterate on prompts against a subset of your evals or test cases to validate recall or F1 score gains.
149149 

build-with-claude/refusals-and-fallback Changed · +4 / -4 lines

from line 152
152152 
153153A refusal is a successful HTTP 200 response with `stop_reason: "refusal"`:
154154 
155```json
155```text
156156{
157157 "id": "msg_01XFUDYJgAACzvnptvVoYEL",
158158 "type": "message",
from line 645
645645 
646646On a refusal before any output, the `fallback` block is the first content block. For example, when default routing selects Claude Opus 4.8 for the refusal's category:
647647 
648```json
648```text wrap
649649{
650650 "id": "msg_01XFUDYJgAACzvnptvVoYEL",
651651 "type": "message",
from line 756
756756 
757757### Setting it up
758758 
759Pass `BetaRefusalFallbackMiddleware` (typescript: `betaRefusalFallbackMiddleware`; go: `betafallback.BetaRefusalFallbackMiddleware`; csharp: `BetaRefusalFallbackHandler`; java: `BetaRefusalFallbackInterceptor`; php: `RefusalFallbackMiddleware`) to the client constructor, and share one `BetaFallbackState` instance across the requests of a conversation.
759Pass `BetaRefusalFallbackMiddleware` (typescript: `betaRefusalFallbackMiddleware`; go: `betafallback.BetaRefusalFallbackMiddleware`; csharp: `BetaRefusalFallbackHandler`; java: `BetaRefusalFallbackInterceptor`; php: `RefusalFallbackMiddleware`) to the client constructor, and share one `BetaFallbackState` (go: `betafallback.BetaFallbackState`) instance across the requests of a conversation.
760760 
761761<CodeGroup exclude="shell">
762762 <CodeGroupItem language="cURL">
from line 1102
11021102* When every model in the list has declined, the middleware returns the final refusal (the last model's refusal response) rather than raising an error.
11031103* Thinking blocks from Claude Fable 5.1, Claude Opus 5.5, Claude Sonnet 5.5, Claude Haiku 5.5, or Claude Fable 5 pass through unchanged. Each retry re-sends your original request body, and the only blocks the middleware removes from conversation history on later requests are the `fallback` boundary blocks it added itself. The fallback model can't read Claude Fable 5.1 blocks, which only [Claude Fable 5.1 and Claude Mythos 5.1 read](https://platform.claude.com/docs/en/build-with-claude/thinking#preserved-for-model), so the API drops them. The API also drops Claude Opus 5.5 blocks for every fallback model except Claude Fable 5.1 and Claude Mythos 5.1 (see [Switching models mid-conversation](https://platform.claude.com/docs/en/build-with-claude/preserved-thinking#switching-models)). It drops Claude Sonnet 5.5 blocks too, for every fallback model except Claude Opus 5.5 on the Claude API and Google Cloud. Claude Opus 5.5 and Claude Sonnet 5.5 read Claude Haiku 5.5 blocks on the Claude API and Google Cloud, and the API drops them for a fallback model that can't read them.
11041104* Responses served through the middleware include a `fallback` content block at each model boundary, the same as server-side fallback responses. The middleware manages those blocks for you on later requests.
1105* The model that accepted is recorded in `BetaFallbackState`, so follow-up requests that share the state stay pinned to it rather than re-asking a model that refused.
1105* The model that accepted is recorded in `BetaFallbackState` (go: `betafallback.BetaFallbackState`), so follow-up requests that share the state stay pinned to it rather than re-asking a model that refused.
11061106 
11071107<Note>
11081108 The middleware and the server-side `fallbacks` parameter do the same job. Configure one or the other, never both on the same request. To send a server-side `fallbacks` request from an application that installs the middleware, use a separate client instance without it.

build-with-claude/search-results Changed · +3 / -3 lines

from line 1171
11711171 
11721172Regardless of how search results are provided, Claude automatically includes citations when using information from them:
11731173 
1174```json
1174```text
11751175{
11761176 "role": "assistant",
11771177 "content": [
from line 1258
12581258 
12591259A citation referencing the rate limits block looks like:
12601260 
1261```json
1261```text wrap
12621262{
12631263 "type": "search_result_location",
12641264 "cited_text": "Rate Limits: The API allows 1000 requests per hour per key.",
from line 1993
19931993 
19941994The response cites both sources. The pre-fetched result is `search_result_index: 0` and the tool-returned result is `search_result_index: 1`, matching the order the `search_result` blocks appear in the conversation:
19951995 
1996```json
1996```text
19971997{
19981998 "role": "assistant",
19991999 "content": [

build-with-claude/streaming Changed · +10 / -10 lines

from line 309
309309 
310310The API might occasionally send [errors](https://platform.claude.com/docs/en/api/errors) in the event stream. For example, during periods of high usage, you might receive an `overloaded_error`, which would normally correspond to an HTTP 529 in a non-streaming context:
311311 
312```sse Example error
312```text Example error
313313event: error
314314data: {"type": "error", "error": {"type": "overloaded_error", "message": "Overloaded"}}
315315```
from line 326
326326 
327327A `text` content block delta looks like:
328328 
329```sse Text delta
329```text Text delta
330330event: content_block_delta
331331data: {"type": "content_block_delta","index": 0,"delta": {"type": "text_delta", "text": "ello frien"}}
332332```
from line 339
339339 
340340A `tool_use` content block delta looks like:
341341 
342```sse Input JSON delta
342```text Input JSON delta
343343event: content_block_delta
344344data: {"type": "content_block_delta","index": 1,"delta": {"type": "input_json_delta","partial_json": "{\"location\": \"San Fra"}}}
345345```
from line 348
348348 
349349### Thinking delta
350350 
351When using [thinking](https://platform.claude.com/docs/en/build-with-claude/thinking#streaming-thinking) with streaming enabled, you'll receive thinking content through `thinking_delta` events. These deltas correspond to the `thinking` field of the `thinking` content blocks.
351When using [thinking with streaming enabled](https://platform.claude.com/docs/en/build-with-claude/thinking#streaming-thinking), you'll receive thinking content through `thinking_delta` events. These deltas correspond to the `thinking` field of the `thinking` content blocks.
352352 
353353For thinking content, a special `signature_delta` event is sent just before the `content_block_stop` event. This signature is used to verify the integrity of the thinking block.
354354 
from line 356
356356 
357357A typical thinking delta looks like:
358358 
359```sse Thinking delta
359```text Thinking delta
360360event: content_block_delta
361361data: {"type": "content_block_delta", "index": 0, "delta": {"type": "thinking_delta", "thinking": "I need to find the GCD of 1071 and 462 using the Euclidean algorithm.\n\n1071 = 2 × 462 + 147"}}
362362```
from line 363
363363 
364364The signature delta looks like:
365365 
366```sse Signature delta
366```text Signature delta
367367event: content_block_delta
368368data: {"type": "content_block_delta", "index": 0, "delta": {"type": "signature_delta", "signature": "EqQBCgIYAhIM1gbcDa9GJwZA2b3hGgxBdjrkzLoky3dl1pkiMOYds..."}}
369369```
from line 530
530530 ```
531531</CodeGroup>
532532 
533```sse Response
533```text Response
534534event: message_start
535535data: {"type": "message_start", "message": {"id": "msg_1nZdL29xx5MUA1yADyHTEsnR8uuvGzszyY", "type": "message", "role": "assistant", "content": [], "model": "claude-opus-5-5", "stop_reason": null, "stop_sequence": null, "usage": {"input_tokens": 25, "output_tokens": 1}}}
536536 
from line 872
872872 ```
873873</CodeGroup>
874874 
875```sse Response
875```text Response
876876event: message_start
877877data: {"type":"message_start","message":{"id":"msg_014p7gG3wDgGV9EUtLvnow3U","type":"message","role":"assistant","model":"claude-opus-5","stop_sequence":null,"usage":{"input_tokens":472,"output_tokens":2},"content":[],"stop_reason":null}}
878878 
from line 1165
11651165 ```
11661166</CodeGroup>
11671167 
1168```sse Response
1168```text Response
11691169event: message_start
11701170data: {"type": "message_start", "message": {"id": "msg_01...", "type": "message", "role": "assistant", "content": [], "model": "claude-opus-5-5", "stop_reason": null, "stop_sequence": null}}
11711171 
from line 1396
13961396 ```
13971397</CodeGroup>
13981398 
1399```sse Response
1399```text Response
14001400event: message_start
14011401data: {"type":"message_start","message":{"id":"msg_01G...","type":"message","role":"assistant","model":"claude-opus-5-5","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2679,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":3}}}
14021402 

build-with-claude/structured-outputs Changed · +14 / -20 lines

from line 110
110110 
111111 Claude returns JSON like this in the response's text content block:
112112 
113 ```json Output
113 ```text Output wrap
114114 {
115115 "name": "John Smith",
116116 "email": "[email protected]",
from line 148
148148 
149149 Claude returns JSON like this in the response's text content block:
150150 
151 ```json Output
151 ```text Output wrap
152152 {
153153 "name": "John Smith",
154154 "email": "[email protected]",
from line 788
788788 
789789 Claude returns JSON like this in the response's text content block:
790790 
791 ```json Output
791 ```text Output wrap
792792 {
793793 "name": "John Smith",
794794 "email": "[email protected]",
from line 826
826826 
827827 Claude returns JSON like this in the response's text content block:
828828 
829 ```json Output
829 ```text Output wrap
830830 {
831831 "name": "John Smith",
832832 "email": "[email protected]",
from line 2594
25942594Structured outputs use constrained sampling with compiled grammar artifacts. This introduces some performance characteristics to be aware of:
25952595 
25962596* **First request latency:** The first time you use a specific schema, there is additional latency while the grammar compiles.
2597 
25982597* **Automatic caching:** Compiled grammars are cached for 24 hours from last use, making subsequent requests much faster.
2598* **Cache invalidation:** The cache is invalidated if you change the JSON schema structure or, when using both structured outputs and tool use, the set of tools in your request. Changing only `name` or `description` fields does not invalidate the cache.
25992599 
2600* **Cache invalidation:** The cache is invalidated if you change:
2601 
2602 * The JSON schema structure
2603 * The set of tools in your request (when using both structured outputs and tool use)
2604 * Changing only `name` or `description` fields does not invalidate the cache
2605 
26062600### Prompt modification and token costs
26072601 
26082602When using structured outputs, Claude automatically receives an additional system prompt explaining the expected output format. This means:
from line 2703
27092703 
27102704Claude maintains its safety and helpfulness properties even when using structured outputs. If Claude refuses a request for safety reasons:
27112705 
2712* The response has `stop_reason: "refusal"`
2713* You'll receive a 200 status code
2714* You'll be billed for the tokens generated
2715* The output might not match your schema because the refusal message takes precedence over schema constraints
2706* The response has `stop_reason: "refusal"`.
2707* You'll receive a 200 status code.
2708* You'll be billed for the tokens generated.
2709* The output might not match your schema because the refusal message takes precedence over schema constraints.
27162710 
27172711A property that asks for the model's thinking or step-by-step reasoning might lead to a `reasoning_extraction` refusal. Ask for a short explanation instead. See [Keep reasoning in thinking blocks](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback#keep-reasoning-in-thinking-blocks).
27182712 
from line 2714
27202714 
27212715If the response is cut off because it reached the `max_tokens` limit:
27222716 
2723* The response has `stop_reason: "max_tokens"`
2724* The output might be incomplete and not match your schema
2725* Retry with a higher `max_tokens` value to get the complete structured output
2717* The response has `stop_reason: "max_tokens"`.
2718* The output might be incomplete and not match your schema.
2719* Retry with a higher `max_tokens` value to get the complete structured output.
27262720 
27272721**Enum value casing**
27282722 
from line 2794
28002794 
28012795**Incompatible with:**
28022796 
2803* **[Citations](https://platform.claude.com/docs/en/build-with-claude/citations):** Citations require interleaving citation blocks with text, which conflicts with strict JSON schema constraints. Returns 400 error if citations enabled with `output_config.format`.
2804* **Message prefilling:** Incompatible with JSON outputs
2797* **[Citations](https://platform.claude.com/docs/en/build-with-claude/citations):** Citations require interleaving citation blocks with text, which conflicts with strict JSON schema constraints. The API returns a 400 error if citations are enabled with `output_config.format`.
2798* **Message prefilling:** Prefilling is incompatible with JSON outputs.
28052799 
28062800<Tip>
28072801 **Grammar scope:** Grammars apply only to Claude's direct output, not to tool use calls, tool results, or thinking tags (when using [thinking](https://platform.claude.com/docs/en/build-with-claude/thinking)). Grammar state resets between sections, allowing Claude to think freely while still producing structured output in the final response.

build-with-claude/task-budgets Changed · +3 / -3 lines

from line 312
312312 
313313Claude thinks, then emits a tool call and stops with `stop_reason: "tool_use"`:
314314 
315```json
315```text
316316{
317317 "role": "assistant",
318318 "content": [
from line 502
502502Because `task_budget` spans the full agentic loop (potentially many requests) whereas `max_tokens` caps each individual request, the two values are independent; one is not required to be at or below the other.
503503 
504504<Warning>
505 **A budget that is too small for the task can cause refusal-like behavior.** When Claude sees a budget that is clearly insufficient for the work being asked (for example, a 20,000-token budget for a multihour agentic coding task), it might decline to attempt the task at all, scope it down aggressively, or stop early with a partial result rather than start work it cannot complete. If you observe unexpected refusals or premature stops after setting a budget, raise the budget before debugging other parameters. Size budgets against your actual task-length distribution rather than a fixed default; see [Choosing a budget](https://platform.claude.com/docs/en/build-with-claude/task-budgets#choosing-a-budget).
505 **A budget that is too small for the task can cause refusal-like behavior.** When Claude receives a budget that is clearly insufficient for the work being asked (for example, a 20,000-token budget for a multihour agentic coding task), it might decline to attempt the task at all, scope it down aggressively, or stop early with a partial result rather than start work it cannot complete. If you observe unexpected refusals or premature stops after setting a budget, raise the budget before debugging other parameters. Size budgets against your actual task-length distribution rather than a fixed default; see [Choosing a budget](https://platform.claude.com/docs/en/build-with-claude/task-budgets#choosing-a-budget).
506506</Warning>
507507 
508508## Choosing a budget
from line 688
688688 Let Claude determine when and how much to use extended thinking.
689689 </Card>
690690 
691 <Card title="Compaction" icon="arrows-clockwise" href="https://platform.claude.com/docs/en/build-with-claude/compaction">
691 <Card title="Compaction overview" icon="arrows-clockwise" href="https://platform.claude.com/docs/en/build-with-claude/compaction">
692692 Manage context in long-running conversations with server-side compaction.
693693 </Card>
694694 

build-with-claude/thinking Changed · +10 / -10 lines

from line 24
2424 
2525Here is what up-front thinking looks like in a response: one or more `thinking` content blocks arrive before the `text` blocks. The thinking block is still generated content, like the `text` block that follows it, but it is separated from the canonical response. Each thinking block also carries a `signature` field, an encrypted copy of the full reasoning that you pass back unchanged in multi-turn and tool-use conversations (see [Thinking encryption](https://platform.claude.com/docs/en/build-with-claude/thinking#thinking-encryption)):
2626 
27```json
27```text
2828{
2929 "content": [
3030 {
from line 481
481481 
482482With `display: "omitted"`, the response contains `thinking` blocks with an empty `thinking` field:
483483 
484```json Output
484```text Output wrap
485485{
486486 "content": [
487487 {
from line 798
798798To reassemble complete thinking blocks with their signatures after streaming, use your SDK's message-accumulation helper, `stream.get_final_message()` (typescript: `stream.finalMessage()`; ruby: `stream.accumulated_message`; csharp: `.Aggregate()`; go: `message.Accumulate(event)`; java, php: `MessageAccumulator`), instead of concatenating deltas yourself.
799799 
800800<Accordion title="Full streaming event trace">
801 ```sse Output
801 ```text Output
802802 event: message_start
803803 data: {"type": "message_start", "message": {"id": "msg_01...", "type": "message", "role": "assistant", "content": [], "model": "claude-opus-5-5", "stop_reason": null, "stop_sequence": null}}
804804 
from line 840
840840 
841841When `display: "omitted"` is set, the thinking block opens, a `thinking_delta` with an empty `thinking` string arrives, a single `signature_delta` follows, and the block closes. Text streaming starts immediately after:
842842 
843```sse Output
843```text Output
844844event: content_block_start
845845data: {"type":"content_block_start","index":0,"content_block":{"type":"thinking","thinking":"","signature":""}}
846846 
from line 859
859859 
860860With `display: "updates"` (beta), reasoning blocks stream as they do under `"omitted"`. Each [progress-update block](https://platform.claude.com/docs/en/build-with-claude/thinking#progress-updates) streams its text as `thinking_delta` events before the `tool_use` block it introduces. A pause of several seconds before the progress-update block opens is normal:
861861 
862```sse Output
862```text Output
863863event: content_block_start
864864data: {"type":"content_block_start","index":1,"content_block":{"type":"thinking","thinking":"","signature":""}}
865865 
from line 953
953953 Modified thinking blocks are rejected with a 400 error. See [A 400 error says thinking blocks cannot be modified](https://platform.claude.com/docs/en/build-with-claude/thinking-troubleshooting#error-thinking-blocks-modified) for the exact message, the common causes, and the fix. The one exception: text placed in the empty `thinking` field of an [omitted](https://platform.claude.com/docs/en/build-with-claude/thinking#controlling-thinking-display) block is ignored rather than rejected.
954954</Note>
955955 
956For a complete two-turn walkthrough with code in every SDK, see [Thinking in tool and multi-turn workflows](https://platform.claude.com/docs/en/build-with-claude/thinking-tool-workflows#two-turn-tool-use-round-trip). It defines a tool, receives a thinking-plus-tool-use response, and echoes the assistant turn back with the tool result.
956For a worked example with code in every SDK, see [Walk through a two-turn tool-use round trip](https://platform.claude.com/docs/en/build-with-claude/thinking-tool-workflows#two-turn-tool-use-round-trip). It defines a tool, receives a thinking-plus-tool-use response, and echoes the assistant turn back with the tool result.
957957 
958958### Interleaved thinking
959959 
from line 1019
10191019 
10201020Under `"updates"`, the start of the response that follows a `tool_result` looks like this. The first block is reasoning and stays empty, as it would under `"omitted"`. The second carries text, so it's a progress update. Under `"summarized"` both blocks carry text, and under `"omitted"` both are empty.
10211021 
1022```json Output
1022```text Output
10231023{
10241024 "content": [
10251025 {
from line 1080
10801080 
10811081To keep thinking valid, send every assistant turn back exactly as you received it and add new messages only at the end of `messages`. If your code builds the `messages` array itself, the Preserved thinking page covers:
10821082 
1083* [What counts as an edit](https://platform.claude.com/docs/en/build-with-claude/preserved-thinking#what-counts-as-an-edit), and [how to check whether your code makes one](https://platform.claude.com/docs/en/build-with-claude/preserved-thinking#how-to-tell-whether-your-integration-is-impacted).
1083* [What counts as an edit](https://platform.claude.com/docs/en/build-with-claude/preserved-thinking#what-counts-as-an-edit), and [how to check whether your code makes an edit](https://platform.claude.com/docs/en/build-with-claude/preserved-thinking#how-to-tell-whether-your-integration-is-impacted).
10841084* The [API feature that replaces each common edit](https://platform.claude.com/docs/en/build-with-claude/preserved-thinking#replace-prefix-edits): mid-conversation system messages for new instructions and per-turn reminders, `tool_addition` and `tool_removal` blocks for tool changes, per-message `output_config` for effort changes, and server-side compaction and context editing for trimming.
10851085* [Client-side compaction](https://platform.claude.com/docs/en/build-with-claude/preserved-thinking#custom-compaction-on-the-client): which patterns keep thinking valid and which don't.
10861086* The [`thinking-binding-controls-2026-08-01` beta header](https://platform.claude.com/docs/en/build-with-claude/preserved-thinking#preserved-thinking-controls). It adds a `block_binding.prefix_mismatch_behavior` field (`"error"` or `"drop_block"`) to the thinking configuration and an `input_transformations` array to every response. The array lists each thinking block that the API dropped, or that failed the prefix check and was let through.
from line 1166
11661166 
11671167In addition to regular `thinking` blocks, the API might return `redacted_thinking` blocks when portions of Claude's reasoning are safety-redacted. A `redacted_thinking` block contains encrypted thinking content in a `data` field, with no readable text:
11681168 
1169```json
1169```text wrap
11701170{
11711171 "type": "redacted_thinking",
11721172 "data": "..."
from line 1221
12211221 
12221222### Long requests
12231223 
1224The SDK requires streaming when `max_tokens` is greater than 21,333, to avoid HTTP timeouts on long-running requests. This is a client-side validation, not an API restriction. If you don't need to process events incrementally, use `.stream()` (java: `.createStreaming()`; csharp: `.CreateStreaming()`; go: `.NewStreaming()`; php: `->createStream()`) with `.get_final_message()` (typescript: `.finalMessage()`; ruby: `.accumulated_message`; csharp: `.Aggregate()`; go: `message.Accumulate(event)`; java, php: `MessageAccumulator`) to get the complete `Message` object without assembling it from individual events yourself. See [Streaming messages](https://platform.claude.com/docs/en/build-with-claude/streaming#get-the-final-message-without-handling-events). Expect longer response times when thinking is active, because generating thinking blocks adds processing time. For workloads that push thinking above roughly 32k tokens per request, use [batch processing](https://platform.claude.com/docs/en/build-with-claude/batch-processing) to avoid networking issues: such requests can run long enough to hit system timeouts and open connection limits.
1224The SDK requires streaming when `max_tokens` is greater than 21,333, to avoid HTTP timeouts on long-running requests. This is a client-side validation, not an API restriction. If you don't need to process events incrementally, use `.stream()` (java: `.createStreaming()`; csharp: `.CreateStreaming()`; go: `.NewStreaming()`; php: `->createStream()`) with `.get_final_message()` (typescript: `.finalMessage()`; ruby: `.accumulated_message`; csharp: `.Aggregate()`; go: `message.Accumulate(event)`; java, php: `MessageAccumulator`) to get the complete `Message` object without assembling it from individual events yourself. See [Get the final message without handling events](https://platform.claude.com/docs/en/build-with-claude/streaming#get-the-final-message-without-handling-events). Expect longer response times when thinking is active, because generating thinking blocks adds processing time. For workloads that push thinking above roughly 32k tokens per request, use [batch processing](https://platform.claude.com/docs/en/build-with-claude/batch-processing) to avoid networking issues: such requests can run long enough to hit system timeouts and open connection limits.
12251225 
12261226## Next steps
12271227 

build-with-claude/thinking-steering-and-cost Changed · +7 / -7 lines

from line 16
1616 
1717## How Claude determines when to think
1818 
19Thinking is optional for the model. On each request, Claude evaluates the complexity of the input and determines whether deeper reasoning would improve the answer. A simple factual question may get a direct response with no thinking block at all; a multistep math problem or a tricky debugging task triggers deeper reasoning.
19Thinking is optional for the model. On each request, Claude evaluates the complexity of the input and determines whether deeper reasoning would improve the answer. A simple factual question might get a direct response with no thinking block at all; a multistep math problem or a tricky debugging task triggers deeper reasoning.
2020 
21This determination happens per request. The same conversation can contain turns with and without thinking, and a turn where Claude skips thinking contains no thinking block. Don't build application logic that assumes every assistant turn starts with one.
21This determination occurs for each request. The same conversation can contain turns with and without thinking, and a turn where Claude skips thinking contains no thinking block. Don't build application logic that assumes every assistant turn starts with one.
2222 
2323The primary control over this determination is the [effort](https://platform.claude.com/docs/en/build-with-claude/effort) parameter, which acts as soft guidance for how often and how deeply Claude uses thinking; see [Effort levels](https://platform.claude.com/docs/en/build-with-claude/thinking-steering-and-cost#effort-levels) on this page for what each level does.
2424 
from line 30
3030 
3131## Steering how often Claude thinks
3232 
33Whether Claude thinks on a given turn is promptable. Effort sets the overall posture, but you can also shape that behavior directly with natural-language guidance, either globally in the system prompt or per message from the user turn.
33Whether Claude thinks on a given turn is promptable. Effort sets the overall posture, but you can also shape that behavior directly with natural-language guidance, either globally in the system prompt or for individual messages in the user turn.
3434 
3535Use the two levers together in this order:
3636 
from line 74
7474 
7575### System prompt guidance
7676 
77System prompt guidance shifts Claude's thinking threshold for every request in the conversation. If Claude is thinking more often than your workload needs, add guidance like this to your system prompt:
77System prompt guidance shifts Claude's thinking threshold for every request in the conversation. If Claude is thinking more often than your workload needs, add guidance such as the following to your system prompt:
7878 
7979```text wrap
8080Extended thinking adds latency and should only be used when it
from line 117
117117For multi-turn applications, this means you can pass back conversation history in whatever shape you have it:
118118 
119119* Assistant turns without thinking are valid history as-is.
120* You can resume a conversation that began without thinking, or that used a different thinking configuration, without rewriting its history.
120* You can resume a conversation that started without thinking, or that used a different thinking configuration, without rewriting its history.
121121* History assembled from mixed sources doesn't need thinking blocks reinserted at the start of each assistant turn to pass validation.
122122 
123123The relaxation is about validation, not about what you should send. When you have thinking blocks, pass them back unmodified, particularly during tool use, where they carry the reasoning behind Claude's tool calls. See the [Thinking](https://platform.claude.com/docs/en/build-with-claude/thinking) overview for the full rules.
from line 906
906906 
907907To see how many billed output tokens were spent on internal reasoning, read `usage.output_tokens_details.thinking_tokens` in the response. This value reflects the raw reasoning the model generated (not the summarized text returned in the body) and is always less than or equal to `output_tokens`. Subtract it from `output_tokens` to approximate the non-reasoning portion of the output. When streaming, this breakdown appears only on the final `message_delta` event.
908908 
909```json
909```text wrap
910910{
911911 "usage": {
912912 "input_tokens": 25,

build-with-claude/thinking-tool-workflows Changed · +3 / -3 lines

from line 281
281281 </Step>
282282 
283283 <Step title="Capture the content array to echo back">
284 You should see `thinking` and `tool_use` blocks in the response content on a run that includes thinking (on simpler requests, adaptive mode may skip the thinking block). A note Claude writes before the tool call comes back as a `text` block or, on models that write [progress updates](https://platform.claude.com/docs/en/build-with-claude/thinking#progress-updates), as another `thinking` block. Keep this content array intact: the next step sends it back verbatim.
284 You should see `thinking` and `tool_use` blocks in the response content on a run that includes thinking (on simpler requests, adaptive mode might skip the thinking block). A note Claude writes before the tool call comes back as a `text` block or, on models that write [progress updates](https://platform.claude.com/docs/en/build-with-claude/thinking#progress-updates), as another `thinking` block. Keep this content array intact: the next step sends it back verbatim.
285285 
286286 <Note>
287287 To see thinking text like this output, add `display: "summarized"` to the request. On models where display defaults to omitted, including Claude Opus 5.5, the `thinking` field otherwise comes back as an empty string with only the `signature` populated. Either way, echo the content array back unchanged; see [Controlling thinking display](https://platform.claude.com/docs/en/build-with-claude/thinking#controlling-thinking-display).
288288 </Note>
289289 
290 ```json Output
290 ```text Output
291291 {
292292 "content": [
293293 {
from line 750
750750 <Step title="Read the final response">
751751 You should see Claude complete the turn with text. Because [interleaved thinking](https://platform.claude.com/docs/en/build-with-claude/thinking#interleaved-thinking) is automatic in adaptive mode, the continuation can also open with a new thinking block before the final text:
752752 
753 ```json Output
753 ```text Output wrap
754754 {
755755 "content": [
756756 {

build-with-claude/token-counting Changed · +5 / -5 lines

from line 186
186186 ```
187187</CodeGroup>
188188 
189```json Output
189```text Output wrap
190190{ "input_tokens": 14 }
191191```
192192 
from line 469
469469 ```
470470</CodeGroup>
471471 
472```json Output
472```text Output wrap
473473{ "input_tokens": 403 }
474474```
475475 
from line 774
774774 ```
775775</CodeGroup>
776776 
777```json Output
777```text Output wrap
778778{ "input_tokens": 1028 }
779779```
780780 
from line 1099
10991099 ```
11001100</CodeGroup>
11011101 
1102```json Output
1102```text Output wrap
11031103{ "input_tokens": 88 }
11041104```
11051105 
from line 1381
13811381 ```
13821382</CodeGroup>
13831383 
1384```json Output
1384```text Output wrap
13851385{ "input_tokens": 2188 }
13861386```
13871387 

build-with-claude/vision Changed · +8 / -8 lines

from line 1252
12521252 
12531253| Resolution tier | Models | Max long edge | Max visual tokens |
12541254| --------------- | --------------------------- | ------------- | ----------------- |
1255| High-resolution | Claude 4.7 and later models | 2576 px | 4784 |
1256| Standard | All other models | 1568 px | 1568 |
1255| High-resolution | Claude 4.7 and later models | 2,576 px | 4,784 |
1256| Standard | All other models | 1,568 px | 1,568 |
12571257 
12581258High-resolution support is automatic on the listed models and requires no beta header or client-side opt-in.
12591259 
from line 1262
12621262| Image size | Standard tier: downsized to | Standard tier: tokens | High-resolution tier: downsized to | High-resolution tier: tokens |
12631263| ------------------------------ | --------------------------- | --------------------- | ---------------------------------- | ---------------------------- |
12641264| 200x200 px (0.04 megapixels) | Not resized | 64 | Not resized | 64 |
1265| 1000x1000 px (1 megapixel) | Not resized | 1296 | Not resized | 1296 |
1266| 1092x1092 px (1.19 megapixels) | Not resized | 1521 | Not resized | 1521 |
1267| 1920x1080 px (2.07 megapixels) | 1456x819 px | 1560 | Not resized | 2691 |
1268| 2000x1500 px (3 megapixels) | 1269x952 px | 1564 | Not resized | 3888 |
1269| 3840x2160 px (8.29 megapixels) | 1456x819 px | 1560 | 2576x1449 px | 4784 |
1265| 1000x1000 px (1 megapixel) | Not resized | 1,296 | Not resized | 1,296 |
1266| 1092x1092 px (1.19 megapixels) | Not resized | 1,521 | Not resized | 1,521 |
1267| 1920x1080 px (2.07 megapixels) | 1456x819 px | 1,560 | Not resized | 2,691 |
1268| 2000x1500 px (3 megapixels) | 1269x952 px | 1,564 | Not resized | 3,888 |
1269| 3840x2160 px (8.29 megapixels) | 1456x819 px | 1,560 | 2576x1449 px | 4,784 |
12701270 
12711271When an image is downsized, Claude scales it to the largest size that fits the tier's limits while preserving its aspect ratio. This caps the token cost. For the precise rule and a reference implementation, see [How Claude resizes and pads images](https://platform.claude.com/docs/en/build-with-claude/vision-coordinates#how-claude-resizes-and-pads-images).
12721272 
from line 1334
13341334 No. Image uploads are ephemeral and not stored beyond the duration of the API request. Uploaded images are automatically deleted after they have been processed.
13351335 </Accordion>
13361336 
1337 <Accordion title="Where are the details on data privacy for image uploads?">
1337 <Accordion title="Where can I find details on data privacy for image uploads?">
13381338 Refer to the Anthropic privacy policy page for information on how uploaded images and other data are handled. Anthropic does not use uploaded images to train models.
13391339 </Accordion>
13401340 

build-with-claude/vision-coordinates Changed · +5 / -5 lines

from line 22
2222 
2323Claude finds the largest aspect-preserving size that satisfies both of the model's image limits:
2424 
251. **Edge limit:** neither side exceeds the maximum edge length (1568 px on the standard tier, 2576 px on the high-resolution tier).
262. **Visual token limit:** the image's token cost `⌈width / 28⌉ × ⌈height / 28⌉` does not exceed the model's visual token budget (1568 tokens on the standard tier, 4784 on the high-resolution tier).
251. **Edge limit:** neither side exceeds the maximum edge length (1,568 px on the standard tier, 2,576 px on the high-resolution tier).
262. **Visual token limit:** the image's token cost `⌈width / 28⌉ × ⌈height / 28⌉` does not exceed the model's visual token budget (1,568 tokens on the standard tier, 4,784 on the high-resolution tier).
2727 
2828See [Resolution and token cost](https://platform.claude.com/docs/en/build-with-claude/vision#evaluate-image-size) for which models are in which tier.
2929 
3030For nearly all photos and screenshots, the visual token limit is what determines the final size. The edge limit takes over only for elongated images such as panoramas or tall phone screenshots. Compute the size with the [reference implementation](https://platform.claude.com/docs/en/build-with-claude/vision-coordinates#resize-your-image-before-uploading) rather than scaling to the edge length by hand: a 1920×1080 screenshot resizes to 1456×819, not 1568×882, and assuming the edge limit puts every coordinate noticeably off target.
3131 
32The token limit can also trigger a resize when neither side exceeds the edge limit. Overlooking this is the most common cause of misaligned coordinates. For example, an A4 page scanned at 130 DPI is 1075×1520 pixels: both sides are under 1568 px, but it costs `39 × 55 = 2145` visual tokens, so Claude resizes it to 924×1307.
32The token limit can also trigger a resize when neither side exceeds the edge limit. Overlooking this is the most common cause of misaligned coordinates. For example, an A4 page scanned at 130 DPI is 1075×1520 pixels: both sides are under 1,568 px, but it costs `39 × 55 = 2145` visual tokens, so Claude resizes it to 924×1307.
3333 
3434<Note>
35 This example assumes a model on the standard resolution tier. A high-resolution-tier model doesn't resize the same scan: 2145 tokens is within its 4784-token budget, so the coordinates it returns map directly onto the 1075×1520 original. Model tiers are listed in [Resolution and token cost](https://platform.claude.com/docs/en/build-with-claude/vision#evaluate-image-size).
35 This example assumes a model on the standard resolution tier. A high-resolution-tier model doesn't resize the same scan: 2,145 tokens is within its 4,784-token budget, so the coordinates it returns map directly onto the 1075×1520 original. Model tiers are listed in [Resolution and token cost](https://platform.claude.com/docs/en/build-with-claude/vision#evaluate-image-size).
3636</Note>
3737 
3838Claude then pads every image, resized or not, up to the next multiple of 28 pixels on the bottom and right edges (924×1307 becomes 924×1316 in the example). The padding contains no content: Claude perceives the padded image, but the page content only ever occupies the un-padded resized region. **Always normalize or rescale by the resized dimensions, not the padded dimensions**; dividing by the padded dimensions scales every coordinate by a small amount.
from line 468
468468Each image has its own setting. `"oversized_image": "downsize"` (the default when the field is omitted) keeps automatic resizing as described on this page. Each image block is checked only against its own setting, so one request can mix images whose dimensions matter (a screenshot you'll click) with images where resizing is harmless (a logo). What the setting does and does not change:
469469 
470470* [Padding](https://platform.claude.com/docs/en/build-with-claude/vision-coordinates#how-claude-resizes-and-pads-images) (which never discards content), format conversion, and orientation correction proceed as usual.
471* The hard limits (8000 px on the longest side, and the stricter per-image limit on [many-image requests](https://platform.claude.com/docs/en/build-with-claude/vision#request-limits)) are separate rejections; this setting never lets an image past them.
471* The hard limits (8,000 px on the longest side, and the stricter per-image limit on [many-image requests](https://platform.claude.com/docs/en/build-with-claude/vision#request-limits)) are separate rejections; this setting never lets an image past them.
472472* Images supplied by URL or file ID are checked once their bytes have been fetched; those rejections carry the same message without the leading position, so they don't identify which image failed; only embedded base64 images are named by position in the error.
473473* [PDF pages](https://platform.claude.com/docs/en/build-with-claude/pdf-support) are rasterized server-side at dimensions you don't control; the `document` block does not accept the field (an image block nested inside a document's content accepts it like any other).
474474* A marked image whose dimensions cannot be determined is rejected rather than passed through: that rejection reports that the image's source dimensions could not be determined, not the resize message quoted earlier. No image that sets `"error"` reaches the model resized.

build-with-claude/working-with-messages Changed · +4 / -4 lines

from line 133
133133 ```
134134</CodeGroup>
135135 
136```json Output
136```text Output wrap
137137{
138138 "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
139139 "type": "message",
from line 300
300300 ```
301301</CodeGroup>
302302 
303```json Output
303```text Output wrap
304304{
305305 "id": "msg_018gCsTGsXkYJVqYPxTgDHBU",
306306 "type": "message",
from line 478
478478 ```
479479</CodeGroup>
480480 
481```json Output
481```text Output wrap
482482{
483483 "id": "msg_01Q8Faay6S7QPTvEUUQARt7h",
484484 "type": "message",
from line 1005
10051005 ```
10061006</CodeGroup>
10071007 
1008```json Output
1008```text Output
10091009{
10101010 "id": "msg_011CdKmWtV3oFx1C5yUbf5CY",
10111011 "type": "message",

claude_api_primer Changed · +8 / -8 lines

from line 44
4444 ```
4545</CodeGroup>
4646 
47```json Output
47```text Output wrap
4848{
4949 "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
5050 "type": "message",
from line 532
532532* What each parameter means and how it affects the tool's behavior
533533* Any important caveats or limitations
534534 
535**Consider using `input_examples` for complex tools.** For tools with nested objects, optional parameters, or format-sensitive inputs, you can provide concrete examples using the `input_examples` field (beta). This helps Claude understand expected input patterns. See [Providing tool use examples](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools#providing-tool-use-examples) for details.
535**Consider using `input_examples` for complex tools.** For tools with nested objects, optional parameters, or format-sensitive inputs, you can provide concrete examples using the `input_examples` field (beta). This shows Claude the expected input patterns. See [Providing tool use examples](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools#providing-tool-use-examples) for details.
536536 
537537Example of a good tool description:
538538 
from line 590
590590* `name`: The name of the tool being used
591591* `input`: An object containing the input being passed to the tool
592592 
593```json
593```text wrap
594594{
595595 "role": "assistant",
596596 "content": [
from line 629
629629 
630630### Handling the `pause_turn` stop reason
631631 
632When using server tools such as web search, the API might return a `pause_turn` stop reason. Continue the conversation by passing the paused response back as-is in a subsequent request.
632When you use server tools such as web search, the API might return a `pause_turn` stop reason. Continue the conversation by passing the paused response back as-is in a subsequent request.
633633 
634634## Troubleshooting errors
635635 
from line 699
699699 
700700#### Text delta
701701 
702```json
702```text wrap
703703{
704704 "type": "content_block_delta",
705705 "index": 0,
from line 711
711711 
712712For `tool_use` content blocks, deltas are *partial JSON strings*:
713713 
714```json
714```text
715715{"type": "content_block_delta","index": 1,"delta": {"type": "input_json_delta","partial_json": "{\"location\": \"San Fra"}}}
716716```
717717 
from line 719
719719 
720720When using thinking with streaming:
721721 
722```json
722```text wrap
723723{
724724 "type": "content_block_delta",
725725 "index": 0,
from line 732
732732 
733733### Basic streaming request example
734734 
735```sse
735```text
736736event: message_start
737737data: {"type": "message_start", "message": {"id": "msg_1nZdL29xx5MUA1yADyHTEsnR8uuvGzszyY", "type": "message", "role": "assistant", "content": [], "model": "claude-opus-5-5", "stop_reason": null, "stop_sequence": null, "usage": {"input_tokens": 25, "output_tokens": 1}}}
738738 

cli-sdks-libraries/libraries/openai-sdk Changed · +21 / -21 lines

from line 1
11---
22title: OpenAI SDK compatibility
33url: https://platform.claude.com/docs/en/cli-sdks-libraries/libraries/openai-sdk
4description: Anthropic provides a compatibility layer that lets you use the OpenAI SDK to test the Claude API. With a few code changes, you can quickly evaluate Anthropic model capabilities.
4description: Anthropic provides a compatibility layer that lets you use the OpenAI SDK to test the Claude API. With a few code changes, you can evaluate Anthropic model capabilities.
55---
66 
77<Note>
from line 22
2222 
23231. Use an official OpenAI SDK.
2424 
252. Change the following
252. Change the following:
2626 
27 * Update your base URL to point to the Claude API
28 * Replace your API key with a [Claude API key](https://platform.claude.com/settings/keys) from the Claude Console
29 * If your key is a [personal or service account key](https://platform.claude.com/docs/en/manage-claude/authentication#key-types) that isn't scoped to a workspace, also send the `anthropic-workspace-id` header on every request (for example, `default_headers` in the Python SDK or `defaultHeaders` in TypeScript); see [Select a workspace](https://platform.claude.com/docs/en/manage-claude/authentication#select-a-workspace)
30 * Update your model name to use a [Claude model](https://platform.claude.com/docs/en/models/overview)
27 * Update your base URL to point to the Claude API.
28 * Replace your API key with a [Claude API key](https://platform.claude.com/settings/keys) from the Claude Console.
29 * If your key is a [personal or service account key](https://platform.claude.com/docs/en/manage-claude/authentication#key-types) that isn't scoped to a workspace, also send the `anthropic-workspace-id` header on every request (for example, `default_headers` in the Python SDK or `defaultHeaders` in TypeScript); see [Select a workspace](https://platform.claude.com/docs/en/manage-claude/authentication#select-a-workspace).
30 * Update your model name to use a [Claude model](https://platform.claude.com/docs/en/models/overview).
3131 
32323. Review the following sections for what features are supported.
3333 
from line 183
183183 
184184Here are the most substantial differences from using OpenAI:
185185 
186* The `strict` parameter for function calling is ignored, which means the tool use JSON is not guaranteed to follow the supplied schema. For guaranteed schema conformance, use the native [Claude API with Structured Outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs).
186* The `strict` parameter for function calling is ignored, which means the tool use JSON is not guaranteed to follow the supplied schema. For guaranteed schema conformance, use the native [Claude API with structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs).
187187* Audio input is not supported; it is ignored and stripped from input.
188188* Prompt caching is not supported, but it is supported in the [Anthropic SDKs](https://platform.claude.com/docs/en/cli-sdks-libraries/overview).
189189* System/developer messages are hoisted and concatenated into the top-level `system` field, wherever they appear in the conversation. To add system instructions partway through a conversation, use [mid-conversation system messages](https://platform.claude.com/docs/en/build-with-claude/mid-conversation-system-messages) in the native Claude API.
from line 297
297297| `n` | Must be exactly 1 |
298298| `logprobs` | Ignored |
299299| `metadata` | Ignored |
300| `response_format` | Ignored. For JSON output, use [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) with the native Claude API |
300| `response_format` | Ignored. For JSON output, use [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) with the native Claude API. |
301301| `prediction` | Ignored |
302302| `presence_penalty` | Ignored |
303303| `frequency_penalty` | Ignored |
from line 318
318318 <Tab title="Tools">
319319 `tools[n].function` fields
320320 
321 | Field | Support status |
322 | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
323 | `name` | Fully supported |
324 | `description` | Fully supported |
325 | `parameters` | Fully supported |
326 | `strict` | Ignored. Use [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) with the native Claude API for strict schema validation |
321 | Field | Support status |
322 | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
323 | `name` | Fully supported |
324 | `description` | Fully supported |
325 | `parameters` | Fully supported |
326 | `strict` | Ignored. Use [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) with the native Claude API for strict schema validation. |
327327 </Tab>
328328 
329329 <Tab title="Functions">
from line 333
333333 OpenAI has deprecated the `functions` field and recommends using `tools` instead.
334334 </Info>
335335 
336 | Field | Support status |
337 | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
338 | `name` | Fully supported |
339 | `description` | Fully supported |
340 | `parameters` | Fully supported |
341 | `strict` | Ignored. Use [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) with the native Claude API for strict schema validation |
336 | Field | Support status |
337 | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
338 | `name` | Fully supported |
339 | `description` | Fully supported |
340 | `parameters` | Fully supported |
341 | `strict` | Ignored. Use [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) with the native Claude API for strict schema validation. |
342342 </Tab>
343343 </Tabs>
344344</Accordion>

get-started Changed · +3 / -3 lines

from line 6
66 
77## Prerequisites
88 
9* A [Claude Console account](https://platform.claude.com)
9* A [Claude Console account](https://platform.claude.com/)
1010* An [API key](https://platform.claude.com/docs/en/get-api-key)
1111 
1212## Call the API
from line 44
4444 
4545 Claude returns a JSON response containing the assistant's message:
4646 
47 ```json Output
47 ```text Output
4848 {
4949 "model": "claude-opus-5-5",
5050 "id": "msg_013mHbppMPd2PrVJzGMZPt2D",
from line 112
112112 
113113 The CLI prints the JSON response:
114114 
115 ```json Output
115 ```text Output
116116 {
117117 "model": "claude-opus-5-5",
118118 "id": "msg_01N1ycuCkM5Mzd7WhTU4fwST",
Feedback