Optimize Anthropic API costs — model selection, prompt caching, batches, Use when working with cost-tuning patterns.

MITAuto-check passedAI & LLM Engineering

Install Clade Cost Tuning

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill clade-cost-tuning -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace clade-cost-tuning --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/clade-cost-tuning .claude/skills/clade-cost-tuning && rm -rf skills-src

Use ~/.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/

Facts

Skill name
clade-cost-tuning
GitHub stars
2.8k
Token cost
~1.3k tokens
SKILL.md length
257 words
Files
2 (incl. references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Optimize Anthropic API costs — model selection, prompt caching, batches, Use when working with cost-tuning patterns.

  • Works in 5 steps: Right-Size Your Model → Prompt Caching (90% off input tokens) → Message Batches (50% off everything) → …
  • Working with cost-tuning patterns
  • SKILL.md covers Overview, Pricing (per million tokens), Cost Reduction Strategies and Instructions, plus 7 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Clade Cost Tuning is an agent skill from jeremylongshore/tons-of-skills-marketplace. Optimize Anthropic API costs — model selection, prompt caching, batches, Use when working with cost-tuning patterns. token reduction, and usage monitoring. Trigger with "anthropic pricing", "claude cost", "reduce anthropic spend", "anthropic billing", "claude cheaper".

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/one-pager.md`). Compatibility notes: Designed for Claude Code

It sits in AI & LLM Engineering, covering LLM cost and token optimization. It works with Anthropic API. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Working with cost-tuning patterns
  • With anthropic pricing
  • Reduce anthropic spend
  • Anthropic billing

Example prompts

  • “anthropic pricing”
  • “claude cost”
  • “reduce anthropic spend”
  • “/clade-cost-tuning”

Requirements

  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Right-Size Your Model
  2. Prompt Caching (90% off input tokens)
  3. Message Batches (50% off everything)
  4. Reduce Token Count
  5. Monitor Usage

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • platform.claude.com
    • anthropic.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Clade Cost Tuning loads about 1.3k tokens when it runs, and up to ~1.8k if it reads all its reference files. Until then it costs about 72 tokens; SKILL.md has 257 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~72
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~1.8k

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.

Safety

Auto-check passed

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.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 257 words, ~1,317 tokens.

Download SKILL.mdSave it as .claude/skills/clade-cost-tuning/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
clade-cost-tuning
description
Optimize Anthropic API costs — model selection, prompt caching, batches, Use when working with cost-tuning patterns. token reduction, and usage monitoring. Trigger with "anthropic pricing", "claude cost", "reduce anthropic spend", "anthropic billing", "claude cheaper".
allowed-tools
Read, Write, Edit
compatibility
Designed for Claude Code
version
1.1.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, anthropic, claude, cost, pricing

Anthropic Cost Tuning

Overview

Anthropic charges per token. Input tokens, output tokens, and cached tokens each have different prices. Here's how to minimize cost without losing quality.

Pricing (per million tokens)

ModelInputOutputCached InputBatch InputBatch Output
Claude Opus 4$15.00$75.00$1.50$7.50$37.50
Claude Sonnet 4$3.00$15.00$0.30$1.50$7.50
Claude Haiku 4.5$0.80$4.00$0.08$0.40$2.00

Cost Reduction Strategies

Instructions

Step 1: Right-Size Your Model
typescript
// DON'T use Opus for everything
// DO match model to task complexity:

// Simple classification/extraction → Haiku (cheapest)
const category = await classify(text, 'claude-haiku-4-5-20251001');

// General coding/writing → Sonnet (balanced)
const code = await generate(spec, 'claude-sonnet-4-20250514');

// Complex multi-step reasoning → Opus (best quality)
const analysis = await analyze(data, 'claude-opus-4-20250514');
Step 2: Prompt Caching (90% off input tokens)
typescript
// Cache your system prompt — pays for itself after 2 calls
const message = await client.messages.create({
  model: 'claude-sonnet-4-20250514',
  max_tokens: 1024,
  system: [{
    type: 'text',
    text: longSystemPrompt, // Must be 1024+ tokens
    cache_control: { type: 'ephemeral' }, // Cache for 5 minutes
  }],
  messages,
}, {
  headers: { 'claude-beta': 'prompt-caching-2024-07-31' },
});

// First call: cache_creation_input_tokens charged at 1.25x
// Subsequent calls: cache_read_input_tokens charged at 0.1x (90% savings!)
Step 3: Message Batches (50% off everything)
typescript
// For non-urgent work — 50% cheaper, 24h processing SLA
const batch = await client.messages.batches.create({
  requests: prompts.map((p, i) => ({
    custom_id: `job-${i}`,
    params: {
      model: 'claude-sonnet-4-20250514',
      max_tokens: 1024,
      messages: [{ role: 'user', content: p }],
    },
  })),
});
// Sonnet: $1.50/$7.50 per MTok instead of $3/$15
Step 4: Reduce Token Count
typescript
// Trim conversation history — keep system + last N turns
function trimMessages(messages: MessageParam[], maxTurns = 10) {
  if (messages.length <= maxTurns * 2) return messages;
  return messages.slice(-(maxTurns * 2));
}

// Set tight max_tokens — don't pay for output you won't use
const message = await client.messages.create({
  model: 'claude-sonnet-4-20250514',
  max_tokens: 256, // Not 4096 if you only need a short answer
  messages,
});

// Use concise system prompts
system: 'Reply in 1-2 sentences.' // Not a 500-word personality description
Step 5: Monitor Usage
typescript
// Log every call's cost
function logUsage(message: Anthropic.Message) {
  const { input_tokens, output_tokens } = message.usage;
  const cost = (input_tokens * 3 + output_tokens * 15) / 1_000_000; // Sonnet pricing
  console.log(`Tokens: ${input_tokens}in/${output_tokens}out | Cost: $${cost.toFixed(4)}`);
}

Cost Comparison Example

Processing 10,000 documents (avg 500 tokens each, 200 token response):

StrategyInput CostOutput CostTotal
Opus, no optimization$75.00$150.00$225.00
Sonnet, no optimization$15.00$30.00$45.00
Sonnet + Batches$7.50$15.00$22.50
Haiku + Batches$2.00$4.00$6.00
Haiku + Batches + Caching~$1.00$4.00~$5.00

Output

  • Model selection optimized per task complexity (Haiku for simple, Sonnet for balanced, Opus for complex)
  • Prompt caching enabled for repeated system prompts
  • Batch processing configured for non-urgent workloads
  • Token usage logged with cost estimates per request
  • Spending alerts configured in Anthropic console

Error Handling

ErrorCauseSolution
API ErrorCheck error type and status codeSee clade-common-errors

Examples

See Pricing table, five numbered strategy sections with code, and the Cost Comparison Example table showing savings from $225 to $5 for 10K documents.

Resources

Next Steps

See clade-performance-tuning for latency optimization.

Prerequisites

  • Completed clade-install-auth
  • Active API usage to optimize
  • Access to Anthropic console for usage monitoring

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in skills/.curated/clade-cost-tuning of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/one-pager.md

Open the folder on GitHubat commit cfae287

Compare with similar skills

Clade Cost Tuning 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.

Clade Cost Tuning compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Clade Cost Tuning this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.3kAutomated safety check: PassMIT
Token Optimizationcwinvestments/memstack423—~1.4kAutomated safety check: PassProprietary
Claude APIkid-sid/claude-spellbook190—~2.7kAutomated safety check: PassMIT
Prompt Caching Patternssoftspark/ai-toolkit179—~1.1kAutomated safety check: PassApache-2.0
Claude APIloulanyue/awesome-claude-notes2722 repos~2.1kAutomated safety check: PassMIT
Claude API Developmentwarpdotdev/warp65k3 repos~8.2kAutomated safety check: PassApache-2.0

Similar skills

  • Token Optimization

    cwinvestments/memstack

    A skill your agent uses when the user says 'token optimization', 'save tokens', 'context window', 'reduce tokens', 'token stack', or 'TokenStack', or asks about extending context window capacity.

    423 GitHub stars~1.4k tokensUpdated 14 days ago
    AI & LLM EngineeringAuto-check passed
  • Claude API

    kid-sid/claude-spellbook

    A skill your agent uses when building or debugging apps that call the Claude API — implementing tool use, streaming, vision, prompt caching, batch processing, extended thinking, or an agentic loop…

    190 GitHub stars~2.7k tokensUpdated 2 mo ago
    AI & LLM EngineeringAuto-check passed
  • Prompt Caching Patterns

    softspark/ai-toolkit

    Anthropic API prompt caching: TTL, breakpoints, stacking, invalidation, hit rate.

    179 GitHub stars~1.1k tokensUpdated 3 days ago
    AI & LLM EngineeringAuto-check passed
  • Claude API

    loulanyue/awesome-claude-notes

    Anthropic Claude API patterns for Python and TypeScript. An agent skill from loulanyue/awesome-claude-notes.

    272 GitHub starsUsed in 2 repos~2.1k tokens
    AI & LLM EngineeringAuto-check passed
  • Claude API Development

    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.

    65k GitHub starsUsed in 3 repos~8.2k tokens
    AI & LLM EngineeringAuto-check passed
  • Context Compression

    guanyang/open-agent-hub

    This skill should be used when long-running agent sessions need context compression, structured summarization, compaction, token-per-task optimization, or durable handoff summaries that preserve…

    977 GitHub starsUsed in 2 repos~4.6k tokens
    AI & LLM EngineeringAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Works with

Questions about Clade Cost Tuning

What does Clade Cost Tuning do?

Optimize Anthropic API costs — model selection, prompt caching, batches, Use when working with cost-tuning patterns. Clade Cost Tuning is an agent skill from jeremylongshore/tons-of-skills-marketplace. Optimize Anthropic API costs — model selection, prompt caching, batches, Use when working with cost-tuning patterns.

When should I use Clade Cost Tuning?

Clade Cost Tuning fits situations like: working with cost-tuning patterns; with anthropic pricing; reduce anthropic spend; anthropic billing.

How do I install Clade Cost Tuning in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill clade-cost-tuning -a claude-code`. Or copy the skill folder (skills/.curated/clade-cost-tuning in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/clade-cost-tuning in your project. Claude Code loads it when a task matches its description.

How do I install Clade Cost Tuning in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill clade-cost-tuning -a codex`. Or copy the skill folder (skills/.curated/clade-cost-tuning in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/clade-cost-tuning in your project. Codex loads it when a task matches its description.

Can I use Clade Cost Tuning in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill clade-cost-tuning -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/clade-cost-tuning, .gemini/skills/clade-cost-tuning, .github/skills/clade-cost-tuning and .opencode/skills/clade-cost-tuning in your project.

What does Clade Cost Tuning need to run?

SKILL.md names no scripts, command-line tools or credentials: Clade Cost Tuning is instructions for the agent only. Its frontmatter pre-approves these tools: Read, Write, Edit. Compatibility (from SKILL.md): Designed for Claude Code.

Does Clade Cost Tuning access the network?

SKILL.md names 2 domains. As links in the text: platform.claude.com and anthropic.com. This is read from the text; nothing was executed.

Is Clade Cost Tuning safe to install?

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.

What licence does Clade Cost Tuning use?

Clade Cost Tuning is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Clade Cost Tuning use?

About 1.3k tokens (SKILL.md is roughly 5.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 531 tokens, read only when the agent opens those files.

What are the alternatives to Clade Cost Tuning?

Skills that share tags, products or a category with Clade Cost Tuning: Token Optimization (cwinvestments/memstack, 423 stars), Claude API (kid-sid/claude-spellbook, 190 stars), Prompt Caching Patterns (softspark/ai-toolkit, 179 stars) and Claude API (loulanyue/awesome-claude-notes, 272 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Clade Cost Tuning?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.