cost-aware-pipelinelisted
Install: claude install-skill stevengonsalvez/agents-in-a-box
# Cost-Aware LLM Pipeline
## Model Routing Strategy
Route tasks to the cheapest model that can handle them reliably.
### Pricing Reference (per 1M tokens, USD)
| Model | Input | Output | Relative Cost |
|-------|-------|--------|---------------|
| Haiku | $0.80 | $4.00 | 1x (baseline) |
| Sonnet | $3.00 | $15.00 | ~4x |
| Opus | $15.00 | $75.00 | ~19x |
### Routing Rules
| Task Complexity | Route To | Examples |
|-----------------|----------|----------|
| **Simple** (< 100 lines, clear pattern) | Haiku | File renaming, simple search, format conversion, status checks |
| **Moderate** (100-500 lines, some judgment) | Sonnet | Code review, test writing, refactoring, documentation |
| **Complex** (500+ lines, deep reasoning) | Opus | Architecture design, debugging subtle issues, multi-file refactoring |
| **Creative** (open-ended, high quality bar) | Opus | System design, novel algorithms, critical security review |
### Implementation with Claude Code Agent Tool
```python
# In agent orchestration, specify model based on task complexity
def route_to_model(task_description: str, estimated_complexity: str) -> str:
"""Return model parameter for Agent tool."""
routing = {
"simple": "haiku",
"moderate": "sonnet",
"complex": "opus",
"creative": "opus",
}
return routing.get(estimated_complexity, "sonnet")
```
When spawning sub-agents:
- Use `model: "haiku"` for Explore agents doing simple file searches
- Use `model: "sonnet"` (defa