Top picks for Code Refactoring (2026)
Safely restructuring an existing codebase across many files. Ranked from 422 live models on the OpenRouter catalog, weighted for context window, reasoning quality, structured output.
Updated 2026-09-04 · prices checked at this morning's rebuild
Which should you use? Anthropic: Claude Opus 4.7 (batch) tops this ranking on blended score. If cost drives the decision, OpenAI: GPT-5.4 (batch) is the cheapest of the leaders at $1.25/M input.
| # | Model | Score | In / 1M | Out / 1M | Context | |
|---|---|---|---|---|---|---|
| 1 | Anthropic: Claude Opus 4.7 (batch)anthropic/claude-opus-4.7:batch | 185 | $2.50 | $12.50 | 1,000,000 | Details → |
| 2 | Anthropic: Claude Sonnet 4.6anthropic/claude-sonnet-4.6 | 181 | $3.00 | $15.00 | 1,000,000 | Details → |
| 3 | Anthropic: Claude Sonnet 4.6 (batch)anthropic/claude-sonnet-4.6:batch | 181 | $1.50 | $7.50 | 1,000,000 | Details → |
| 4 | Anthropic: Claude Opus 4.7anthropic/claude-opus-4.7 | 180 | $5.00 | $25.00 | 1,000,000 | Details → |
| 5 | Anthropic: Claude Opus 4.8 (batch)anthropic/claude-opus-4.8:batch | 176 | $2.50 | $12.50 | 1,000,000 | Details → |
| 6 | OpenAI: GPT-5.5 (batch)openai/gpt-5.5:batch | 176 | $2.50 | $15.00 | 1,050,000 | Details → |
| 7 | OpenAI: GPT-5.4openai/gpt-5.4 | 174 | $2.50 | $15.00 | 1,050,000 | Details → |
| 8 | OpenAI: GPT-5.4 (batch)openai/gpt-5.4:batch | 174 | $1.25 | $7.50 | 1,050,000 | Details → |
| 9 | DeepSeek: DeepSeek V4 Pro 0423deepseek/deepseek-v4-pro | 173 | $1.04 | $2.08 | 1,048,576 | Details → |
| 10 | Anthropic: Claude Fable 5 (batch)anthropic/claude-fable-5:batch | 173 | $5.00 | $25.00 | 1,000,000 | Details → |
| 11 | Z.ai: GLM 5.2z-ai/glm-5.2 | 172 | $0.97 | $3.04 | 1,048,576 | Details → |
| 12 | Anthropic: Claude Opus 4.8anthropic/claude-opus-4.8 | 171 | $5.00 | $25.00 | 1,000,000 | Details → |
| 13 | Google: Gemini 3.1 Pro Previewgoogle/gemini-3.1-pro-preview | 169 | $2.00 | $12.00 | 1,048,576 | Details → |
| 14 | Google: Gemini 3.1 Pro Preview (batch)google/gemini-3.1-pro-preview:batch | 169 | $1.00 | $6.00 | 1,048,576 | Details → |
| 15 | OpenAI: GPT-5.5openai/gpt-5.5 | 168 | $5.00 | $30.00 | 1,050,000 | Details → |
How we ranked these
For Code Refactoring, we weight models on context window, reasoning quality, structured output. Scores combine each model's public specs with independent benchmark results (Aider Polyglot coding scores, Artificial Analysis intelligence/coding/agentic indices) and live pricing. See full methodology →