Preface

Developers integrating with the Claude API have likely encountered scenarios like this: You just learned about thinking: {type: "enabled", budget_tokens: N} from the documentation, only to get a 400 error when using the same parameter on a newly launched model. Streaming, tool calling, Prompt Caching, and MCP each have their own beta headers and version numbers, forcing you to jump between several pages of official documentation. When mixing Python, TypeScript, and Go in a project, the SDK naming and import paths differ across languages. What’s more troublesome is that AI assistants often write code based on “training memories”, and once model IDs, pricing, or parameter shapes become outdated, troubleshooting costs can be high.

Anthropic maintains an Agent Skill named claude-api in the open-source skills repository, which is also built into Claude Code. Its positioning is straightforward: it packages the Messages API, Claude Managed Agents (beta), and SDK documentation for 8 languages into progressively loadable references, allowing AI to read the “current version” specifications before writing Claude-related code instead of guessing.

What it is

claude-api is an open-source Agent Skill developed by Anthropic that follows the universal SKILL.md format, and can be used in AI programming environments that support Agent Skills such as Claude Code and Cursor.

In one sentence: It is a structured reference for the Claude API / Anthropic SDK, covering topics such as model IDs and pricing, streaming responses, tool calling, MCP, agent construction, Prompt Caching, token counting, and model migration. It automatically loads the corresponding documentation based on the project language, including Python, TypeScript, C#, Go, Java, PHP, Ruby, and cURL.

The official documentation is available at Claude API skill documentation and the repository directory skills/claude-api.

Core Features and Highlights

1. Covers two major API categories

The Skill distinguishes between two types of usage scenarios and provides selection recommendations:

Scenario Recommended Interface Typical Use Case
Classification, summarization, extraction, question answering Messages API (single call) One request, one response
Multi-step pipelines, self-developed tool loops Messages API + Tool Use Orchestrate agent loops on the code side
Managed state, persistent agent configuration Claude Managed Agents (beta) Anthropic-managed loop and session sandbox

The Skill body also differentiates four agent construction methods (manual loop, SDK Tool Runner, Managed Agents, Claude Agent SDK) to avoid confusing different products.

2. SDK documentation for 8 languages, automatically matched by project

The Skill first scans project files to infer the language, then only loads the corresponding subdirectory (such as python/, typescript/, go/). If other SDKs like OpenAI are detected and the user has not requested a switch, it will prompt that this Skill produces Anthropic code to avoid accidental modification of files.

All languages support the Messages API; Python, TypeScript, Java, Go, Ruby, C#, and PHP also support the beta version of Tool Runner and Managed Agents; cURL provides raw HTTP examples.

3. Progressive disclosure to control context volume

Consistent with the general mechanism of Agent Skills (see official overview):
- Level 1: YAML metadata (name, description) stays resident, consuming about a hundred tokens;
- Level 2: Read the SKILL.md body after triggering;
- Level 3: Load附属 files such as shared/, language-specific READMEs, and migration guides on demand.

This allows the Skill to bundle a large amount of API reference content without filling up the context during every conversation.

4. Emphasizes “API Drift” and model migration

The Skill includes a built-in API Drift comparison table. For example: budget_tokens has been deprecated on Claude 4.6+, and you should use thinking: {type: "adaptive"} instead; Web Search / Web Fetch tool types have new versions such as _20260209. It also provides the /claude-api migrate subcommand to batch modify model IDs, beta headers, prefill writing styles, etc., according to the official migration guide.

5. Quick reference for common capabilities

The verified documentation includes Quick Reference for the following topics (details are in each language’s README or shared/ files):
- Streaming: Long input/output recommends streaming by default, with auxiliary methods such as get_final_message() available in the SDK;
- Tool calling: User-defined tools, Server Tools (web search, code execution, etc.), Tool Runner;
- Prompt Caching: Prefix matching, breakpoint placement, silent failure troubleshooting;
- Token counting: POST /v1/messages/count_tokens;
- MCP / Agent: Managed Agents’ Agent → Session workflow, vault credentials, Skills + MCP combination;
- Model information: Cached model IDs, context windows and pricing tables, and recommends using the Models API for real-time capability queries.

Installation and Activation

Claude Code (built-in, no installation required)

