OverpayingForAIPricing desk

SQL · 6 checks · max 500 tokens · benched 2026-09-16

Claude Opus 5 vs Claude Sonnet 5 vs Claude Sonnet 4.6 vs Claude Haiku 4.5 on top five customers by 2025 spend

Anthropic models side by side on "Top five customers by 2025 spend": Claude Haiku 4.5 scores 10/10; Claude Haiku 4.5 is the cheapest answer scoring 8+ at $0.51 per 1,000 runs. Outputs, checks, judge reasons, latency and cost.

The prompt every model received

System

You are a database engineer. Reply with a single SQL statement and nothing else.

User

Tables: customers(id, name) and orders(id, customer_id, amount, ordered_at). Write one standard SQL query that returns each customer's name and their total order amount for calendar year 2025, highest total first, limited to the top 5. Use a JOIN, GROUP BY and ORDER BY.

Rubric for the judge: Correct join and aggregate, filters ordered_at to 2025, sorts descending, limits to 5, portable SQL.

Side by side

Every cell is one OpenRouter call at temperature 0 with the prompt's token cap and reasoning effort "low" where the model supports it. Cost is usage × the catalogue rate in models.json. Quality is one judge call to anthropic/claude-haiku-4.5 against the prompt's rubric, cached per prompt version.

Claude Opus 5

anthropic/claude-opus-5

10/10
Latency
1.1s
Cost
$0.00422
Per 1,000
$4.22

130 in · 143 out · 37 words · checks 6/6

  • regex
  • regex
  • regex
  • regex
  • regex
  • contains
```sql
SELECT c.name, SUM(o.amount) AS total_amount
FROM customers c
JOIN orders o ON o.customer_id = c.id
WHERE o.ordered_at >= DATE '2025-01-01'
  AND o.ordered_at < DATE '2026-01-01'
GROUP BY c.id, c.name
ORDER BY total_amount DESC
LIMIT 5;
```

Judge: Query correctly joins customers and orders, filters 2025 using portable DATE syntax, groups by customer with proper aggregation, orders descending by total, limits to 5, and includes all required clauses.

Claude Sonnet 5

anthropic/claude-sonnet-5

10/10
Latency
1.1s
Cost
$0.00161
Per 1,000
$1.61

130 in · 135 out · 35 words · checks 6/6

  • regex
  • regex
  • regex
  • regex
  • regex
  • contains
```sql
SELECT c.name, SUM(o.amount) AS total_amount
FROM customers c
JOIN orders o ON o.customer_id = c.id
WHERE o.ordered_at >= '2025-01-01' AND o.ordered_at < '2026-01-01'
GROUP BY c.id, c.name
ORDER BY total_amount DESC
LIMIT 5;
```

Judge: Query correctly joins customers and orders, filters 2025 using date range, groups by customer with proper aggregation, orders descending by total, limits to 5, and uses portable standard SQL syntax.

Claude Sonnet 4.6

anthropic/claude-sonnet-4.6

10/10
Latency
809ms
Cost
$0.00198
Per 1,000
$1.98

91 in · 114 out (15 reasoning) · 35 words · checks 6/6

  • regex
  • regex
  • regex
  • regex
  • regex
  • contains
```sql
SELECT c.name, SUM(o.amount) AS total_amount
FROM customers c
JOIN orders o ON c.id = o.customer_id
WHERE o.ordered_at >= '2025-01-01' AND o.ordered_at < '2026-01-01'
GROUP BY c.id, c.name
ORDER BY total_amount DESC
LIMIT 5;
```

Judge: Query correctly joins customers and orders, filters 2025 using date range, groups by customer with proper aggregation, orders descending by total, limits to 5, and uses portable standard SQL syntax.

Claude Haiku 4.5

anthropic/claude-haiku-4.5

10/10
top judge scorecheapest scoring 8+
Latency
764ms
Cost
$0.00051
Per 1,000
$0.51

90 in · 83 out · 33 words · checks 6/6

  • regex
  • regex
  • regex
  • regex
  • regex
  • contains
```sql
SELECT c.name, SUM(o.amount) AS total_amount
FROM customers c
JOIN orders o ON c.id = o.customer_id
WHERE EXTRACT(YEAR FROM o.ordered_at) = 2025
GROUP BY c.id, c.name
ORDER BY total_amount DESC
LIMIT 5;
```

Judge: Query correctly joins customers and orders, filters 2025 using EXTRACT(YEAR FROM ...), groups by customer with proper aggregation, orders descending by total, limits to 5, and uses portable standard SQL syntax.

Frequently asked

What does this prompt test?

SQL: Correct join and aggregate, filters ordered_at to 2025, sorts descending, limits to 5, portable SQL. The deterministic checks are regex, regex, regex, regex, regex, contains.

Which model should I pick for this task?

If the judge's bar of 8/10 is good enough for you, Claude Haiku 4.5 at $0.51 per 1,000 runs. If you need the top score, Claude Haiku 4.5 at $0.51 per 1,000 runs.

If our calculators helped you cut down on hidden AI wallet leaks, thanks for using them. A tiny fraction of your savings is what keeps our pricing indexes updated daily.

Not sure which AI is cheapest for your use case? Find out in 30 seconds — no signup required.

AI cost intelligence

Stop overpaying for AI tools

Join the OverpayingForAI list for pricing updates, cheaper alternatives, and practical buying guidance.

Now tracking 50+ AI tools, models, platforms, subscriptions, coding tools, and automation products.

We use your email only for OverpayingForAI updates. Unsubscribe anytime.