Claude API
Kocoro-lab/Kocoro
Build apps with the Claude API or Anthropic SDK. An agent skill from Kocoro-lab/Kocoro.
Anthropic Claude API patterns for Python and TypeScript. An agent skill from loulanyue/awesome-claude-notes.
$ npx skills add loulanyue/awesome-claude-notes --skill claude-api -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install loulanyue/awesome-claude-notes claude-api --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/loulanyue/awesome-claude-notes.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/claude-api .claude/skills/claude-api && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "claude-api" agent skill from https://github.com/loulanyue/awesome-claude-notes/tree/main/skills/claude-api into .claude/skills/claude-api/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "claude-api", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/loulanyue/awesome-claude-notes/tree/main/skills/claude-apiType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add loulanyue/awesome-claude-notes --skill claude-api -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install loulanyue/awesome-claude-notes claude-api --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/loulanyue/awesome-claude-notes.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/claude-api .agents/skills/claude-api && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "claude-api" agent skill from https://github.com/loulanyue/awesome-claude-notes/tree/main/skills/claude-api into .agents/skills/claude-api/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "claude-api", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add loulanyue/awesome-claude-notes --skill claude-api -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install loulanyue/awesome-claude-notes claude-api --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/loulanyue/awesome-claude-notes.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/claude-api .cursor/skills/claude-api && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "claude-api" agent skill from https://github.com/loulanyue/awesome-claude-notes/tree/main/skills/claude-api into .cursor/skills/claude-api/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "claude-api", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/loulanyue/awesome-claude-notes.git --path skills/claude-api--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add loulanyue/awesome-claude-notes --skill claude-api -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install loulanyue/awesome-claude-notes claude-api --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/loulanyue/awesome-claude-notes.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/claude-api .gemini/skills/claude-api && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "claude-api" agent skill from https://github.com/loulanyue/awesome-claude-notes/tree/main/skills/claude-api into .gemini/skills/claude-api/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "claude-api", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install loulanyue/awesome-claude-notes claude-apiInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add loulanyue/awesome-claude-notes --skill claude-api -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/loulanyue/awesome-claude-notes.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/claude-api .github/skills/claude-api && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "claude-api" agent skill from https://github.com/loulanyue/awesome-claude-notes/tree/main/skills/claude-api into .github/skills/claude-api/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "claude-api", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add loulanyue/awesome-claude-notes --skill claude-api -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install loulanyue/awesome-claude-notes claude-api --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/loulanyue/awesome-claude-notes.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/claude-api .opencode/skills/claude-api && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "claude-api" agent skill from https://github.com/loulanyue/awesome-claude-notes/tree/main/skills/claude-api into .opencode/skills/claude-api/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "claude-api", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
claude-apiAnthropic Claude API patterns for Python and TypeScript. An agent skill from loulanyue/awesome-claude-notes.
Claude API is an agent skill from loulanyue/awesome-claude-notes. Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.
Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in AI & LLM Engineering, covering LLM API integration and LLM cost and token optimization. It works with Anthropic API, Claude Agent SDK, Python and TypeScript. The repository describes itself as: Community-maintained distribution of reusable AI coding agents, commands, skills, hooks, and cross-harness workflows. The licence is MIT.
Read from SKILL.md and the folder at commit 866b55b. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
pipnpmFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md. Its commands use pip and npm, which can reach the network depending on how they are called.
From URLs in SKILL.md, links to its own repository left out.
Names these keys or tokens, usually read from environment variables:
ANTHROPIC_API_KEYFrom names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Claude API loads about 2.1k tokens when it runs. Until then it costs about 63 tokens; SKILL.md has 230 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from loulanyue/awesome-claude-notes at commit 866b55b, republished under its MIT licence (© loulanyue). 230 words, ~2,136 tokens.
.claude/skills/claude-api/SKILL.md (or your agent's skills folder).Build applications with the Anthropic Claude API and SDKs.
anthropic (Python) or @anthropic-ai/sdk (TypeScript)| 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.
pip install anthropicimport 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)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)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"}]
)npm install @anthropic-ai/sdkimport 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);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);
}
}Define tools and let Claude call them:
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?"},
{"role": "assistant", "content": message.content},
{"role": "user", "content": [
{"type": "tool_result", "tool_use_id": block.id, "content": str(result)}
]}
]
)Send images for analysis:
import base64
with open("diagram.png", "rb") as f:
image_data = base64.standard_b64encode(f.read()).decode("utf-8")
message = client.messages.create(
model="claude-sonnet-4-0",
max_tokens=1024,
messages=[{
"role": "user",
"content": [
{"type": "image", "source": {"type": "base64", "media_type": "image/png", "data": image_data}},
{"type": "text", "text": "Describe this diagram"}
]
}]
)For complex reasoning tasks:
message = client.messages.create(
model="claude-sonnet-4-0",
max_tokens=16000,
thinking={
"type": "enabled",
"budget_tokens": 10000
},
messages=[{"role": "user", "content": "Solve this math problem step by step..."}]
)
for block in message.content:
if block.type == "thinking":
print(f"Thinking: {block.thinking}")
elif block.type == "text":
print(f"Answer: {block.text}")Cache large system prompts or context to reduce costs:
message = client.messages.create(
model="claude-sonnet-4-0",
max_tokens=1024,
system=[
{"type": "text", "text": large_system_prompt, "cache_control": {"type": "ephemeral"}}
],
messages=[{"role": "user", "content": "Question about the cached context"}]
)
# Check cache usage
print(f"Cache read: {message.usage.cache_read_input_tokens}")
print(f"Cache creation: {message.usage.cache_creation_input_tokens}")Process large volumes asynchronously at 50% cost reduction:
import time
batch = client.messages.batches.create(
requests=[
{
"custom_id": f"request-{i}",
"params": {
"model": "claude-sonnet-4-0",
"max_tokens": 1024,
"messages": [{"role": "user", "content": prompt}]
}
}
for i, prompt in enumerate(prompts)
]
)
# Poll for completion
while True:
status = client.messages.batches.retrieve(batch.id)
if status.processing_status == "ended":
break
time.sleep(30)
# Get results
for result in client.messages.batches.results(batch.id):
print(result.result.message.content[0].text)Build multi-step agents:
# Note: Agent SDK API surface may change — check official docs
import anthropic
# Define tools as functions
tools = [{
"name": "search_codebase",
"description": "Search the codebase for relevant code",
"input_schema": {
"type": "object",
"properties": {"query": {"type": "string"}},
"required": ["query"]
}
}]
# Run an agentic loop with tool use
client = anthropic.Anthropic()
messages = [{"role": "user", "content": "Review the auth module for security issues"}]
while True:
response = client.messages.create(
model="claude-sonnet-4-0",
max_tokens=4096,
tools=tools,
messages=messages,
)
if response.stop_reason == "end_turn":
break
# Handle tool calls and continue the loop
messages.append({"role": "assistant", "content": response.content})
# ... execute tools and append tool_result messages| Strategy | Savings | When to Use |
|---|---|---|
| Prompt caching | Up to 90% on cached tokens | Repeated system prompts or context |
| Batches API | 50% | Non-time-sensitive bulk processing |
| Haiku instead of Sonnet | ~75% | Simple tasks, classification, extraction |
| Shorter max_tokens | Variable | When you know output will be short |
| Streaming | None (same cost) | Better UX, same price |
import time
from anthropic import APIError, RateLimitError, APIConnectionError
try:
message = client.messages.create(...)
except RateLimitError:
# Back off and retry
time.sleep(60)
except APIConnectionError:
# Network issue, retry with backoff
pass
except APIError as e:
print(f"API error {e.status_code}: {e.message}")# Required
export ANTHROPIC_API_KEY="your-api-key-here"
# Optional: set default model
export ANTHROPIC_MODEL="claude-sonnet-4-0"Never hardcode API keys. Always use environment variables.
© loulanyue, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skills/claude-api of loulanyue/awesome-claude-notes.
Open the folder on GitHubat commit 866b55b
We found 8 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in loulanyue/awesome-claude-notes, which our catalogue first saw on October 9, 2026.
Claude API next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Claude API this skillloulanyue/awesome-claude-notes | 272 | 2 repos | ~2.1k | Automated safety check: Pass | MIT | |
| Claude APIKocoro-lab/Kocoro | 414 | 7 repos | ~4.5k | Automated safety check: Pass | Apache-2.0 | |
| Claude API Developmentwarpdotdev/warp | 65k | 3 repos | ~8.2k | Automated safety check: Pass | Apache-2.0 | |
| Anth Install Authjeremylongshore/tons-of-skills-marketplace | 2.8k | — | ~1.2k | Automated safety check: Notes | MIT | |
| Anth SDK Patternsjeremylongshore/tons-of-skills-marketplace | 2.8k | — | ~1.9k | Automated safety check: Pass | MIT | |
| Anth Upgrade Migrationjeremylongshore/tons-of-skills-marketplace | 2.8k | — | ~1.7k | Automated safety check: Pass | MIT |
Kocoro-lab/Kocoro
Build apps with the Claude API or Anthropic SDK. An agent skill from Kocoro-lab/Kocoro.
warpdotdev/warp
Guides building, debugging and tuning apps on the Claude API and Anthropic SDK, including prompt caching, and migrating code between Claude model versions.
jeremylongshore/tons-of-skills-marketplace
Install and configure Anthropic Claude SDK authentication for Python and TypeScript.
jeremylongshore/tons-of-skills-marketplace
Apply production-ready Anthropic SDK patterns for TypeScript and Python.
jeremylongshore/tons-of-skills-marketplace
Upgrade Anthropic SDK versions and migrate between Claude API versions.
jeremylongshore/tons-of-skills-marketplace
Production-ready Anthropic SDK patterns — client config, retries, timeouts, Use when working with sdk-patterns patterns.
loulanyue/awesome-claude-notes
Interactive agent picker for composing and dispatching parallel teams
loulanyue/awesome-claude-notes
Orchestrate multi-agent coding tasks via Claude DevFleet — plan projects, dispatch parallel agents in isolated worktrees, monitor progress, and read structured reports.
loulanyue/awesome-claude-notes
Interactive installer for awesome claude notes — guides users through selecting and installing skills and rules to user-level or project-level directories, verifies paths, and optionally optimizes…
loulanyue/awesome-claude-notes
Anthropic Claude API 的 Python 和 TypeScript 使用模式。涵盖 Messages API、流式处理、工具使用、视觉功能、扩展思维、批量处理、提示缓存和 Claude Agent SDK。适用于使用 Claude API 或 Anthropic SDK 构建应用程序的场景。
loulanyue/awesome-claude-notes
awesome claude notes のインタラクティブなインストーラー — スキルとルールの選択とインストールをユーザーレベルまたはプロジェクトレベルのディレクトリへガイドし、パスを検証し、必要に応じてインストールされたファイルを最適化します。
loulanyue/awesome-claude-notes
awesome claude notes 的交互式安装程序 — 引导用户选择并安装技能和规则到用户级或项目级目录,验证路径,并可选择优化已安装文件。
Categories
Anthropic Claude API patterns for Python and TypeScript. An agent skill from loulanyue/awesome-claude-notes. Claude API is an agent skill from loulanyue/awesome-claude-notes. Anthropic Claude API patterns for Python and TypeScript.
Claude API fits situations like: building applications with the Claude API; tasks that involve LLM API integration; tasks that involve LLM cost and token optimization.
Run `npx skills add loulanyue/awesome-claude-notes --skill claude-api -a claude-code`. Or copy the skill folder (skills/claude-api in loulanyue/awesome-claude-notes) into .claude/skills/claude-api in your project. Claude Code loads it when a task matches its description.
Run `npx skills add loulanyue/awesome-claude-notes --skill claude-api -a codex`. Or copy the skill folder (skills/claude-api in loulanyue/awesome-claude-notes) into .agents/skills/claude-api in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add loulanyue/awesome-claude-notes --skill claude-api -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/claude-api, .gemini/skills/claude-api, .github/skills/claude-api and .opencode/skills/claude-api in your project.
Going by SKILL.md and its folder, Claude API needs the command-line tools its instructions call (pip and npm) and credentials named ANTHROPIC_API_KEY. Our summary lists: Python 3; Node.js; A credential in ANTHROPIC_API_KEY.
SKILL.md contains no URLs. Its commands use pip and npm, which can reach the network depending on how they are called. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Claude API is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.1k tokens (SKILL.md is roughly 8.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Claude API: Claude API (Kocoro-lab/Kocoro, 414 stars), Claude API Development (warpdotdev/warp, 65k stars), Anth Install Auth (jeremylongshore/tons-of-skills-marketplace, 2.8k stars) and Anth SDK Patterns (jeremylongshore/tons-of-skills-marketplace, 2.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
loulanyue (a GitHub user) maintains it in loulanyue/awesome-claude-notes, which has 272 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on October 5, 2026.
Source: loulanyue/awesome-claude-notes on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.