Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
borghei avatar

Llm Cost Optimizer

  • 72 installs
  • 451 repo stars
  • Updated July 21, 2026
  • borghei/claude-skills

llm-cost-optimizer is a skill that counts tokens, estimates LLM costs across providers, and optimizes prompts to reduce token usage without losing quality.

About

This skill counts tokens, estimates costs across LLM providers, and optimizes prompts to reduce token usage without sacrificing quality. It ships a token counter and a prompt optimizer, plus an LLM pricing reference. Developers use it to budget LLM projects, compare model pricing, and cut API costs on high-volume prompts.

  • Counts tokens in prompts and estimates costs across LLM providers
  • Analyzes prompts for token-reduction opportunities with a target reduction flag
  • Includes an LLM pricing guide and model-selection guidance for cost-quality tradeoffs

Llm Cost Optimizer by the numbers

  • 72 all-time installs (skills.sh)
  • Ranked #5,620 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

llm-cost-optimizer capabilities & compatibility

Capabilities
token counting · cost estimation · prompt optimization · model comparison
Use cases
token optimization
Pricing
Free
From the docs

What llm-cost-optimizer says it does

The **LLM Cost Optimizer** skill provides tools for counting tokens, estimating costs across different LLM providers, and optimizing prompts to reduce token usage without sacrificing quality.
SKILL.md
python scripts/token_counter.py --file prompt.txt --models gpt-4o claude-sonnet
SKILL.md
Optimize with target reduction
SKILL.md
npx skills add https://github.com/borghei/claude-skills --skill llm-cost-optimizer

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs72
repo stars451
Last updatedJuly 21, 2026
Repositoryborghei/claude-skills

What it does

Count prompt tokens, estimate LLM costs across models, and optimize prompts to reduce token usage.

Who is it for?

Developers and teams managing LLM API budgets who need token counts, cost estimates, and prompt optimization.

Skip if: Teams not using LLM APIs or without token-cost concerns.

When should I use this skill?

You want to estimate LLM costs, count tokens, optimize prompt token usage, or compare model pricing.

What you get

Produces per-request token counts, cross-model cost estimates, and prompt optimization suggestions to reduce spend.

  • Token counts
  • Per-model cost estimates
  • Prompt optimization suggestions

By the numbers

  • Two Python tools: token_counter.py and prompt_optimizer.py
  • Prompt optimizer accepts a target-reduction percentage

Files

SKILL.mdMarkdownGitHub ↗

LLM Cost Optimizer

Category: Engineering
Domain: AI Cost Management

Overview

The LLM Cost Optimizer skill provides tools for counting tokens, estimating costs across different LLM providers, and optimizing prompts to reduce token usage without sacrificing quality. Essential for teams managing LLM API budgets at scale.

Quick Start

# Count tokens in a prompt file and estimate costs
python scripts/token_counter.py --file prompt.txt --models gpt-4o claude-sonnet

# Count tokens from stdin
echo "Hello world" | python scripts/token_counter.py --stdin --models all

# Analyze a prompt for optimization opportunities
python scripts/prompt_optimizer.py --file system_prompt.txt

# Optimize with target reduction
python scripts/prompt_optimizer.py --file prompt.txt --target-reduction 30

Tools Overview

ToolPurposeKey Flags
token_counter.pyCount tokens and estimate costs across models--file, --text, --stdin, --models
prompt_optimizer.pyAnalyze prompts for token reduction opportunities--file, --target-reduction, --format

Workflows

Cost Estimation for New Project

1. Collect sample prompts (system prompt + user messages) 2. Run token_counter.py with target models 3. Multiply per-request cost by expected daily volume 4. Compare models on cost-quality tradeoff

Prompt Optimization Sprint

1. Identify highest-cost prompts from usage logs 2. Run prompt_optimizer.py on each 3. Apply suggested optimizations 4. Re-count tokens to verify reduction 5. A/B test optimized vs. original for quality

Reference Documentation

  • LLM Pricing Guide - Current pricing for major LLM providers, token estimation methods

Common Patterns

Token Reduction Techniques

  • Remove redundant instructions and examples
  • Use shorter variable names in few-shot examples
  • Compress verbose system prompts
  • Replace repeated context with references
  • Use structured output formats (JSON) to reduce response tokens
  • Batch multiple requests into single prompts where possible

Cost-Effective Model Selection

  • Use smaller models for classification/extraction tasks
  • Reserve large models for complex reasoning
  • Implement model routing based on query complexity
  • Cache responses for identical or similar queries

Related skills

FAQ

What tools does it provide?

A token counter that counts tokens and estimates costs across models, and a prompt optimizer that analyzes prompts for token reduction opportunities.

Can it target a specific reduction?

Yes, the prompt optimizer accepts a target-reduction flag, for example 30 percent.

AI & Agent Buildingllmautomation

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.