Skip to content

Token Estimation

Enreign edited this page Mar 12, 2026 · 2 revisions

Token estimation (Step 15) computes per-task token consumption and optional API cost. Added in v0.4.0, calibrated in v0.5.0 against Aider and Tokenomics benchmark data.

How It Works

After computing agent rounds (Step 1), the skill estimates how many tokens those rounds will consume:

total_tokens = adjusted_rounds × tokens_per_round × num_agents

Tokens are split into input/output using a complexity-specific ratio, since larger tasks produce proportionally more output tokens.

Lookup Tables

Tokens Per Round (by complexity × maturity)

                    S       M       L       XL
exploratory:        8k      15k     25k     40k
partial:            6k      12k     20k     35k
mostly-automated:   5k      10k     18k     30k

Output Token Ratio

S: 0.30    M: 0.30    L: 0.30    XL: 0.35

v0.5.0 change: S raised from 0.25 to 0.30, M raised from 0.28 to 0.30. Validated against Aider leaderboard data (n=23 models, median output ratio 0.31 excluding reasoning tokens).

Formula

total_tokens_min = adjusted_rounds_min × tokens_per_round × num_agents
total_tokens_max = adjusted_rounds_max × tokens_per_round × num_agents

input_tokens = total_tokens × (1 - output_ratio)
output_tokens = total_tokens × output_ratio

pert_expected_tokens = (min + 4 × midpoint + max) / 6

Cost Estimation

Cost only appears when show_cost=true (off by default). Uses tier-based pricing:

Model Tier Pricing (per 1M tokens, USD)

                Input       Output
economy:        $0.50       $2.50       (Haiku, GPT-4o Mini, Gemini Flash)
standard:       $2.50       $12.00      (Sonnet, GPT-4o, Gemini 2.5 Pro)
premium:        $5.00       $25.00      (Opus, GPT-5)

Per-Model Reference Table

Model                    Input       Output      Tier
GPT-4o Mini              $0.15       $0.60       economy
Gemini 2.5 Flash         $0.30       $2.50       economy
Claude Haiku 4.5         $1.00       $5.00       economy
Gemini 2.5 Pro           $1.25       $10.00      standard
GPT-4o                   $2.50       $10.00      standard
Claude Sonnet 4.6        $3.00       $15.00      standard
Claude Opus 4.6          $5.00       $25.00      premium
GPT-5                    $1.25       $10.00      premium

Note: "Premium" reflects capability tier, not necessarily highest price. GPT-5 is premium-capability at standard pricing. Pricing changes frequently — last verified March 2026.

Cost Formula

cost_min = (input_tokens_min × input_price + output_tokens_min × output_price) / 1,000,000
cost_max = (input_tokens_max × input_price + output_tokens_max × output_price) / 1,000,000
pert_expected_cost = (cost_min + 4 × cost_midpoint + cost_max) / 6

Output

Tokens always appear in the estimate output. Cost only appears when requested.

One-Line Summary

Tokens appear parenthetically after agent rounds:

10-26 agent rounds (~180k tokens) + 3 hrs human

Cost does NOT appear in the one-line summary (too noisy).

Breakdown Table

| Token Estimate | ~180k tokens |
| Model Tier     | standard     |
| Est. Cost      | ~$1.20       |   ← only if show_cost=true

Batch Table

Adds a Tokens column:

| # | Task | Size | ... | Tokens | Expected | ...

JSON Schema

"token_estimate": {
  "total_tokens":           { "min": 120000, "max": 312000 },
  "input_tokens":           { "min": 86400, "max": 224640 },
  "output_tokens":          { "min": 33600, "max": 87360 },
  "pert_expected_tokens":   216000,
  "model_tier":             "standard",
  "cost_usd":               { "min": 0.62, "max": 1.61 },
  "pert_expected_cost_usd": 1.12
}

cost_usd and pert_expected_cost_usd are null when show_cost=false.

Inputs

Input Type Default Source
model_tier economy/standard/premium standard Question #14 (detailed path)
show_cost boolean false Question #14 (detailed path)

Users can also name a specific model (e.g., "Claude Sonnet 4.6") and it maps to the appropriate tier.

See the canonical formulas.md for the full specification.

Clone this wiki locally