Agent skill · Backend & API

cost-aware-llm-pipeline

Cost optimization patterns for LLM API usage — model routing by task complexity, budget tracking, retry logic, and prompt caching.

mturacgithub.com/mturacGitHub ↗
codexcopilotcursorMIT
Install
npx skills add mturac/everything-openai-codex --skill cost-aware-llm-pipeline --agent codex

Same command for any agent — swap --agent for claude-code, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 6 KB
Bundled scripts: none
Path: skills/cost-aware-llm-pipeline/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 84
Language: JavaScript

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Cost-Aware LLM Pipeline Patterns for controlling LLM API costs while maintaining quality. Combines model routing, budget tracking, retry logic, and prompt caching into a composable pipeline. ## When to Activate - Building applications that call LLM APIs (Codex, GPT, etc.) - Processing batches of items with varying complexity - Need to stay within a budget for API spend - Optimizing cost without sacrificing quality on complex tasks ## Core Concepts ### 1. Model Routing by Task Complexity Automatically select cheaper models for simple tasks, reserving expensive models for complex ones. ```python MODEL_STANDARD = "codex-standard-4-6" MODEL_FAST = "codex-fast-4-5-20251001" _STANDARD_TEXT_THRESHOLD = 10_000 # chars _STANDARD_ITEM_THRESHOLD = 30 # items def select_model( text_length: int, item_count: int, force_model: str | None = None, ) -> str: """Select model based on task complexity.""" if force_model is not None: return force_model if text_length >= _STANDARD_TEXT_THRESHOLD or item_count >= _STANDARD_ITEM_THRESHOLD: return MODEL_STANDARD # Complex task return MODEL_FAST # Simple task (3-4x cheaper) ``` ### 2. Immutable Cost Tracking Track cumulative spend with frozen dataclasses.

What's inside
Steps it walks through
  1. When to Activate
  2. Core Concepts
  3. 1. Model Routing by Task Complexity
  4. 2. Immutable Cost Tracking
  5. 3. Narrow Retry Logic
  6. 4. Prompt Caching
  7. Composition
  8. Pricing Reference (2025-2026)
  9. Best Practices
  10. Anti-Patterns to Avoid
  11. When to Use
More from everything-openai-codex
All skills →
About this skill
What does the cost-aware-llm-pipeline skill do?

Cost optimization patterns for LLM API usage — model routing by task complexity, budget tracking, retry logic, and prompt caching.

How do I install it?

Run `npx skills add mturac/everything-openai-codex --skill cost-aware-llm-pipeline --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From mturac/everything-openai-codex, a repository with 84 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going