Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Anthropic Api Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-anthropic-api-knowledge-patch)
---
name: anthropic-api-knowledge-patch
description: Anthropic API
version: null
license: MIT
metadata:
author: Nevaberry
---
# Anthropic API Compatibility
Load this skill when implementing or migrating Anthropic API requests, SDK
clients, tool loops, Managed Agents, or platform administration. The references
contain request contracts, platform differences, limits, and migration details.
## Reference index
| Reference | Topics |
| --- | --- |
| [Models and migrations](references/models-and-migrations.md) | Request targets, thinking, replay, context, pricing, refusals, retention |
| [Tools and streaming](references/tools-and-streaming.md) | Tool versions, tool choice, eager input, stream events, beta headers |
| [Caching and rate limits](references/caching-and-rate-limits.md) | Breakpoints, TTLs, cache diagnostics, quotas, spend-cap errors |
| [Structured outputs](references/structured-outputs.md) | Format migration, SDK helpers, schemas, validation, retention |
| [Managed Agents](references/managed-agents.md) | Sessions, permissions, networking, deployments, memory, Dreams |
| [Platforms and lifecycle](references/platforms-and-lifecycle.md) | Retirements, SDKs, hosted APIs, authentication, compliance, analytics |
## Breaking changes and deprecations
### Request fields that fail
Legacy `thinking: {"type":"enabled","budget_tokens":N}` returns HTTP 400 on
`claude-opus-4-7`, `claude-opus-4-8`, `claude-opus-5`, `claude-sonnet-5`,
`claude-fable-5`, and `claude-mythos-5`. Use adaptive thinking and optionally
`output_config.effort`. Thinking and response text share `max_tokens`.
Omit `temperature`, `top_p`, and `top_k` when migrating to those release-5
targets. Non-default sampling values return HTTP 400, including on
`claude-opus-4-7`. Python SDK v1.0 and later raises `TypeError` for these keywords.
Older API targets that accept sampling controls now default `top_p` to `0.99`;
set `0.999` explicitly to preserve the previous behavior.
Assistant prefills return HTTP 400 starting with `claude-opus-4-6` and
`claude-sonnet-4-6` and on those release-5 targets. Move formatting instructions
to `system` or use `output_config.format`. Replace deprecated `output_format`
with `output_config.format`; remove prefills for JSON outputs even on targets
that otherwise accept prefills.
`claude-fable-5-1`, `claude-mythos-5-1`, `claude-opus-5-5`, and
`claude-sonnet-5-5` reject `tool_choice` types `any` and `tool` with HTTP 400.
Use `auto` with `strict: true` on tools when schema-valid arguments are needed.
### Retirements and SDK contracts
The direct API rejects `claude-opus-4-1-20250805`; its retirement notice recommends
`claude-opus-5`. The direct API retired `claude-sonnet-4-5-20250929` and
its `claude-sonnet-4-5` alias on November 30, 2026.
Migrate that Sonnet traffic to `claude-sonnet-5-5`.
`claude-opus-4-5-20251101` and `claude-opus-4-5` are deprecated, with retirement
scheduled for January 22, 2027; migrate to `claude-opus-5-5`.
After the November 30, 2026 fast-mode removal, `claude-opus-4-8` requests with
`speed: "fast"` error. Move fast traffic to `claude-opus-5-5`. To retain Opus 4.8
in a managed agent, replace its `model` object without `speed`, repeat settings
to keep, use the new agent version, and review fallback `speed` settings.
The SDK major releases listed in the platform reference default to API version
`2026-10-21` and also have breaking changes independent of that API version.
Python SDK v1 requires Python 3.10+, uses `httpx2`, requires
`await response.parse()` for async raw responses, and errors when its Bedrock
client has no configured AWS region.
Stable Files and Skills requests omit `files-api-2025-04-14` and
`skills-2025-10-02`. Newer beta SDK namespaces use stable contracts too;
`client.beta.skills.delete()` deletes the skill and all versions.
Memory-store requests use `agent-memory-2026-07-22`; combining it with
`managed-agents-2026-04-01` returns HTTP 400. Restart memory-list pagination
when changing to the new header because older cursors are incompatible.
## Thinking, history, and context
On `claude-opus-5`, disabling thinking works only at `high` effort or below;
on `claude-sonnet-5`, it works at any supported effort. It always fails on
`claude-fable-5` and `claude-mythos-5`. On `claude-opus-5-5`, both manual
`enabled` and `disabled` thinking return HTTP 400. On `claude-sonnet-5-5`,
`between_tools` at `high` or below skips up-front thinking.
Set `thinking.display: "summarized"` when readable summaries are needed.
With `"omitted"`, thinking blocks have empty thinking text; preserve the
signature when assembling streamed blocks for replay. General cross-model
migration guidance strips `thinking` and `redacted_thinking`; the model
reference details the supported one-way replay paths and account restrictions.
On `claude-fable-5-1`, editing earlier messages, top-level `system` or `tools`,
or bytes behind an earlier attachment URL invalidates later thinking blocks.
Default enforcement applies to accounts created on or after August 31, 2026.
The `thinking-binding-controls-2026-08-01` beta supports
`thinking.block_binding.prefix_mismatch_behavior: "drop_block"` and reports
transformations. Removing a thinking block from the middle invalidates later
blocks; removing a leading run oldest-first preserves subsequent blocks.
Both `claude-fable-5-2` and `claude-mythos-5-2` return HTTP 400 for every account
when their thinking is replayed after edits to the preceding system prompt,
tools, or messages. Their blocks can be replayed within the originating account
or a linked account. Supported cross-model acceptance is platform-specific.
For task budgets, send `task-budgets-2026-03-13` on supported targets and set
`output_config.task_budget` to `{"type":"tokens","total":128000}`.
The total must be at least 20,000 and is advisory across thinking, tool calls,
tool results, and final output. It is distinct from a managed session spend cap.
On-demand direct Messages compaction uses `compact-2026-09-04` and top-level
`compaction`. Replay the signed summary first, replacing compacted messages,
then any recent turns retained verbatim. Server-side Messages threads use
`message-threads-2026-08-12`, expire 5 minutes after the last request, and are
deleted within 1 hour of last use on the platforms listed in the model reference.
Handle `model_context_window_exceeded` separately from `max_tokens`.
Use Models API limits and capabilities to select request features; distinguish
`capabilities.server_tools.code_execution` from `capabilities.code_execution`,
which indicates whether executed code can call other request tools.
## Refusals, fallback, and billing
On `claude-fable-5`, a classifier refusal returns HTTP 200 with `stop_reason: "refusal"`.
Read `stop_details.category` (which can be `null`) and `stop_details.explanation`.
Pre-output refusals with categories `bio`, `frontier_llm`, or
`reasoning_extraction` are billed at the serving model's normal rates across
platforms. Other pre-output refusals are free; mid-stream refusals are billed.
Discard partial output when a classifier interrupts a `claude-fable-5` stream.
For direct server-side fallback, send `server-side-fallback-2026-07-01` and
`"fallbacks": "default"` or specified models. The IAM-authenticated hosted
platform API also supports beta fallback. Use client handling for Message Batches
and providers where the parameter is unavailable. Fallback credit refunds the
prompt-cache cost of switching models. Check permitted fallback targets and
retention requirements in the model reference.
## Tool calls, streaming, and structured JSON
In a streaming Messages request, set `eager_input_streaming: true` on a
user-defined tool to receive input without server buffering or JSON validation.
An unset field inherits the legacy header opt-in; explicit `false` keeps
buffering even with that header. The legacy
`fine-grained-tool-streaming-2025-05-14` header conflicts with computer and browser
toolsets: remove it and use the per-tool option.
If assembled tool input cannot be parsed, including truncation at `max_tokens`,
return an error `tool_result` for the same `tool_use_id`. Serialize
`{"INVALID_JSON": raw_input}` with a JSON serializer and use that string as
`content`. Parse serialized tool arguments before matching them; upgrades can
change escaping and argument strings preserve trailing newlines starting with 4.5.
`computer_toolset_20260801` needs no beta header; toolset member options go in
`configs`, zoom defaults on, and a turn can contain batches of actions.
Computer-use versions differ by target and provider; consult the compatibility
entries before keeping an older computer tool. Use `browser_toolset_20260801`
for the application-hosted browser tools.
Structured schemas need `additionalProperties: false` on every object.
Request-wide limits are 20 strict tools, 24 optional parameters, and 16 union
parameters across output and strict tool schemas. Complexity can still cause
HTTP 400, and compilation has a 180-second timeout. String `enum` and `const`
values can vary in capitalization: compare case-insensitively and keep allowed
values distinct after case folding. Citations with `output_config.format` fail.
Read final stream usage: web search can increase input tokens after
`message_start`, and thinking-token details appear only on the final
`message_delta`. On 4.6 and later, interrupted-block recovery is limited to text;
add a `user` message with the received text and a continuation instruction,
then start a new stream.
## Caching and quota handling
Top-level `cache_control` advances an automatic breakpoint with the conversation.
It consumes one of four slots. An explicit control on the same target with a
different TTL, or four existing explicit controls, returns HTTP 400.
On Bedrock, use explicit breakpoints. Place nested-content controls on the parent.
Each breakpoint checks up to 20 positions including itself. On the direct API,
consecutive runs of `tool_use` or `tool_result` each occupy one position.
Put 1-hour controls before 5-minute controls. TTL starts when the request starts;
wait until the first response begins before parallel requests reuse a new entry.
Prefixes below the model minimum silently run uncached.
Cache diagnostics are stable on the direct API. Include `diagnostics` on every
compared turn, with `previous_message_id: null` first and the prior response ID
thereafter. Referencing a turn without a stored fingerprint reports
`previous_message_not_found`; the old header alone does not store a fingerprint.
Monthly tier caps return HTTP 429 `rate_limit_error` without `retry-after`.
For Messages, `error.details.error_code: "enforced_spend_limit_reached"` means
suspend retries until 00:00 UTC on the first of the next month or restored access.
User-configured caps normally return HTTP 400 `invalid_request_error` instead.
Workspace traffic still draws from the organization's shared quota.
## Managed Agents and platform operations
Managed session budgets pause with `budget_reached` before another model request;
changing or removing the budget resumes the session. A nonempty `initial_events`
array starts the loop at creation and accepts up to 50 `user.message` and
`user.define_outcome` events. Agent update `version` enables optimistic concurrency;
a mismatch returns HTTP 409, while omission makes the update unconditional.
In cloud environments with `limited` networking, web tools require matching
`allowed_hosts`, even with package-manager or MCP allowances. Fetch URLs must
also have appeared in eligible prior context. Pass URLs from attachments, system
prompts, agent output, or sandbox/MCP results in a `user.message` text event.
Organization domain restrictions and tool domain rules both apply, including
to redirect targets.
Use `client.organization` or `ant organization` for stable administrative
operations; the platform reference lists SDK versions, authentication, compliance
scopes, analytics corrections, and provider-specific endpoints.