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-nevaberry-plugins)
---
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 integrations, Managed Agents, or organization administration.
Use the topic references for model-specific behavior, provider differences, and
the full request, response, and lifecycle details.
## Reference index
| Reference | Topics |
| --- | --- |
| [Models and migrations](references/models-and-migrations.md) | Request migrations, thinking, replay, context, model IDs, pricing, refusals, fallback, fast mode, retirement |
| [Platforms and limits](references/platforms-and-limits.md) | Capability discovery, hosted APIs, budgets, quotas, spend errors, SDK migration, observability, provenance |
| [Prompt caching](references/prompt-caching.md) | Breakpoints, minimum prefixes, TTLs, invalidation, diagnostics, warming, cache pricing |
| [Structured output](references/structured-output.md) | Format migration, SDK helpers, raw schemas, limits, casing, citations, retention |
| [Tools and streaming](references/tools-and-streaming.md) | Beta headers, eager input, tool choice, toolsets, advisors, web tools, stream assembly and recovery |
| [Managed Agents and administration](references/managed-agents.md) | Sessions, deployments, memory, Dreams, web restrictions, Files, Skills, keys, compliance, analytics |
## Breaking changes and deprecations
- Replace manual thinking budgets with adaptive thinking on `claude-opus-5`,
`claude-sonnet-5`, `claude-opus-4-7`, `claude-opus-4-8`, `claude-fable-5`, and
`claude-mythos-5`; legacy enabled-thinking requests return HTTP 400.
Revisit `max_tokens` because thinking shares the output limit with response text.
- Omit `temperature`, `top_p`, and `top_k` when migrating to those 5 targets.
Non-default values return HTTP 400, including on `claude-opus-4-7`.
Python SDK v1.0 and later raises `TypeError` for these keyword arguments.
- Assistant prefills return HTTP 400 starting with `claude-opus-4-6` and
`claude-sonnet-4-6`, and on `claude-opus-5`, `claude-sonnet-5`, `claude-fable-5`,
and `claude-mythos-5`. Move formatting instructions to `system` or use
`output_config.format`. JSON outputs also reject prefills on other targets.
- Move deprecated `output_format` specifications to `output_config.format`.
Adaptive thinking and effort use `client.messages.create`; remove the retired
headers described in the models reference.
- `claude-fable-5-1`, `claude-mythos-5-1`, `claude-opus-5-5`, and
`claude-sonnet-5-5` reject `tool_choice` types `any` and `tool`.
Use `auto` with `strict: true` when schema-valid tool arguments are needed.
- The direct API rejects the `claude-sonnet-4-5` alias. Its dated snapshot was
scheduled to retire November 30, 2026; migrate to `claude-sonnet-5-5`.
Opus 4.5 retirement is 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 that traffic to `claude-opus-5-5`.
To keep a managed agent on Opus 4.8, replace its `model` object without `speed`,
repeat the settings to retain, and use the new agent version.
- The experimental generate, improve, and templatize prompt endpoints retired
August 17, 2026 and return errors. Playground replaced the legacy Workbench
without its saved prompts, variables, or evals.
## Thinking controls and history
| Target | Thinking control |
| --- | --- |
| `claude-opus-5` | Adaptive by default; disabled thinking works at `high` or below and errors at `xhigh` or `max` |
| `claude-sonnet-5` | Adaptive by default; disabled thinking works at any supported effort |
| `claude-fable-5`, `claude-mythos-5` | Always adaptive; disabling thinking errors at every effort |
| `claude-opus-5-5` | Always adaptive; `enabled` and `disabled` both error; control depth with `output_config.effort` |
| `claude-sonnet-5-5` | `between_tools` at `high` or below skips up-front thinking |
| `claude-fable-5-2`, `claude-mythos-5-2` | Always-on adaptive thinking |
Set `thinking.display` to `"summarized"` for visible summaries on targets whose
default is `"omitted"`. With omitted display, streamed thinking contains a single
`signature_delta`; preserve its `signature` when assembling the block for replay.
For ordinary cross-model replay, strip `thinking` and `redacted_thinking` blocks.
Fable 5.1 accepts earlier thinking; replay to earlier targets drops its blocks,
excluding them from input tokens and billing. The two 5.2 targets accept other
models' thinking on the direct API and the Google-managed Google Cloud service;
switching from either to a model outside the pair succeeds and drops their blocks.
Fable 5.1 prefix checks are enforced by default for accounts created on or after
August 31, 2026. Editing earlier messages, `system`, `tools`, or attachment bytes
invalidates later thinking. The `thinking-binding-controls-2026-08-01` beta supports
`thinking.block_binding.prefix_mismatch_behavior: "drop_block"` and reports
transformations. Both 5.2 targets enforce prefix checks for every account.
Use on-demand compaction with `compact-2026-09-04` and top-level `compaction` on
direct Messages requests. Replay the signed summary first, replacing compacted
messages, followed by recent turns kept verbatim. See the models reference for
automatic compaction, context editing, and mid-conversation instruction changes.
## Refusals, fallback, and retention
Handle `stop_reason: "refusal"` even when the response is HTTP 200. Read
`stop_details.category` and `stop_details.explanation`; the category can be `null`.
For a classifier-stopped Fable 5 stream, discard partial output and count input
and already-streamed output as billable.
Across platforms, pre-output refusals with categories `bio`, `frontier_llm`, or
`reasoning_extraction` are billed at the serving model's normal rates. Other
pre-output refusals are free; mid-stream refusals are billed. Fallback credit
refunds prompt-cache switching costs when retrying on another model.
On direct Messages requests, pair `"fallbacks": "default"` with
`server-side-fallback-2026-07-01`. The IAM-authenticated AWS platform also supports
server-side fallback. Use client handling for Message Batches and providers
where the parameter is unavailable; default selection depends on refusal category.
Fable 5 and Mythos 5 require 30-day retention. Their 5.1 and 5.2 targets require
explicit authorization for zero data retention. The Enterprise Frontier Safeguards
beta supports zero retention for eligible organizations using customer-owned
storage; see the platforms reference for the supported offerings and setup link.
## Prompt caching
- A top-level `cache_control` advances an automatic breakpoint as context grows.
It uses one of four slots. On Bedrock, use explicit breakpoints.
- Breakpoint lookup checks up to 20 positions including itself. On the direct
API, consecutive `tool_use` blocks occupy one position, as do consecutive
`tool_result` blocks. Keep a shared-prefix breakpoint within lookup range.
- Prefixes below a model's minimum silently run uncached. The minimum is 512
tokens for Opus 5, Fable 5, Mythos 5, and both 5.1 targets; other minimums are
listed in the reference. Use Bedrock's own minimums and usage fields there.
- Put one-hour breakpoints before five-minute breakpoints. TTL starts when the
request starts, and a new entry becomes readable once its first response begins.
- Place nested-content controls on the parent of `tool_result.content` or
`document.source.content`. Only a last-nested-block marker is promoted.
- Changing thinking mode, budget, or top-level effort invalidates the message
cache and can also invalidate tool and system caches, depending on the target.
An explicit default effort matches omitted effort.
- Direct API diagnostics require `diagnostics` on each compared turn, with
`previous_message_id: null` first and the previous response ID thereafter.
Referencing a turn without a fingerprint reports `previous_message_not_found`.
- For zero-output warming, use `max_tokens: 0`, an explicit shared-prefix
breakpoint, a nonblank user placeholder, and matching thinking and effort.
Streaming, enabled manual thinking, JSON output, forced tool choice, and
Message Batches reject this mode; see the reference for batch warming.
## Tools and streamed input
Set `eager_input_streaming: true` per user-defined tool in a streaming request
for unbuffered input without JSON validation. Explicit `false` overrides the
legacy streaming header. That header conflicts with computer and browser toolsets;
remove it and use the per-tool setting.
If assembled input is malformed or truncated at `max_tokens`, return an error
`tool_result` for the same `tool_use_id`, serializing the raw input under
`INVALID_JSON` as string `content`. Decode tool arguments with a JSON parser before
matching them; tool strings preserve trailing newlines starting with 4.5.
Use `computer_toolset_20260801` for the supported direct and Google Cloud routes;
older computer versions have model-specific HTTP 400 failures and Bedrock
exceptions. The tools reference lists exact model/provider combinations, browser
toolsets, SDK callbacks, code-execution versions, and advisor compatibility.
Streamed web search results arrive in `content_block_start`; match `tool_use_id`
to the call's `id`. Use final `message_delta.usage` for updated input tokens and
search counts. Interrupted-stream recovery on 4.6 and later is limited to text:
send the received text and a continuation instruction in a new user message.
## Structured JSON contracts
- Set `additionalProperties: false` on every object. The only array size
constraint is `minItems` with `0` or `1`; use primitive enums and local,
nonrecursive `$ref` references outside `allOf`.
- Count schema limits across the final output and all strict tools: up to 20
strict tools, 24 optional parameters, and 16 union parameters per request.
Combined complexity can still fail compilation, which also has a 180-second timeout.
- String `enum` and `const` capitalization can vary with an ordinary stop reason.
Compare case-insensitively and keep allowed values distinct after case folding.
- Required properties precede optional properties, preserving schema order within
each group. Python, TypeScript, Ruby, PHP, and native-type C#/Go schema helpers
simplify schemas and validate responses against the original schema.
- Citations with `output_config.format` return HTTP 400; changing the format
invalidates the conversation's prompt cache. Schemas can be retained for up to
24 hours after last use even on requests eligible for zero data retention.
## Limits, SDKs, and operational errors
Read `max_input_tokens`, `max_tokens`, `line`, and `capabilities` from the Models
API. Distinguish `capabilities.server_tools.code_execution` availability from
`capabilities.code_execution`, which indicates whether executed code can call
the request's other tools. The direct Messages and Token Counting limit is 128 MB.
Monthly tier caps return HTTP 429 without `retry-after`; on Messages inspect
`error.details.error_code` for `enforced_spend_limit_reached` and suspend retries
until the next month's first day at 00:00 UTC or restored access. User-configured
spend limits usually return HTTP 400; the coding CLI has a documented 429 exception.
Python SDK v1 requires Python 3.10 or later and uses `httpx2`; async raw responses require
`await response.parse()`, and Bedrock requires an explicitly configured AWS region.
The platforms reference lists SDK releases defaulting to API version `2026-10-21`
and the migration guide for their independent breaking changes.
## Managed Agents and organization APIs
Set session or deployment budgets to pause at `budget_reached` before another
model request. Update agents with `version` for optimistic concurrency and handle
HTTP 409; omit it for unconditional updates. Use the managed reference for session
overrides, event previews, scheduling, dynamic workflows, and memory migration.
In limited cloud networking, web tools require an `allowed_hosts` match even when
package-manager or MCP allowances are enabled. Managed fetch also requires prior
eligible URL context; pass URLs from attachments, system prompts, agent output,
or sandbox/MCP results in the text of a `user.message` event.
Use stable `client.organization` and `ant organization` namespaces where supported.
Compliance retrieval uses a Compliance Access Key with `read:compliance_user_data`.
The administration reference preserves exact scopes, endpoint paths, beta status,
webhook events, transcript surfaces, and analytics counting and re-fetch rules.