Skip to content

Cost-Aware LLM Pipeline

Lower LLM API spend by routing simple tasks to cheaper models, tracking budgets, and caching prompts.

Repository
affaan-m/ECC
Stars
295,127
Licence
MIT
Files
1 file

What it does

This skill teaches an AI agent how to build software that calls paid LLM APIs (such as Claude) without overspending. When installed, the agent will suggest and write code that picks a cheaper model for simple inputs and a stronger one for complex inputs, stops work when a spending budget is exceeded, retries only temporary network or rate-limit errors, and caches long system prompts. The skill is a set of Japanese-language patterns and Python code examples in a single SKILL.md file; it does not run anything on its own.

Great for

  • Developers building apps or batch jobs that make many LLM API calls and want to control costs
  • Teams that need hard budget limits on API spending in production
  • Engineers who want a starting pattern for routing tasks between cheap and expensive models

Skip it if

  • Non-developers who only chat with an AI and do not build software that calls APIs; the patterns assume Python code and API keys
  • Projects where output quality on complex tasks is critical and the fixed text-length and item-count thresholds may route hard work to cheaper models incorrectly, unless the thresholds are tested against real data

Try asking

  • “Build a Python batch job that summarizes 5,000 support tickets while keeping API costs under $20”
  • “Add a budget tracker that stops my LLM pipeline when spending exceeds a set limit”
  • “Add retry logic with exponential backoff for rate-limit errors in my Claude API client”
  • “Route short requests to a cheaper Claude model and long ones to a stronger model”
Step-by-step guide: how to use Cost-Aware LLM PipelineInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 1 original files, the MIT licence and an attribution note.

    cost-aware-llm-pipeline.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip cost-aware-llm-pipeline.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip cost-aware-llm-pipeline.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Verify model names and prices against the provider's current pricing page before relying on the table, since the file lists specific model names and 2026 prices that may change.
  • Test the routing thresholds (10,000 characters, 30 items) on your own data and log routing decisions, as the skill itself recommends.
  • The code is illustrative: time and the Config, Result, and client objects are not imported in the snippets, so add those imports and definitions before running.

What's inside

  • SKILL.md

Redistributed unmodified from affaan-m/ECC under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.