Skip to main content

Understanding Tokens

Tokens are the unit of LLM pricing. Roughly:
  • 1 token ≈ 4 characters (English)
  • 1 token ≈ 0.75 words
  • 100 tokens ≈ 75 words

Pricing by Provider

Prices change frequently. Check provider pricing pages for current rates. Output tokens typically cost 3-5x more than input.

Cost Estimation

Per-Task Estimates

Monthly Projections

Optimization Strategies

1. Reduce Input Tokens

Use targeted reads instead of full files:
Leverage project config for persistent context:

2. Reduce Output Tokens

Request concise responses:
Use structured output:

3. Use Appropriate Models

4. Cache Expensive Operations

5. Batch Operations

Monitoring Costs

Track Usage

Set Budgets

Define budget limits in agent configurations:

Cost Alerts

Cost-Saving Patterns

Progressive Enhancement

Summarize Before Processing

Parallel with Haiku, Synthesize with Sonnet

1

Fan out (cheap)

Run Task 1, Task 2, Task 3 in parallel with Haiku
2

Synthesize (quality)

Sonnet combines all results into final output

ROI Framework

Calculate Value per Token

When to Optimize

Best Practices

  • Monitor costs weekly at minimum
  • Set per-agent and per-squad budgets
  • Use fast/cheap models for high-volume tasks
  • Cache expensive research results
  • Batch similar operations
  • Track ROI, not just costs
Common cost traps:
  • Reading entire codebases repeatedly
  • Using premium models for simple tasks
  • Generating verbose explanations
  • Not caching repeated queries
  • Running agents without monitoring

Multi-LLM Usage

Choose the right model for each task

Context Optimization

Reduce input token usage