
Claude Api
Wire Anthropic’s Messages API, streaming, tools, vision, caching, batches, and Agent SDK patterns in Python or TypeScript apps.
Overview
claude-api is an agent skill for the Build phase that teaches Anthropic Claude API and SDK patterns for Messages, streaming, tool use, vision, caching, batches, and the Agent SDK.
Install
npx skills add https://github.com/affaan-m/everything-claude-code --skill claude-apiWhat is this skill?
- Model selection table for Opus 4.1, Sonnet 4, and Haiku 3.5 with pinned-ID guidance for production
- Python (`anthropic`) and TypeScript (`@anthropic-ai/sdk`) installation and Messages API examples
- Covers streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK
- Activate when code imports Anthropic SDKs or the user asks about API patterns, tokens, or latency
- Documents 3 production model tiers: Opus 4.1, Sonnet 4, and Haiku 3.5 with named model IDs
- Covers Python and TypeScript official SDK entry points
Adoption & trust: 2.4k installs on skills.sh; 210k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You are shipping a Claude-powered feature but lack a consistent reference for models, SDK calls, streaming, tools, and cost controls.
Who is it for?
Solo builders coding agents or SaaS features that directly call Claude via official SDKs.
Skip if: Teams only configuring Claude Code editor rules with no custom API code, or projects on non-Anthropic LLM stacks exclusively.
When should I use this skill?
Building applications that call the Claude API; code imports `anthropic` or `@anthropic-ai/sdk`; user asks about streaming, tool use, vision, Agent SDK, or API cost/latency.
What do I get? / Deliverables
Your app uses documented Python or TypeScript API patterns with the right model tier, streaming, and optimization hooks instead of one-off snippets.
- SDK-aligned message, streaming, and tool-use implementation patterns
- Model and cost-selection guidance for the feature at hand
Recommended Skills
Journey fit
Calling Claude from your product is integration work while you are building backends, agents, and app features. SDK setup, tool use, streaming, and cost controls are external API integrations—not generic PM or docs tasks.
How it compares
Skill package for in-repo API implementation patterns—not a hosted MCP server or generic prompt library.
Common Questions / FAQ
Who is claude-api for?
Developers building applications that call the Claude API in Python or TypeScript, including agent workflows with the Claude Agent SDK.
When should I use claude-api?
During Build → integrations when adding Messages API calls, streaming, tool use, vision, batches, prompt caching, or optimizing tokens and latency.
Is claude-api safe to install?
Check the Security Audits panel on this Prism page; treat API keys as secrets and never commit `ANTHROPIC_API_KEY` to the repo.
SKILL.md
READMESKILL.md - Claude Api
# Claude API Build applications with the Anthropic Claude API and SDKs. ## When to Activate - Building applications that call the Claude API - Code imports `anthropic` (Python) or `@anthropic-ai/sdk` (TypeScript) - User asks about Claude API patterns, tool use, streaming, or vision - Implementing agent workflows with Claude Agent SDK - Optimizing API costs, token usage, or latency ## Model Selection | Model | ID | Best For | |-------|-----|----------| | Opus 4.1 | `claude-opus-4-1` | Complex reasoning, architecture, research | | Sonnet 4 | `claude-sonnet-4-0` | Balanced coding, most development tasks | | Haiku 3.5 | `claude-3-5-haiku-latest` | Fast responses, high-volume, cost-sensitive | Default to Sonnet 4 unless the task requires deep reasoning (Opus) or speed/cost optimization (Haiku). For production, prefer pinned snapshot IDs over aliases. ## Python SDK ### Installation ```bash pip install anthropic ``` ### Basic Message ```python import anthropic client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY from env message = client.messages.create( model="claude-sonnet-4-0", max_tokens=1024, messages=[ {"role": "user", "content": "Explain async/await in Python"} ] ) print(message.content[0].text) ``` ### Streaming ```python with client.messages.stream( model="claude-sonnet-4-0", max_tokens=1024, messages=[{"role": "user", "content": "Write a haiku about coding"}] ) as stream: for text in stream.text_stream: print(text, end="", flush=True) ``` ### System Prompt ```python message = client.messages.create( model="claude-sonnet-4-0", max_tokens=1024, system="You are a senior Python developer. Be concise.", messages=[{"role": "user", "content": "Review this function"}] ) ``` ## TypeScript SDK ### Installation ```bash npm install @anthropic-ai/sdk ``` ### Basic Message ```typescript import Anthropic from "@anthropic-ai/sdk"; const client = new Anthropic(); // reads ANTHROPIC_API_KEY from env const message = await client.messages.create({ model: "claude-sonnet-4-0", max_tokens: 1024, messages: [ { role: "user", content: "Explain async/await in TypeScript" } ], }); console.log(message.content[0].text); ``` ### Streaming ```typescript const stream = client.messages.stream({ model: "claude-sonnet-4-0", max_tokens: 1024, messages: [{ role: "user", content: "Write a haiku" }], }); for await (const event of stream) { if (event.type === "content_block_delta" && event.delta.type === "text_delta") { process.stdout.write(event.delta.text); } } ``` ## Tool Use Define tools and let Claude call them: ```python tools = [ { "name": "get_weather", "description": "Get current weather for a location", "input_schema": { "type": "object", "properties": { "location": {"type": "string", "description": "City name"}, "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]} }, "required": ["location"] } } ] message = client.messages.create( model="claude-sonnet-4-0", max_tokens=1024, tools=tools, messages=[{"role": "user", "content": "What's the weather in SF?"}] ) # Handle tool use response for block in message.content: if block.type == "tool_use": # Execute the tool with block.input result = get_weather(**block.input) # Send result back follow_up = client.messages.create( model="claude-sonnet-4-0", max_tokens=1024, tools=tools, messages=[ {"role": "user", "content": "What's the weather in SF?"},