CodeValidCodeValid

CodeValid Case Study

Which model should power your agent? Stop guessing. Test it.

Most teams default to the most powerful model — and overpay for their use case. We connected a LangChain text-to-SQL agent to CodeValid, generated tests straight from business requirements, and ran them across four models. The results changed the model decision.

95%in savings

The mid-tier model (Gemini Flash 3.1) passed every business requirement for this agent use case at roughly 5% of frontier cost. Same reliability, dramatically lower spend — a verified decision, not a guess.

LangChain · Text-to-SQL · 4 models · 0 lines of test code

One agent. Four models. Every requirement verified.

CodeValid generated test cases directly from the agent's business requirements — simple lookups, joins and aggregations, complex multi-table reasoning, and ambiguous edge cases — then ran the identical suite against each model.

codevalid run --suite text-to-sql --models 4
ModelSimpleJoinsComplexEdgeCost
Mistral SmallsmallPASSFAILFAILFAIL
Gemini Flash 3.1RECOMMENDEDmid-tierPASSPASSPASSPASS
Opus 4.6frontierPASSPASSPASSPASS58×
GPT 5.5frontierPASSPASSPASSPASS62×
Insight: mid-tier passed every check for this agent use case at about 5% of frontier cost.

Backed by data

The team chose a model based on their own requirements — and can re-verify whenever a new model ships.

From repo to results — without writing a test

95%

Model spend saved by switching safely from frontier to mid-tier.

<5 min

To set up: connect a Git repo and a project management tool.

<2 min

To add a new model and re-run the full suite side by side.

0

Lines of test code written by hand.

What the model choice actually costs

Using published July 2026 list prices and a realistic text-to-SQL workload — 1M agent calls per month, ~3K input and ~300 output tokens per call — here's what each model costs in production.

Mistral Small

$0.10 / $0.30 per M · fails complex scenarios

$390 /mo

Gemini Flash 3.1

$0.25 / $1.50 per M · passes all checks

$1,200 /mo

Opus 4.6

$5.00 / $25.00 per M · passes all checks

$22,500 /mo

GPT 5.5

$5.00 / $30.00 per M · passes all checks

$24,000 /mo

Assumptions: 1M calls/month · ~3,000 input · ~300 output tokens · July 2026 list prices, before caching or batch discounts.

$255k/yr

Saved by switching from frontier to mid-tier — safely. Without a test suite, this switch is a gamble. With CodeValid, it's a verified decision.

Test it. Prove it. Ship it.

Connect your agent's repo, bring your requirements, and know — with data — which model is right for your use case.