{"_self":{"principle":"Self-explaining payload — no external context required. This _self block describes what you are reading and where to look next.","widget":"article_topology","feature":"topology","name":"Article topology","what":"Claims, sources, anecdotes, user reports, related embeds, question graph slice — for ask/ROUTER.","contains":"claims, sources, anecdotes, question_graph slice","slug":"what-is-the-anthropic-messages-api","urls":{"read":"https://miscsubjects.com/api/articles/what-is-the-anthropic-messages-api/topology"},"how_to_use":"Claims, sources, anecdotes, user reports, related embeds, question graph slice — for ask/ROUTER.","write":null,"imessage":null,"router_tag":null,"proof_chain":[{"step":1,"claim":"Articles are voxel graphs of tiered claims, not prose blobs.","verify":"https://miscsubjects.com/api/articles/constitution"},{"step":2,"claim":"Claims link to hash-chained sources via source_ids.","verify":"https://miscsubjects.com/api/articles/what-is-the-anthropic-messages-api/sources"},{"step":3,"claim":"Ask reads topology; ingest/claim append to ledger.","verify":"https://miscsubjects.com/api/protocol"},{"step":4,"claim":"Models queue growth: populate → collaborate → repair → reflex.","verify":"https://miscsubjects.com/api/protocol/grow"},{"step":5,"claim":"Graph proves its own shape (reflex) and $/claim (yield).","verify":"https://miscsubjects.com/graph.html?layer=reflex"},{"step":6,"claim":"Full feature index + _explain on every API response.","verify":"https://miscsubjects.com/api/articles/system-map"}],"related_features":[{"id":"ask","name":"Ask protocol","what":"Answer only from topology; creates question_node with gaps and ingest_hint.","urls":{"read":"https://miscsubjects.com/api/articles/what-is-the-anthropic-messages-api/prompts","write":"https://miscsubjects.com/api/protocol/ask"}},{"id":"graph_topology","name":"Cross-article graph","what":"Merged claims/sources across condition+stack slugs for one question.","urls":{"read":"https://miscsubjects.com/api/articles/what-is-the-anthropic-messages-api/graph-topology?question=..."}},{"id":"question_graph","name":"Question graph","what":"Ask nodes (questions + gaps) and evidence_ingest nodes (pasted model output).","urls":{"read":"https://miscsubjects.com/api/articles/what-is-the-anthropic-messages-api/question-graph","write":"https://miscsubjects.com/api/protocol/ask"}},{"id":"voxels","name":"Voxel graph","what":"Claims as atoms, sources as edges (supported_by, posted_by). Per-claim provenance.","urls":{"read":"https://miscsubjects.com/api/articles/what-is-the-anthropic-messages-api/voxels","write":"https://miscsubjects.com/api/protocol/claim"}}],"system_map":"https://miscsubjects.com/api/articles/system-map","system_map_markdown":"https://miscsubjects.com/api/articles/system-map?format=markdown","not_medical_advice":true},"_explain":{"feature":"topology","name":"Article topology","what":"Claims, sources, anecdotes, user reports, related embeds, question graph slice — for ask/ROUTER.","why":"Every feature is auditable collective intelligence","how":"Claims, sources, anecdotes, user reports, related embeds, question graph slice — for ask/ROUTER.","model":null,"verifies":null,"urls":{"read":"https://miscsubjects.com/api/articles/what-is-the-anthropic-messages-api/topology"},"imessage":null,"router":null,"related":[{"id":"ask","what":"Answer only from topology; creates question_node with gaps and ingest_hint."},{"id":"graph_topology","what":"Merged claims/sources across condition+stack slugs for one question."},{"id":"question_graph","what":"Ask nodes (questions + gaps) and evidence_ingest nodes (pasted model output)."},{"id":"voxels","what":"Claims as atoms, sources as edges (supported_by, posted_by). Per-claim provenance."}],"not_medical_advice":true},"slug":"what-is-the-anthropic-messages-api","title":"The Anthropic Messages API is one endpoint with a strict block grammar","register":"essay","tags":["tooling","api","anthropic-messages","streaming","prompt-caching","tool-use"],"updated_at":"2026-07-26T05:37:26.713Z","body_excerpt":"The Anthropic Messages API is a single HTTP endpoint. `POST https://api.anthropic.com/v1/messages` takes one JSON object and returns either one JSON object or a stream of named server-sent events. Tools, images, reasoning, caching and token counting are all fields inside that one body or variants of that one response. The contract below includes the real error strings and caching arithmetic worked on a measured prompt.\n\n## Evidence status\n\n**Observed** marks first-party measurements or runtime receipts from the named environment.\n**Derived** marks arithmetic calculated from cited inputs. **Specified** marks vendor or standards\ndocumentation. **Implemented** and **deployed** name code and live-state evidence, respectively.\n**Reproduced** means the stated procedure was rerun. **Externally attested** marks operator reports;\nthose reports show that an experience occurred, not that it is universal.\n\n## One command proves the request envelope\n\nSet the key in an environment variable. Do not put it in the JSON body, a URL, source control or a log.\n\n```bash\nexport ANTHROPIC_API_KEY=\"<your Anthropic API key>\"\n\ncurl -sS https://api.anthropic.com/v1/messages \\\n  -H \"x-api-key: $ANTHROPIC_API_KEY\" \\\n  -H \"anthropic-version: 2023-06-01\" \\\n  -H \"content-type: application/json\" \\\n  --data '{\n    \"model\":\"claude-sonnet-4-5\",\n    \"max_tokens\":32,\n    \"system\":\"Answer with digits only.\",\n    \"messages\":[{\"role\":\"user\",\"content\":\"What is 7 times 6?\"}]\n  }' | jq '{type,role,content,stop_reason,usage}'\n```\n\nExpected shape:\n\n```json\n{\"type\":\"message\",\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":\"42\"}],\n \"stop_reason\":\"end_turn\",\n \"usage\":{\"input_tokens\":\"<integer>\",\"cache_creation_input_tokens\":\"<integer>\",\n          \"cache_read_input_tokens\":\"<integer>\",\"output_tokens\":\"<integer>\"}}\n```\n\nThe token values vary with model and prompt. The invariant is the envelope: one assistant `message`, an array of typed content blocks, a non-null `stop_reason`, and one `usage` object.\n\n## Your key is checked before your version header, so a version mistake hides behind a 401\n\nThree headers are mandatory: `x-api-key`, `anthropic-version`, `content-type: application/json`. The versioning reference: \"When making API requests, you must send an `anthropic-version` request header. For example, `anthropic-version: 2023-06-01`.\" What it does not say is the order of checks. Three calls to `api.anthropic.com` on 2026-07-26, varying only headers:\n\n| Call | `x-api-key` | `anthropic-version` | HTTP | `error.message` |\n| --- | --- | --- | --- | --- |\n| A | absent | absent | 401 | `x-api-key header is required` |\n| B | `sk-ant-invalid` | absent | 401 | `invalid x-api-key` |\n| C | `sk-ant-invalid` | `2024-99-99` | 401 | `invalid x-api-key` |\n\nCall C sends a version that does not exist and still gets the key error. Authentication runs first, so a missing `anthropic-version` is unreachable until the key is valid. Every response, including these, carried a `request-id` header — `req_011CdQ3SLNGpKNvrJeV1DuDb` on call A — which is the value Anthropic support asks for. The 401s also carried `x-should-retry: false`, which appears in none of the reference pages cited here; treat it as observed, not contracted.\n\n## Three required fields, and one field that looks like a message but is not\n\n| Field | Required | What it does |\n| --- | --- | --- |\n| `model` | yes | The model id. An id the endpoint does not serve is rejected. |\n| `max_tokens` | yes | \"The maximum number of tokens to generate before stopping.\" `0` writes the prompt cache without generating. Maximums are per model. |\n| `messages` | yes | Ordered `{role, content}` turns. Consecutive same-role turns \"will be combined into a single turn\". A trailing `assistant` message is continued from. |\n| `system` | no | The system prompt, at the top level of the body, outside `messages`. String or array of text blocks. |\n| `temperature` | no | \"Defaults to `1.0`. Ranges from `0.0` to `1.0`.\" Not deterministic even at `0.0`. |\n| `stop_seq","ranking":"safety-first (interaction_risk/limitations), then quote-gated effective_weight","claims":[{"id":"c6","text":"Synthesizing tool ids from tool names collides on parallel calls to the same function and can produce either a 400 or mispaired results.","tier":"anecdotal","section":"An unpaired tool_use does not fail one request, it kills every request after it","interaction_risk":false,"status":"active","source_ids":["s16"],"why_material":"Unique ids are required per call, not per tool.","retracted_at":null,"retraction_reason":null,"challenged_by":[],"effective_weight":0.3,"quote_gated":false},{"id":"c12","text":"Caching can fail silently when cache_control is omitted, stripped by a proxy, injected only on one route or emitted without the requested one-hour ttl.","tier":"anecdotal","section":"Three ways caching silently does nothing","interaction_risk":false,"status":"active","source_ids":["s14","s15","s19","s20","s23"],"why_material":"Zero error does not mean the cache is active.","retracted_at":null,"retraction_reason":null,"challenged_by":[],"effective_weight":0.3,"quote_gated":false},{"id":"c17","text":"An independent direct-versus-proxy A/B test found cache reads on the second direct Bedrock request and none through agentgateway because cache_control was dropped.","tier":"anecdotal","section":"Three ways caching silently does nothing","interaction_risk":false,"status":"active","source_ids":["s14","s23"],"why_material":"It isolates the proxy as the cache failure.","retracted_at":null,"retraction_reason":null,"challenged_by":[],"effective_weight":0.3,"quote_gated":false},{"id":"c18","text":"A positive implementation report converged on one structured-output tool, parsed tool_use, cache_control on system and context, and exponential backoff on 429.","tier":"anecdotal","section":"Three ways caching silently does nothing","interaction_risk":false,"status":"active","source_ids":["s18"],"why_material":"The page carries a working operator pattern as well as failures.","retracted_at":null,"retraction_reason":null,"challenged_by":[],"effective_weight":0.3,"quote_gated":false},{"id":"c1","text":"The Messages API is POST /v1/messages with x-api-key, anthropic-version and content-type headers; one JSON body produces one message or an SSE stream.","tier":"system","section":"One command proves the request envelope","interaction_risk":false,"status":"active","source_ids":["r3","s1","s2"],"why_material":"This is the executable wire contract.","retracted_at":null,"retraction_reason":null,"challenged_by":[],"effective_weight":0.1,"quote_gated":false},{"id":"c2","text":"Authentication is checked before version validity: an invalid key plus an impossible version still returns invalid x-api-key.","tier":"system","section":"Your key is checked before your version header, so a version mistake hides behind a 401","interaction_risk":false,"status":"active","source_ids":["r3","s2"],"why_material":"It fixes the order in which a caller diagnoses headers.","retracted_at":null,"retraction_reason":null,"challenged_by":[],"effective_weight":0.1,"quote_gated":false},{"id":"c3","text":"The main system prompt belongs in the top-level system field, not a system-role input message.","tier":"system","section":"Three required fields, and one field that looks like a message but is not","interaction_risk":false,"status":"active","source_ids":["s1","s4"],"why_material":"Putting it in the wrong place changes semantics or fails by model.","retracted_at":null,"retraction_reason":null,"challenged_by":[],"effective_weight":0.1,"quote_gated":false},{"id":"c4","text":"Messages carry text, image, tool_use, tool_result and thinking as typed content blocks rather than dedicated message roles.","tier":"system","section":"Five content-block types carry everything in both directions","interaction_risk":false,"status":"active","source_ids":["s1","s5"],"why_material":"A client cannot serialize or replay the API without the block union.","retracted_at":null,"retraction_reason":null,"challenged_by":[],"effective_weight":0.1,"quote_gated":false},{"id":"c5","text":"Every assistant tool_use must be paired by id with a tool_result in the immediately following user message or later turns replay the same 400.","tier":"system","section":"An unpaired tool_use does not fail one request, it kills every request after it","interaction_risk":false,"status":"active","source_ids":["s13","s5"],"why_material":"It is the transcript invariant that most often bricks an agent session.","retracted_at":null,"retraction_reason":null,"challenged_by":[],"effective_weight":0.1,"quote_gated":false},{"id":"c7","text":"A streamed tool argument is a sequence of partial_json strings keyed by content-block index and must be parsed only after concatenation.","tier":"system","section":"Streaming is a nested event grammar, and tool arguments arrive as string fragments","interaction_risk":false,"status":"active","source_ids":["r2","s17","s3"],"why_material":"Parsing each delta independently corrupts valid tool calls.","retracted_at":null,"retraction_reason":null,"challenged_by":[],"effective_weight":0.1,"quote_gated":false},{"id":"c8","text":"stop_reason tells the caller whether to render, continue, execute tools, retry or fall back; it is not a decorative status.","tier":"system","section":"stop_reason is an instruction to the caller, not a status label","interaction_risk":false,"status":"active","source_ids":["r1","s6"],"why_material":"Each value requires a different state transition.","retracted_at":null,"retraction_reason":null,"challenged_by":[],"effective_weight":0.1,"quote_gated":false},{"id":"c9","text":"Total input is input_tokens plus cache_creation_input_tokens plus cache_read_input_tokens; input_tokens alone can fall to 3 on a 187,364-token cached prompt.","tier":"system","section":"input_tokens counts what comes after your last cache breakpoint, not what you sent","interaction_risk":false,"status":"active","source_ids":["s12","s4"],"why_material":"Billing and dashboards are wrong if they sum one field.","retracted_at":null,"retraction_reason":null,"challenged_by":[],"effective_weight":0.1,"quote_gated":false},{"id":"c10","text":"Prompt caching is opt-in: five-minute writes cost 1.25x base input, one-hour writes cost 2x and reads cost 0.1x.","tier":"system","section":"Caching is a field you have to send, and it pays back on the second request","interaction_risk":false,"status":"active","source_ids":["s21","s4"],"why_material":"The cache decision needs its full arithmetic.","retracted_at":null,"retraction_reason":null,"challenged_by":[],"effective_weight":0.1,"quote_gated":false},{"id":"c11","text":"On a 20,000-token prefix repeated fifty times inside five minutes, the worked cache cost is $0.3690 instead of $3.0000, an 87.7 percent saving.","tier":"system","section":"Caching is a field you have to send, and it pays back on the second request","interaction_risk":false,"status":"active","source_ids":["s12","s4"],"why_material":"The page must state the economics, not only the mechanism.","retracted_at":null,"retraction_reason":null,"challenged_by":[],"effective_weight":0.1,"quote_gated":false},{"id":"c13","text":"count_tokens is free and separately rate-limited, but a compatibility estimator measured 18 tokens against 19 in message usage on the same prompt.","tier":"system","section":"count_tokens is free, and the estimators that replace it drift","interaction_risk":false,"status":"active","source_ids":["r1","s7"],"why_material":"Routing and compaction thresholds depend on the estimate.","retracted_at":null,"retraction_reason":null,"challenged_by":[],"effective_weight":0.1,"quote_gated":false},{"id":"c14","text":"Messages errors are typed JSON objects with request ids, but types may expand, so callers should match typed classes rather than prose.","tier":"system","section":"The error catalogue, by symptom","interaction_risk":false,"status":"active","source_ids":["r3","s8"],"why_material":"Stable error handling must not depend on mutable message text.","retracted_at":null,"retraction_reason":null,"challenged_by":[],"effective_weight":0.1,"quote_gated":false},{"id":"c15","text":"DeepSeek, Z.ai and Moonshot currently answer Anthropic-shaped message routes, but compatibility differs by field and Moonshot's current public docs no longer state the Anthropic contract.","tier":"system","section":"Three other vendors answer this exact shape, and each drops different fields","interaction_risk":false,"status":"active","source_ids":["r4","s10","s11","s9"],"why_material":"A base URL returning 401 proves a route, not complete compatibility.","retracted_at":null,"retraction_reason":null,"challenged_by":[],"effective_weight":0.1,"quote_gated":false},{"id":"c16","text":"A production translation layer must preserve streaming, tool ids and results, images, usage, stop reasons and error envelopes while mapping the upstream request format.","tier":"system","section":"Method for the six measurements above","interaction_risk":false,"status":"active","source_ids":["r1","r2","s22"],"why_material":"These are the behaviors that make a compatible endpoint usable by a real client.","retracted_at":null,"retraction_reason":null,"challenged_by":[],"effective_weight":0.1,"quote_gated":false}],"sources":[{"id":"s1","type":"specification","url":"https://platform.claude.com/docs/en/api/messages","title":"Messages API reference","quote":"Create a Message","summary":"Normative request and response fields for POST /v1/messages, including the top-level system field and content-block unions.","claim_ids":["c1","c3","c4"],"hash":"bc70d3a772ec0c71567fbd4df54e87654beaff109c8562332e27368ba127ad0b"},{"id":"s2","type":"specification","url":"https://platform.claude.com/docs/en/api/versioning","title":"API versioning","quote":"When making API requests, you must send an `anthropic-version` request header. For example, `anthropic-version: 2023-06-01`.","summary":"The required version header and Anthropic's compatibility policy.","claim_ids":["c1","c2"],"hash":"9d48f42b62e952840a3ceb37f57aee311174f85c3dc836c34c52409363188033"},{"id":"s3","type":"specification","url":"https://platform.claude.com/docs/en/build-with-claude/streaming","title":"Streaming Messages","quote":"Event streams may also include any number of `ping` events.","summary":"The SSE event grammar, incremental JSON deltas, pings, mid-stream errors and unknown-event rule.","claim_ids":["c7"],"hash":"b9e7d8e6e3563c681ad169af9b9ff05fd91a34feb194e55c8f62c184b0d037ff"},{"id":"s4","type":"publisher_documentation","url":"https://platform.claude.com/docs/en/build-with-claude/prompt-caching","title":"Prompt caching","quote":"Cache prompt prefixes with `cache_control` to cut costs and latency, using automatic caching or explicit breakpoints with 5-minute or 1-hour TTLs.","summary":"Cache placement, expiry, minimum prompt lengths, invalidators and the 1.25x/2x/0.1x prices.","claim_ids":["c10","c11","c3","c9"],"hash":"68989d9d3af0a6068c6f794a02d46e6aba403c5b1faa08d5552b6d89a0f3bd32"},{"id":"s5","type":"publisher_documentation","url":"https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview","title":"Tool use overview","quote":"Tool use lets Claude call functions that you define or that Anthropic provides.","summary":"The complete client-tool round trip: tool definition, tool_use response, execution and user-role tool_result.","claim_ids":["c4","c5"],"hash":"b85f9354cafbda4260864d72b9bb83352a3a734f6baecd8f4fbee21ba28f3b2b"},{"id":"s6","type":"publisher_documentation","url":"https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons","title":"Stop reasons and fallback","quote":"Every Messages API response includes a `stop_reason` field that tells you why Claude stopped generating.","summary":"Every stop_reason value and the action a caller takes next.","claim_ids":["c8"],"hash":"f68d31a9d86448af7cd50ae2f834f8a71a753b52bacaa7f1613bf63ae5661248"},{"id":"s7","type":"publisher_documentation","url":"https://platform.claude.com/docs/en/build-with-claude/token-counting","title":"Token counting","quote":"Token counting is **free to use** but subject to requests per minute rate limits based on your usage tier.","summary":"The count_tokens request shape, supported inputs, price and independent rate limit.","claim_ids":["c13"],"hash":"692345006dd23be0f26c36f403657ba0009e2f0ded9a0747af661d358b4c6958"},{"id":"s8","type":"publisher_documentation","url":"https://platform.claude.com/docs/en/api/errors","title":"Errors","quote":"the values within these objects may expand, and it is possible that the `type` values will grow over time.","summary":"HTTP codes, typed error envelopes, request ids, request-size limits and retry behavior.","claim_ids":["c14"],"hash":"e5d056a0b40c44503f31628096e15f38acbb6d8062d2d43666b5cf9181850667"},{"id":"s9","type":"publisher_documentation","url":"https://api-docs.deepseek.com/guides/anthropic_api/","title":"DeepSeek Anthropic API compatibility","quote":"our API has added support for the Anthropic API format","summary":"DeepSeek's field-by-field support matrix and model-id mapping for its Anthropic-compatible base URL.","claim_ids":["c15"],"hash":"25501f14f437354612d65736c579c26a2ece3cd482344f880e40ead3b5138d6f"},{"id":"s10","type":"publisher_documentation","url":"https://docs.z.ai/scenario-example/develop-tools/claude","title":"Use Claude Code with Z.ai models","quote":"ANTHROPIC_BASE_URL","summary":"Z.ai's official configuration publishes https://api.z.ai/api/anthropic as the Anthropic base URL.","claim_ids":["c15"],"hash":"88b9caf62c37e4003251789694372cb7cb9420506e5fcd3398e5eadab0c4aa55"},{"id":"s11","type":"publisher_documentation","url":"https://platform.kimi.ai/docs/api/overview","title":"Kimi API overview","quote":"Kimi Open Platform provides OpenAI-compatible HTTP APIs.","summary":"Current Kimi documentation now states OpenAI compatibility and no longer documents the older Anthropic agent-support route; the live route probe is therefore labelled first-party rather than vendor contract.","claim_ids":["c15"],"hash":"eb06da0f53156c2a4eb51b9efb65815e6ee1e10c15ecb62f78810e654aa7fa0e"},{"id":"s12","type":"repository","url":"https://github.com/anthropics/claude-cookbooks/blob/main/misc/prompt_caching.ipynb","title":"Anthropic prompt-caching notebook","quote":"Speedup:        3.3x","summary":"Executable notebook and committed outputs for the 187,364-token no-cache/write/read comparison.","claim_ids":["c11","c9"],"hash":"e27e5c3a8eae262dec5f51702bf2c9cc97d932bda42fdac992e00894ef8a3f9a"},{"id":"s13","type":"github","url":"https://github.com/valkyriweb/pi-mono/issues/406","title":"Compaction can emit an unpaired tool_use, bricking the session with a permanent Anthropic 400","quote":"messages.8: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01GJ.... Each `tool_use` block must have a corresponding `tool_result` block in the next message.","summary":"Auto-compaction from 184,072 tokens cut a turn mid-tool-call, leaving a tool_use block with no following tool_result. Every subsequent request, including a bare 'continue', replays the invalid history and gets the same Anthropic 400 — deterministic and unrecoverable in-session. Negative: the tool_use/tool_result pairing invariant is unforgiving.","claim_ids":["c5"],"hash":"07187c730bcdd9286fe37ea6187cf2bdbd1b30db7ef66da3bd928fc6925b123c"},{"id":"s14","type":"github","url":"https://github.com/agentgateway/agentgateway/issues/2628","title":"feature: cache_control stripped when proxying to AWS Bedrock (Anthropic prompt caching broken)","quote":"When sending a request through agentgateway with Anthropic `cache_control` markers in the system prompt, the field is silently dropped before the request reaches Bedrock. As a result, prompt caching never activates","summary":"Proved it by A/B: direct Bedrock calls return cache_read_input_tokens > 0 on the second request, the same request through the gateway never does. Every call is billed at full input-token cost with no error surfaced. Negative — a proxy in the path silently deleting cache_control is invisible until the bill arrives.","claim_ids":["c12","c17"],"hash":"2facf7e0eb0c84bd4ec415af006320fba1df82124e5227a4b751e58a83e201f6"},{"id":"s15","type":"github","url":"https://github.com/bobmatnyc/trusty-tools/issues/3388","title":"Prompt caching may be silently inert for OpenRouter-routed agents (cache_control only injected on native-Anthropic path)","quote":"Net effect: the caching flag is honored for *routing* but not for *the actual cache markers*, so no prompt caching happens on the wire.","summary":"While writing a caching regression test, found cache_control injection gated behind route_native_anthropic, so any agent configured with enable_prompt_caching but routed through OpenRouter got the raw-request path without the markers. Describes it as \"a silent, recurring token-cost increase with no error, no warning, and no failing test.\" Negative.","claim_ids":["c12"],"hash":"148f2ecf43b4cdc6d8a9ea4f382344ccfd981149ed98838d6a8cff76bc1be5ac"},{"id":"s16","type":"github","url":"https://github.com/go-steer/core-agent/issues/367","title":"Anthropic: synthesized tool_use IDs collide on parallel calls to the same tool","quote":"Two parallel calls to the same function in one turn (or a replayed Gemini-origin history, which frequently omits IDs) produce duplicate `tool_use`/`tool_result` IDs → Anthropic 400 (IDs must be unique) or mispaired results.","summary":"Code review of pkg/models/anthropic/convert.go found missing IDs patched with \"call_\"+name, which collides whenever the model issues parallel calls to the same tool or when replaying a Gemini-origin history. Result is either a hard 400 or, worse, silently mispaired tool results. Negative.","claim_ids":["c6"],"hash":"b9416e6cba313e0fc3f0b784acfcab067a5ab7f4fcb60d81e9cb5f0cccecdbbd"},{"id":"s17","type":"github","url":"https://github.com/anthropics/claude-code/issues/76802","title":"[BUG] ConnectionRefused on /v1/messages streaming while simple API requests succeed (Windows, Bun)","quote":"[BUG] ConnectionRefused on /v1/messages streaming while simple API requests succeed (Windows, Bun)","summary":"Filed against Claude Code itself: plain non-streaming API requests complete but the streaming SSE call to /v1/messages gets ConnectionRefused, on Windows 11 under PowerShell and the VS Code integrated terminal. Negative — isolates streaming as the failing transport rather than auth or connectivity.","claim_ids":["c7"],"hash":"ffbba95f36485353f8e5d5f6e597a2e0013309e1e1e882d17cd309f723e3c90b"},{"id":"s18","type":"github","url":"https://github.com/amadoug2g/Sweep/issues/4","title":"ClaudeClient: /v1/messages with tool_use","quote":"Implement prompt caching (system + context marked `cache_control: ephemeral`)","summary":"An operator's own build spec for a Messages API client: POST /v1/messages with a propose_actions tool for structured output, parse tool_use into strongly-typed values, mark system and context blocks cache_control: ephemeral, and handle 429 with exponential backoff. Positive — shows the shape people actually settle on.","claim_ids":["c18"],"hash":"2e6e27e3ee364229f66c621044202fb85bb3c36144279167970b991f07761723"},{"id":"s19","type":"hn","url":"https://news.ycombinator.com/item?id=47745409","title":"Comment on \"Pro Max 5x quota exhausted in 1.5 hours\" — 1h cache TTL","quote":"but how to make claude-code send that when paying by API-key? or when using a custom ANTHROPIC_BASE_URL? (requests will contain cache_control, but no ttl!)","summary":"Wants the documented \"ttl\": \"1h\" prompt-caching option but finds only ENABLE_PROMPT_CACHING_1H_BEDROCK exists as an env switch. Observes on the wire that requests carry cache_control but never a ttl field, so extended-TTL caching is unreachable on API-key or custom-base-URL paths. Negative.","claim_ids":["c12"],"hash":"e902faed1d948e07085fc9c58c9403d6780a527c8307baab34f68dc23eb98b6c"},{"id":"s20","type":"hn","url":"https://news.ycombinator.com/item?id=48167243","title":"Comment on \"Zerostack – a coding agent in pure Rust\" — missing cache_control","quote":"In the Anthropic implementation it doesn't seem to be using 'cache_control' in the body. Assuming my understanding is current, without that the Anthropic API won't do any caching at all","summary":"Read an agent's source and found its Anthropic path never sets cache_control, meaning full input price on every turn, unlike providers that cache automatically. Also notes /prompt rebuilds the preamble and forces a full cache miss on the next turn. Negative — the cache_control-is-opt-in gotcha caught in the wild.","claim_ids":["c12"],"hash":"0c3afb88e7d1a61395fda26ec30e9d3e7f8174eced04632c1bf72ca80e7748d7"},{"id":"s21","type":"hn","url":"https://news.ycombinator.com/item?id=45518040","title":"Show HN: Autocache – Cut Claude API costs 90% (for n8n, Flowise, etc.)","quote":"For a 1000-token system prompt reused across requests, you pay 1.25× once to cache it, then 0.1× on every   subsequent request.","summary":"Built a transparent proxy that analyses each Messages API request and places cache breakpoints automatically, because Anthropic requires manual placement and integrations like n8n and Flowise never expose the request structure. States the underlying economics as 1.25x write, 0.1x read. Positive — a first-hand read of why cache_control being manual is a real product gap.","claim_ids":["c10"],"hash":"a70551b211e9f8badab01264126e46fc82046dea49720147ae9cfc3bdcff267c"},{"id":"s22","type":"repository","url":"https://github.com/massoumicyrus/claude-code-cloudflare-gateway","title":"A Messages-to-Chat-Completions translation layer","quote":"Claude Code speaks the Anthropic Messages API (`POST /v1/messages`) and every other model in the Cloudflare catalogue is Chat Completions.","summary":"Public one-file implementation and contract suite showing which Messages fields a compatibility translator must preserve.","claim_ids":["c16"],"hash":"b969c51986118522cf93d945f77209e31007b442d6c53cbc32b86528899917b3"},{"id":"s23","type":"independent_measurement","url":"https://github.com/agentgateway/agentgateway/issues/2628","title":"Independent A/B measurement: cache_control direct to Bedrock versus through a proxy","quote":"When sending a request through agentgateway with Anthropic `cache_control` markers in the system prompt, the field is silently dropped before the request reaches Bedrock. As a result, prompt caching never activates","summary":"Named A/B harness: the same request produced cache_read_input_tokens on its second direct Bedrock call and zero cache reads through agentgateway.","claim_ids":["c12","c17"],"hash":"3ad85f732ba308326f3ea99c21fbd070622182424f4012f26cbd6e0426689af9"},{"id":"r1","type":"runtime_receipt","url":"https://miscsubjects.com/api/articles/what-is-the-anthropic-messages-api","title":"First-party wire receipt: message creation and count_tokens, 2026-07-26","quote":"HTTP 200; 507 response bytes in 1.649598 s; `stop_reason: \"max_tokens\"`; 19 input and 64 output tokens","summary":"Method: run the same system and user prompt through the live Messages translator and its count_tokens endpoint; compare usage without exposing the path credential.","claim_ids":["c13","c16","c8"],"hash":"00f0a4223af47d6fccbfe744227e314a99d4770d956b17dd40e2b12f98553a8f"},{"id":"r2","type":"runtime_receipt","url":"https://miscsubjects.com/api/articles/what-is-the-anthropic-messages-api","title":"First-party wire receipt: streamed forced tool call, 2026-07-26","quote":"HTTP 200; 1,491 response bytes in 1.201516 s; 11 SSE frames; compacting six `input_json_delta` fragments produced `{\"city\":\"Dallas\"}`","summary":"Method: force get_weather through tool_choice, buffer partial_json by content-block index, and parse only after the block stops.","claim_ids":["c16","c7"],"hash":"29ebad937a3d24fea57076ad825c23b2bcff0006885a717f34f6d01ab2d3df44"},{"id":"r3","type":"runtime_receipt","url":"https://miscsubjects.com/api/articles/what-is-the-anthropic-messages-api","title":"First-party wire receipt: authentication precedes version validation, 2026-07-26","quote":"No key and no version | HTTP 401; `x-api-key header is required`; `request-id` present; `x-should-retry: false`","summary":"Method: POST the same harmless one-token body three times to api.anthropic.com, varying only x-api-key and anthropic-version. Every response included request-id and x-should-retry:false.","claim_ids":["c1","c14","c2"],"hash":"a098f11e67adeae609ba7879717be54316ee2b92eba9966aadd176c4d51638b5"},{"id":"r4","type":"runtime_receipt","url":"https://miscsubjects.com/api/articles/what-is-the-anthropic-messages-api","title":"First-party compatibility probes for DeepSeek, Z.ai and Moonshot, 2026-07-26","quote":"The same credential-free request body reached all three Anthropic-shaped routes on 2026-07-26 and all returned HTTP 401","summary":"Method: send the same harmless Anthropic-shaped body with no credential to each published base URL. Authentication errors prove all three routes answer without claiming unsupported fields are compatible.","claim_ids":["c15"],"hash":"eddf42f93973fe3913739d557c41a236bbf884dc7bb54fb88fb495b8a50f21bc"}],"anecdotal_sources":[],"scientific_sources":[],"user_reports":[],"related_articles":[],"question_graph":{"slug":"what-is-the-anthropic-messages-api","questions":[],"evidence":[],"edges":[],"counts":{"questions":0,"evidence":0,"edges":0}},"honesty":{"active_claims":18,"retracted_claims":0,"cut_claims":0,"challenges":0,"scrub_events":0,"note":"Retracted/cut claims stay on ledger but are excluded from ask unless ?include_inactive=1"},"counts":{"claims":18,"claims_total":18,"sources":27,"anecdotal":0,"scientific":0,"user_reports":0,"questions":0,"evidence_ingests":0}}