Best AI model to code and fix bugs
Writing code, fixing bugs and reviewing pull requests. The most used yardstick is SWE-bench Verified, with real repository issues.
Suggested models
1 Claude Opus 4.7 Anthropic
Why it fits: Solves 83.5% of SWE-bench Verified issues, where the model has to fix real code and pass the tests.
- SWE-bench Verified: 83.5%, per Epoch AI, latest version we checked?what it is
- Price: US$ 5.00 input and US$ 25.00 output per 1M tokens (source: OpenRouter)?
- Estimated cost (see the How we calculate block): about US$ 0.11 (estimate)
- Weights: Closed?
- Alternative: GLM-5.2, with open weights, 78.7% on SWE-bench Verified
The latest version, Claude Opus 5.5, does not have a published score yet.
2 GPT-5.5 OpenAI
Why it fits: Solves 80.6% of SWE-bench Verified issues, where the model has to fix real code and pass the tests.
- SWE-bench Verified: 80.6%, per Epoch AI, latest version we checked?
- Price: US$ 5.00 input and US$ 30.00 output per 1M tokens (source: OpenRouter)?
- Estimated cost (see the How we calculate block): about US$ 0.12 (estimate)
- Weights: Closed?
- Alternative: GLM-5.2, with open weights, 78.7% on SWE-bench Verified
3 Gemini 3.5 Flash Google
Why it fits: Solves 79.3% of SWE-bench Verified issues, where the model has to fix real code and pass the tests.
- SWE-bench Verified: 79.3%, per Epoch AI, latest version we checked?
- Price: US$ 1.50 input and US$ 9.00 output per 1M tokens (source: OpenRouter)?
- Estimated cost (see the How we calculate block): about US$ 0.036 (estimate)
- Weights: Closed?
- Alternative: GLM-5.2, with open weights, 78.7% on SWE-bench Verified
The latest version, Gemini 3.8 Flash, does not have a published score yet.
4 GLM-5.2 Zhipu AI (Z.ai)
Why it fits: Solves 78.7% of SWE-bench Verified issues, where the model has to fix real code and pass the tests.
- SWE-bench Verified: 78.7%, per Epoch AI, latest version we checked?
- Price: no public API price. With open weights, the cost depends on the hardware you run it on.?
- Estimated cost (see the How we calculate block): no estimate: no API price
- Weights: Open?
- Alternative: already the cheapest or open option on this list
The latest version, GLM-5.3, does not have a published score yet.
Order: highest SWE-bench Verified score among code and fix bugs models, one version per model line.
How we calculate
Change the numbers and the cost of every model on the page is recalculated right away. Without JavaScript, the default values below apply.
Input = lines × characters per line ÷ 4. Output = answer lines × characters per line ÷ 4.
With these numbers: about 15,000 input tokens and 1,500 output tokens (estimate).
Conversion used: 1 token is about 4 characters or 0.75 words, OpenAI's rough rule for English text. Other languages can differ. Conversion source: OpenAI, Understanding and counting tokens
Fields marked as assumption are our own guesses, without a source. Adjust them to your case.
Cost of each model = input tokens × input price + output tokens × output price, with prices per 1M tokens. Models that reason before answering can use many more output tokens. It is a reference calculation and does not change the order of the list.
Other paid models we checked
Reference paid models from the main labs. They are left out of the list above because of a lower score, no score on this metric, or not passing the case filter. Prices come from the company's official page when it publishes them.
| Model | Score on this metric | Price and source | Estimated cost |
|---|---|---|---|
| GPT-6 Astra OpenAI | no score on this metric | US$ 10.00 input and US$ 50.00 output per 1M tokens (source: OpenAI, official page) | about US$ 0.22 (estimate) |
| GPT-6.1 Sol OpenAI | no score on this metric | US$ 2.00 input and US$ 10.00 output per 1M tokens (source: OpenAI, official page) | about US$ 0.045 (estimate) |
| GPT-6 Luna OpenAI | no score on this metric | US$ 0.10 input and US$ 0.50 output per 1M tokens (source: OpenAI, official page) | about US$ 0.0023 (estimate) |
| Claude Fable 5.2 Anthropic | no score on this metric | US$ 8.00 input and US$ 40.00 output per 1M tokens (source: Anthropic, official page) | about US$ 0.18 (estimate) |
| Claude Opus 5.5 Anthropic | no score on this metric | US$ 4.00 input and US$ 20.00 output per 1M tokens (source: Anthropic, official page) | about US$ 0.09 (estimate) |
| Claude Sonnet 5.5 Anthropic | no score on this metric | US$ 2.00 input and US$ 10.00 output per 1M tokens (source: Anthropic, official page) | about US$ 0.045 (estimate) |
| Claude Haiku 5.5 Anthropic | no score on this metric | US$ 0.10 input and US$ 0.50 output per 1M tokens (source: Anthropic, official page; up to 100,000 prompt tokens) | about US$ 0.0023 (estimate) |
| Gemini 4 Argon Google | no score on this metric | US$ 2.00 input and US$ 10.00 output per 1M tokens promotional price (source: Google, official page; promotional price currently shown on the page; Google has said this price will go up) | about US$ 0.045 (estimate) |
| Gemini 3.8 Flash Google | no score on this metric | US$ 0.75 input and US$ 3.75 output per 1M tokens promotional price (source: Google, official page; promotional price currently shown on the page; Google has said this price will go up) | about US$ 0.017 (estimate) |
| Grok 4.7 xAI | no score on this metric | US$ 2.00 input and US$ 6.00 output per 1M tokens (source: xAI, official page) | about US$ 0.039 (estimate) |
| Mistral Large 4 Mistral AI | no score on this metric | US$ 0.50 input and US$ 1.50 output per 1M tokens (source: Mistral AI, official page; price the official page gives for Mistral Large, without naming the version) | about US$ 0.0097 (estimate) |
| Mistral Medium 3.5 Mistral AI | no score on this metric | US$ 1.50 input and US$ 7.50 output per 1M tokens (source: OpenRouter; the price could not be read from the official page, because the table is built automatically; OpenRouter is kept as the reference) | about US$ 0.034 (estimate) |
| Command A Cohere | no score on this metric | US$ 2.50 input and US$ 10.00 output per 1M tokens (source: OpenRouter; Cohere's official page does not publish this model's price; OpenRouter is kept as reference) | about US$ 0.052 (estimate) |
| Command A+ Cohere | no score on this metric | US$ 0.30 input and US$ 1.50 output per 1M tokens (source: OpenRouter; Cohere's official page does not publish this model's price; OpenRouter is kept as reference) | about US$ 0.0067 (estimate) |
| Nova Premier 1.0 Amazon | no score on this metric | US$ 2.50 input and US$ 12.50 output per 1M tokens (source: Amazon, official page; us-east-1 region, official AWS price list) | about US$ 0.056 (estimate) |
| Nova 2 Lite Amazon | no score on this metric | US$ 0.33 input and US$ 2.75 output per 1M tokens (source: Amazon, official page; us-east-1 region, official AWS price list) | about US$ 0.0091 (estimate) |
| GPT-5.3-Codex OpenAI | 74.8% | US$ 1.75 input and US$ 14.00 output per 1M tokens (source: OpenAI, official page) | about US$ 0.047 (estimate) |
| Devstral 2 Mistral AI | no score on this metric | US$ 0.40 input and US$ 2.00 output per 1M tokens (source: OpenRouter) | about US$ 0.009 (estimate) |
FAQ
What is the best AI model to code and fix bugs?
By this page's rule, the list starts with Claude Opus 4.7, GPT-5.5, Gemini 3.5 Flash, GLM-5.2. Order: highest SWE-bench Verified score among code and fix bugs models, one version per model line.
How much does it cost to code and fix bugs with AI?
With the default values in the How we calculate block, the estimate ranges from US$ 0.036 to US$ 0.12 among the listed models with a published price. It is only an estimate and you can adjust the numbers on the page.
Is there an open weights option to code and fix bugs?
Yes: GLM-5.2.
Does this page use AI to recommend?
No. The recommendation comes from fixed rules over public data from Epoch AI, OpenRouter, Hugging Face and each company's official pricing page, in the latest version we checked. The typed text is only compared with keywords.
Terms used on this page
Use cases with their own page
Official pricing pages checked
Sources
- Epoch AI, CC BY 4.0, latest version we checked.
- OpenRouter Benchmarks, CC BY 4.0, latest version we checked.
- OpenRouter, dados públicos da API; exports de benchmarks e rankings em CC BY 4.0, latest version we checked.
- Hugging Face Hub, metadados públicos do Hub; licença de cada modelo no repositório, latest version we checked.
Dates come from the sources: OpenRouter listing or Hugging Face repo creation, which may differ from the official launch. Family and version were grouped by rule from the name.