What a Natural-Language-to-SQL Assistant Costs to Run
Text-to-SQL prompts are input-heavy: the database schema and a few example queries are sent with every question, while the generated SQL is short.
Typical monthly workload
- Input tokens
- 4,000,000
- Output tokens
- 600,000
- Requests / day
- 800
Illustrative estimate. Adjust the sliders below to match your own volume.
Recommended setup
Send straightforward single-table questions to GPT-4o Mini and escalate multi-join or window-function queries to Claude 3.5 Sonnet when validation fails.
Monthly cost by model for this workload
| Model | Input / 1M | Output / 1M | Est. monthly cost |
|---|---|---|---|
| Gemini 1.5 Flash | $0.075 | $0.30 | $0.48 |
| DeepSeek V3 / V2.5 | $0.140 | $0.28 | $0.73 |
| GPT-4o Mini | $0.150 | $0.60 | $0.96 |
| Llama 3.3 70B (Groq/Together) | $0.590 | $0.79 | $2.83 |
| Claude 3.5 Haiku | $0.800 | $4.00 | $5.60 |
| o1-mini | $1.100 | $4.40 | $7.04 |
| Gemini 1.5 Pro | $1.250 | $5.00 | $8.00 |
| Mistral Large 2 | $2.000 | $6.00 | $11.60 |
| GPT-4o (Omni) | $2.500 | $10.00 | $16.00 |
| Claude 3.5 Sonnet | $3.000 | $15.00 | $21.00 |
| o1 (Reasoning) | $15.000 | $60.00 | $96.00 |
Computed from list prices and the workload above (4,000,000 input and 600,000 output tokens per month), with no caching or batch discounts. Real bills vary.
How to cut this cost
- Send only relevant tables
Retrieve the 3 to 5 tables that match the question instead of the entire schema to shrink every prompt.
- Validate before escalating
Run EXPLAIN on the generated SQL. Only retry on the stronger model when the query fails, so most requests stay on the cheap tier.
Simulate your own spend
Quick Workload Presets
Pick a ready-made scenario or customize your token volume below.
Token & Usage Parameters
By switching or routing background tasks from GPT-4o to Gemini 1.5 Flash, your team saves up to $2,270 annually.
Lowest cost per token, high-frequency tasks, real-time audio/video
State-of-the-art open economics, high-performance general intelligence
High-volume text processing, fast chatbots, classification
Open-weights privacy, self-hosting or ultra-cheap hosted inferencing
Rapid code completion, customer service, structured data extraction
Fast STEM reasoning, competitive programming at lower cost
Massive context (2M tokens), full video/audio analysis, large codebases
Multilingual tasks, European compliance, enterprise code generation
Complex multimodal reasoning, coding, and production apps
Software engineering, nuanced writing, complex agentic workflows
Advanced mathematics, algorithmic coding, PhD-level scientific logic
Frequently asked questions
Why is the schema the biggest cost in Text-to-SQL?
The schema is resent with every request, so a 2,000-token schema dominates the bill when answers are only 100 to 200 tokens. Prompt caching or table retrieval cuts this directly.