Agent skill · marketing growth · jeremylongshore

anth-cost-tuning

Optimize Anthropic Claude API costs with model routing, prompt caching,

Why this skill is useful

Adds executable scripts for cost estimation, model routing, and spend tracking that optimize Claude API usage and reduce costs.

What it needs

Requires python installed locally. Requires anthropic account access. About 4k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.

What this skill does

Anthropic Cost Tuning Overview Optimize Claude API spend through model routing, prompt caching, the Message Batches API, and real-time cost tracking. The four biggest levers: model selection (4-19x), prompt caching (10x input), batches (2x), and maxtokens discipline. Pricing Reference (per million tokens) Model Input Output Cache Read Cache Write ------- ------- -------- ------------ ------------- Claude Haiku $0.80 $4.00 $0.08 $1.00 Claude Sonnet $3.00 $15.00 $0.30 $3.75 Claude Opus $15.00 $75.00 $1.50 $18.75 Message Batches: 50% off all model pricing for async processing. Cost Calculator Strategy 1: Model Routing Strategy 2: Prompt Caching Strategy 3: Batches for Non-Real-Time Strategy 4: Spend Tracking Cost Reduction Checklist [ ] Use Haiku for classification/extraction/routing tasks [ ] Enable prompt caching for repeated system prompts [ ] Use Message Batches for non-real-time processing [ ] Set maxtokens to realistic values (not maximum) [ ] Use prefill to reduce output preamble tokens [ ] Implement spend tracking and budget alerts [ ] Monitor via Usage API Prerequisites Establish an approved budget, billing owner, cost allocation dimensions, and alert thresholds before changing model routing or batch behavior. Use a sandbox workspace, synthetic prompts, pinned model IDs, and a versioned pricing snapshot; confirm current rates in the official pricing documentation before making a forecast. Configure least-privileged credentials and ensure logs/metrics contain token counts and aggregate cost only, never prompt or response content. Instructions 1. Baseline request volume, input/output/cache tokens, latency, quality, and spend by feature using a redacted measurement window. Do not make routing changes from a single outlier. 2. Define a quality floor and route only eligible workloads to the least expensive model that meets it. Use prompt caching only for approved non-sensitive content and batches only where asynchronous completion is acceptable. 3. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills jeremylongshore/anth-cost-tuning--2e769f

View the source on GitHub

Browse the @skills marketplace