SKILL

cost-aware-llm-pipeline

Cost optimization patterns for LLM API usage — model routing by task complexity, budget tracking, retry logic, and prompt caching. Use when LLM spend needs to come down, or when routing tasks across model tiers and budgets.

Target: AI & workflow automation. Automatically collected · unverified.

Excerpt from the author’s documentation

Extracted from a fixed version of SKILL.md in its original language. This is the author’s documentation; installation, compatibility and runtime results have not been verified by this site.

Read the original English text

Topics in the source

  • Cost-Aware LLM Pipeline
  • When to Activate
  • Core Concepts
  • 1. Model Routing by Task Complexity
  • 2. Immutable Cost Tracking
  • 3. Narrow Retry Logic
  • 4. Prompt Caching
  • Composition

Patterns for controlling LLM API costs while maintaining quality. Combines model routing, budget tracking, retry logic, and prompt caching into a composable pipeline. Building applications that call LLM APIs (Claude, 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 Automatically select cheaper models for simple tasks, reserving expensive models for complex ones. Track cumulative spend with frozen dataclasses. Each API call returns a new tracker — never mutates state. Retry only on transient errors. Fail fast on authentication or bad request errors. Cache long system prompts to avoid resending them on every request. Combine all four techniques in a single pipeline function: | Model | Input ($/1M tokens) | Output ($/1M tokens) | Relative Cost | |-------|---------------------|----------------------|---------------| | Haiku 3.5 (legacy) | $0.80 | $4.00 | 0.8x | | Haiku 4.5 | $1.00 | $5.00 | 1x | | Sonnet 5 | $2.00 | $10.00 | 2x | | Sonnet 4.6 | $3.00 | $15.00 | 3x | | Opus 4.8 | $5.00 | $25.00 | 5x | | Fable 5 / Mythos 5 | $10.00 | $50.00 | 10x | | Opus 4.0 / 4.1 (legac

This is an excerpt. Refer to the complete source and its current requirements.

Source repository
affaan-m/ECC
Source file
pi/core/skills/cost-aware-llm-pipeline/SKILL.md
Fixed revision
d2ef2680594f9a17526a6e1a2e18b3d242c5d17b
Read the complete original documentation ↗

Requirements

  • Only the author’s Skill metadata is included. Read the full instructions to check dependencies, licensing and conditions of use.

A small first task

先阅读原作者说明,再决定是否在自己的 AI 工具中使用。

Instructions for your AI tool

Author documentation is not live verification by this site. Without evidence, we do not mark a resource as compatible, safe or free.

Sources and evidence

This record was collected automatically. Its documentation, suitability and runtime behavior have not been manually verified.

Author: affaan-m/ECC · original repository metadata. Documentation review: Not reviewed. Last source check: 2026-11-09T15:01:42.912Z.

Categories are inferred from names, descriptions and paths. They do not establish compatibility.

License and attribution

MIT. Third-party content and copyright remain with their authors. Refer to the original license and terms.

Original license ↗

Synchronization, copying and user-reported success do not mark a resource as runtime-tested.

Limitations and notes

  • Collecting metadata does not mean this site has installed, adapted, runtime-tested or security-reviewed the resource.