← ClaudeAtlas

using-claude-apilisted

Use when writing or debugging code that calls Anthropic SDK. Covers Opus 4.7, prompt caching, tool use, vision, batch, thinking.
liujiarui0918/claude-code-codex-strongest · ★ 0 · AI & Automation · score 62
Install: claude install-skill liujiarui0918/claude-code-codex-strongest
# Using Claude API — Practical Patterns This skill complements the official `claude-api` skill with practical patterns and gotchas. Use this when you're writing or modifying code that imports `anthropic` (Python) / `@anthropic-ai/sdk` (TS). ## Iron Law **Prompt caching is not optional on system prompts >1024 tokens. Adding `cache_control` is a 30-second change that cuts cost ~90% and latency ~85% on cache hits. If you write or modify a system prompt without it, you've left money on the table.** ## Model IDs (May 2026) - `claude-opus-4-7` — most capable, 1M context available, supports extended thinking - `claude-sonnet-4-6` — balanced cost/quality, 200K context, supports thinking - `claude-haiku-4-5-20251001` — fastest/cheapest, 200K context - Older `-20241022` / `-20250514` IDs still work but use latest when starting new code. If migrating retired models: see official `claude-api` skill for the mapping. Don't guess. ## Prompt Caching — MUST for System Prompts ```python client.messages.create( model="claude-opus-4-7", system=[ { "type": "text", "text": LONG_SYSTEM_PROMPT, # >1024 tokens "cache_control": {"type": "ephemeral"} } ], messages=[...] ) ``` - Cache lives 5 minutes (refreshes on each hit). - Up to 4 cache breakpoints per request. Put them at stable boundaries (system / tool definitions / docs / dynamic user input). - Order matters: cached prefix must be identical byte-for-byte to hit. Don't