llm-cost-optimization

llm-cost-optimization is a skill for Claude Code, Codex from nimadorostkar/Claude-Skills-collection. It costs 39 tokens per session (1,343 once invoked), scanned A, original, MIT.

Guidance for reducing the cost of a language-model feature by measuring and controlling the text sent to and returned by the model. It covers caching, smaller context, model selection, batching, and output limits.

In plain words
What is it for?
Use it when model usage is too expensive, before scaling traffic, or when a growing bill needs explanation and per-feature tracking.
Why use it?
It helps identify which parts of requests are driving the bill before making changes. The goal is to lower spending while keeping the required answer quality.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it when model usage is too expensive, before scaling traffic, or when a growing bill needs explanation and per-feature tracking.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/nimadorostkar/claude-skills-collection/llm-cost-optimization
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add nimadorostkar/Claude-Skills-collection --skill llm-cost-optimization
Clone the repo
git clone --depth 1 https://github.com/nimadorostkar/Claude-Skills-collection

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for llm-cost-optimization

README.md
[![agentmods](https://agentmods.dev/badge/skills/nimadorostkar/claude-skills-collection/llm-cost-optimization/github.svg)](https://agentmods.dev/skills/nimadorostkar/claude-skills-collection/llm-cost-optimization)
Your own site
<a href="https://agentmods.dev/skills/nimadorostkar/claude-skills-collection/llm-cost-optimization"><img src="https://agentmods.dev/badge/skills/nimadorostkar/claude-skills-collection/llm-cost-optimization/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for llm-cost-optimization

Your own site · 80×15
<a href="https://agentmods.dev/skills/nimadorostkar/claude-skills-collection/llm-cost-optimization"><img src="https://agentmods.dev/badge/skills/nimadorostkar/claude-skills-collection/llm-cost-optimization.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,343 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00039 $0.01343
Opus 5 $0.00019 $0.00672
Sonnet 5 $0.00008 $0.00269
Haiku 4.5 $0.00004 $0.00134

Measured 12d ago against content hash f5bbecdd938e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

llm-cost-optimization scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/ai/llm-cost-optimization/SKILL.md · 124 lines

How it starts

The opening of the file, as written. The whole thing — 124 lines — stays where its author put it; the contents beside it link to each section on GitHub.

LLM Cost Optimization

Purpose

Reduce the cost of an LLM feature without losing the quality that justified it. Most LLM bills are dominated by one or two things that nobody has measured, and the fix is usually structural rather than a matter of shaving tokens.

When to Use

  • An LLM feature that is too expensive at current or projected volume.
  • Before scaling a feature from pilot to production traffic.
  • A bill that grew and nobody can explain why.

Capabilities

  • Token accounting: where the spend actually is.
  • Prompt caching.
  • Context reduction and retrieval narrowing.
  • Model routing and downgrading.
  • Batch processing for non-interactive work.
  • Output-length control.

Inputs

  • Token counts per call, broken down: system, context, history, output.
  • Call volume, by feature and by tenant.
  • The quality bar that must be maintained.

Outputs

  • A ranked list of cost drivers.
  • Changes with measured cost reduction and no quality regression.
  • Per-feature cost tracking so the next increase is visible.

Workflow

  1. Measure where the tokens go — Input versus output, and within input: system prompt, tools, retrieved context, conversation history. The answer is frequently not what anyone expected.
  2. Cache the stable prefix — If the system prompt and tools are identical across calls, prompt caching reduces their cost by roughly 90%. This is usually the single largest and cheapest win.
  3. Cut the context, not the quality — Retrieving twenty chunks when five suffice costs four times as much and often produces a worse answer. Measure the quality at each k.
  4. Route to a smaller model — Most tasks do not need the largest model. Measure the small one before assuming it cannot.
  5. Batch what is not interactive — Batch APIs are typically half the price for work that can wait. Overnight classification does not need a synchronous call.
  6. Cap the output — Output tokens cost several times more than input tokens. A max_tokens that is generous "just in case" is a standing cost.

Read the full file on GitHub · 124 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 124 lines · 39 tokens per session scan A f5bbecdd938e

Subscribe to this mod's changes

llm-cost-optimization is a skill published in the GitHub repository nimadorostkar/Claude-Skills-collection (26 stars, last pushed 24d ago), licensed MIT. It adds 39 tokens to every session and 1,343 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

datarobot-agent-assist

Use when the user wants to design, build, code, simulate, or deploy an AI agent (not a predictive model) to DataRobot; mentions agentspec.md, dr-assist, datarobot-agent-assist, dress rehearsal, swarm simulation, or the DataRobot agent template; wants to scaffold a LangGraph, CrewAI, LlamaIndex, NAT, or Base agent…

datarobot-oss/datarobot-agent-skills · 182 tokens

datarobot-agent-assist-build

Use when the user wants to design, build, code, or deploy an AI agent on DataRobot; mentions agentspec.md, dress rehearsal, the DataRobot agent template, LangGraph, CrewAI, LlamaIndex, NAT, Base agents, MCP servers, backend APIs, custom frontends, or the DataRobot CLI.

datarobot-oss/datarobot-agent-skills · 74 tokens

datarobot-model-explainability

Tools and guidance for model explainability, prediction explanations, feature impact analysis, SHAP values, SHAP distributions, anomaly assessment, and model diagnostics. Use when analyzing model explanations, feature impact, SHAP values, SHAP distributions, anomaly assessment, or diagnosing model behavior.

datarobot-oss/datarobot-agent-skills · 63 tokens

datarobot-model-training

Comprehensive guidance for training models in DataRobot, including project creation, AutoML configuration, feature engineering, and model selection. Use when training models, creating AutoML projects, or selecting models in DataRobot.

datarobot-oss/datarobot-agent-skills · 48 tokens

datarobot-predictions

Tools and guidance for making predictions with DataRobot deployments, including real-time predictions, batch scoring, prediction dataset generation, and prediction explanations (SHAP/XEMP). Use when making predictions, running batch scoring, generating prediction datasets, or explaining individual predictions from a…

datarobot-oss/datarobot-agent-skills · 60 tokens

datarobot-setup

Sets up DataRobot for local development including Python SDK, dr-cli, Agent Assist, and all required dependencies. Use when the user has not yet worked with DataRobot on this machine, OR when any DataRobot task fails due to missing or invalid credentials. Covers first-time setup, re-authentication, and credential…

datarobot-oss/datarobot-agent-skills · 70 tokens