OverpayingForAIPricing desk

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

Qwen3.8 Max (0902) vs Qwen3.8 27B vs Qwen3.8 Flash vs Qwen3.7 Plus on products over 100 units with having

Alibaba models side by side on "Products over 100 units with HAVING": Qwen3.8 Flash scores 10/10; Qwen3.8 Flash is the cheapest answer scoring 8+ at $0.12 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: products(id, name) and order_items(product_id, quantity). Write one standard SQL query that lists product names whose total quantity sold across all order_items is greater than 100. Filter the aggregate with a HAVING clause.

Rubric for the judge: Join, SUM(quantity), GROUP BY product, HAVING > 100; returns names only; no WHERE on the aggregate.

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.

Qwen3.8 Max (0902)

qwen/qwen3.8-max-0902

10/10
Latency
1.3s
Cost
$0.00087
Per 1,000
$0.87

106 in · 109 out (63 reasoning) · 21 words · checks 4/4

  • regex
  • regex
  • regex
  • regex
```sql
SELECT p.name
FROM products p
JOIN order_items oi ON p.id = oi.product_id
GROUP BY p.name
HAVING SUM(oi.quantity) > 100;
```

Judge: Query correctly joins products and order_items, groups by product name, uses HAVING with SUM(quantity) > 100 filter, returns only names, and contains no WHERE clause on the aggregate.

Qwen3.8 27B

qwen/qwen3.8-27b

10/10
Latency
487ms
Cost
$0.00029
Per 1,000
$0.29

106 in · 105 out (57 reasoning) · 21 words · checks 4/4

  • regex
  • regex
  • regex
  • regex


```sql
SELECT p.name
FROM products p
JOIN order_items oi ON p.id = oi.product_id
GROUP BY p.name
HAVING SUM(oi.quantity) > 100;
```

Judge: Query correctly joins products and order_items, groups by product name, uses SUM(quantity) in HAVING clause to filter aggregates > 100, returns only names, and contains no WHERE clause on the aggregate.

Qwen3.8 Flash

qwen/qwen3.8-flash

10/10
top judge scorecheapest scoring 8+
Latency
1.6s
Cost
$0.00012
Per 1,000
$0.12

118 in · 206 out (165 reasoning) · 19 words · checks 4/4

  • regex
  • regex
  • regex
  • regex
SELECT p.name
FROM products p
JOIN order_items oi ON p.id = oi.product_id
GROUP BY p.name
HAVING SUM(oi.quantity) > 100;

Judge: Query correctly joins products and order_items, groups by product name, uses HAVING with SUM(quantity) > 100 aggregate filter, returns only names, and contains no WHERE clause on the aggregate.

Qwen3.7 Plus

qwen/qwen3.7-plus

10/10
Latency
1.7s
Cost
$0.00116
Per 1,000
$1.16

80 in · 886 out (845 reasoning) · 19 words · checks 4/4

  • regex
  • regex
  • regex
  • regex
SELECT p.name
FROM products p
JOIN order_items oi ON p.id = oi.product_id
GROUP BY p.name
HAVING SUM(oi.quantity) > 100;

Judge: Query correctly joins products and order_items, groups by product name, uses HAVING with SUM(quantity) > 100 aggregate filter, returns only names, and contains no WHERE clause on the aggregate.

Frequently asked

What does this prompt test?

SQL: Join, SUM(quantity), GROUP BY product, HAVING > 100; returns names only; no WHERE on the aggregate. The deterministic checks are regex, regex, regex, regex.

Which model should I pick for this task?

If the judge's bar of 8/10 is good enough for you, Qwen3.8 Flash at $0.12 per 1,000 runs. If you need the top score, Qwen3.8 Flash at $0.12 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.