Cost optimization patterns for LLM API usage — model routing by task complexity, budget tracking, retry logic, and prompt caching.
77
66%
Does it follow best practices?
Impact
100%
1.31xAverage score across 3 eval scenarios
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./skills/cost-aware-llm-pipeline/SKILL.mdModel routing with immutable cost tracking
Sonnet constant
100%
100%
Haiku constant
100%
100%
Text length threshold
0%
100%
Item count threshold
0%
100%
Default to cheaper model
100%
100%
Force model override
0%
100%
Frozen dataclasses
50%
100%
Tuple for records
100%
100%
Immutable add method
100%
100%
Model selection logging
100%
100%
Budget limit field
0%
100%
Selective retry logic with exponential backoff
Retries APIConnectionError
100%
100%
Retries RateLimitError
100%
100%
Retries InternalServerError
100%
100%
No retry on auth errors
100%
100%
No retry on bad request
100%
100%
Exponential backoff
73%
100%
Max 3 retries
60%
100%
Retryable errors grouped
100%
100%
Demo shows selective behavior
100%
100%
Prompt caching and full pipeline composition
Cache control on static prompt
100%
100%
Variable input separate block
100%
100%
Budget check before API call
100%
100%
BudgetExceededError raised
100%
100%
Model routing integrated
100%
100%
Retry integrated
70%
100%
Immutable cost update
0%
100%
Explicit budget limit
100%
100%
Pipeline function signature
44%
100%
Demo shows cache structure
100%
100%
5df943e
Table of Contents
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.