claude-api is released with Claude Code. It will be automatically activated when the project has import anthropic / @anthropic-ai/sdk, or when you ask questions related to the Claude API. You can also manually input:

/claude-api

For more details, see Claude Code Skills documentation.

Install from GitHub repository

The official universal installation command:

npx skills add https://github.com/anthropics/skills --skill claude-api

Claude Code plugin method

/plugin marketplace add anthropics/skills
/plugin install claude-api@anthropic-agent-skills

Manual placement (Claude Code custom Skill directory)

If you need to maintain a copy yourself, Claude Code supports:
- Personal: ~/.claude/skills/
- Project: .claude/skills/

Copy the skills/claude-api directory (including SKILL.md and subdirectories) from the repository to the above path. Tools like Cursor that support the same SKILL.md specification can also place it in the corresponding skills directory according to each tool’s conventions (such as the project’s .cursor/skills/).

Typical Usage Examples

Build a streaming chat (triggered by natural language)

Directly describe the task in an environment where the Skill is installed, and the Skill will load the corresponding language documentation:

Build a streaming chat UI with the Claude API in TypeScript

Model migration (subcommand)

/claude-api migrate everything under src/ to claude-opus-5

You can also specify a file scope:

/claude-api migrate apps/api.py and apps/worker.py to claude-opus-5

The Skill will first confirm the migration scope, then modify it step by step according to shared/model-migration.md, and provide manual verification check items at the end.

Create a new Managed Agent (subcommand)

/claude-api managed-agents-onboard

This process guides you through an interview: agent configuration (created once) → Session (run each time), and generates runnable sample code in the corresponding language. Managed Agents require the beta header managed-agents-2026-04-01, and the official SDK will automatically set it in relevant calls.

The Skill recommends using the official SDK by default instead of bare HTTP. The following is a common pattern for the Messages API (refer to the {lang}/ documentation in the Skill for parameters):

import anthropic

client = anthropic.Anthropic()

with client.messages.stream(
    model="claude-opus-5",
    max_tokens=4096,
    thinking={"type": "adaptive"},
    messages=[{"role": "user", "content": "Hello"}],
) as stream:
    message = stream.get_final_message()
    print(message.content[0].text)

Applicable Scenarios and Notes

Who is it suitable for?

  • Application developers who are integrating the Claude API or Anthropic SDK;
  • Backend/full-stack teams that need to maintain consistent API usage across multi-language monorepos;
  • Projects planning to migrate from older models (such as Opus 4.8) to Opus 5 / Sonnet 5;
  • Agent developers trying Claude Managed Agents (beta).

Scenarios where it will not be activated

Official documentation clearly states that if the task is related to other vendors’ SDKs such as OpenAI and Gemini, or only general programming/data science issues, the Skill will not intervene. The Skill’s description also requires skipping when the project mainly uses other LLM providers.

Usage notes

  1. Managed Agents platform restrictions: Currently applicable to Claude API and Claude Platform on AWS, not supporting Amazon Bedrock, Google Vertex AI, or Microsoft Foundry; the Skill will route such deployments to Messages API + Tool Use.
  2. Claude Agent SDK vs Tool Runner: The former is a packaged library built into Claude Code (with built-in Read/Write/Bash, etc.), while the latter is a beta tool loop auxiliary tool in the regular SDK; the Skill covers API integrations other than the former, and does not replace the Agent SDK documentation.
  3. Document timeliness: The model table has a cache date. When involving “whether a certain model supports a certain capability”, the Skill recommends calling the Models API for real-time queries.
  4. Security: The Skill comes from the official Anthropic repository; when installing from a third-party fork, you should audit the SKILL.md and script content, just like installing any open-source tool.

Summary

The claude-api Skill consolidates Claude API knowledge scattered across multiple official documents into an executable reference package for AI: it automatically identifies languages, loads content progressively, and includes built-in migration and Managed Agents guidance, which can significantly reduce the problem of “writing expired APIs from memory”. If you are already using Claude Code, it is available by default; other environments can install it from GitHub or copy the Skill directory.

Official resources:
- Skill source code: https://github.com/anthropics/skills/tree/main/skills/claude-api
- Official introduction: https://platform.claude.com/docs/en/agents-and-tools/agent-skills/claude-api-skill
- Agent Skills overview: https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview