Code · best for

Top picks for Code Documentation (2026)

Writing clear docstrings and READMEs that match the code. Ranked from 452 live models on the OpenRouter catalog, weighted for context window, low cost, reasoning quality.

Updated 2026-10-13 · prices checked at this morning's rebuild

What this is Ranked by capability match + real benchmark scores (Aider Polyglot, Artificial Analysis Intelligence Index) + live pricing. Models need the right specs for Code Documentation, then benchmark performance refines the order. Full methodology →

Which should you use? Anthropic: Claude Opus 4.7 (batch) tops this ranking on blended score. If cost drives the decision, DeepSeek: DeepSeek V4 Pro 0423 is the cheapest of the leaders at $0.96/M input.

#ModelScoreIn / 1MOut / 1MContext
1 Anthropic: Claude Opus 4.7 (batch)anthropic/claude-opus-4.7:batch 146 $2.50 $12.50 1,000,000 Details →
2 Anthropic: Claude Sonnet 4.6 (batch)anthropic/claude-sonnet-4.6:batch 144 $1.50 $7.50 1,000,000 Details →
3 Anthropic: Claude Sonnet 4.6anthropic/claude-sonnet-4.6 142 $3.00 $15.00 1,000,000 Details →
4 OpenAI: GPT-5.4 (batch)openai/gpt-5.4:batch 142 $1.25 $7.50 1,050,000 Details →
5 Anthropic: Claude Opus 4.8 (batch)anthropic/claude-opus-4.8:batch 141 $2.50 $12.50 1,000,000 Details →
6 DeepSeek: DeepSeek V4 Pro 0423deepseek/deepseek-v4-pro 141 $0.96 $1.91 1,048,576 Details →
7 OpenAI: GPT-5.2 (batch)openai/gpt-5.2:batch 141 $0.88 $7.00 400,000 Details →
8 Google: Gemini 3.1 Pro Preview (batch)google/gemini-3.1-pro-preview:batch 141 $1.00 $6.00 1,048,576 Details →
9 OpenAI: GPT-5.4openai/gpt-5.4 140 $2.50 $15.00 1,050,000 Details →
10 Google: Gemini 2.5 Flash (batch)google/gemini-2.5-flash:batch 140 $0.15 $1.25 1,048,576 Details →
11 OpenAI: GPT-5.5 (batch)openai/gpt-5.5:batch 140 $2.50 $15.00 1,050,000 Details →
12 Google: Gemini 2.5 Flashgoogle/gemini-2.5-flash 140 $0.30 $2.50 1,048,576 Details →
13 OpenAI: GPT-5.2openai/gpt-5.2 139 $1.75 $14.00 400,000 Details →
14 Google: Gemini 3.1 Pro Previewgoogle/gemini-3.1-pro-preview 139 $2.00 $12.00 1,048,576 Details →
15 OpenAI: GPT-5 (batch)openai/gpt-5:batch 139 $0.62 $5.00 400,000 Details →
From this site PicksByModel API These rankings as live JSON: quality scores, pricing, and context for every model.
See plans →

How we ranked these

For Code Documentation, we weight models on context window, low cost, reasoning quality. 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 →

About Code Documentation

yourself.

When to use: Use this when you have working code without documentation, or when you need to update docs to match a recent code change without manually writing every

Common questions

What is the difference between AI documentation and human-written docs?

AI-generated documentation excels at speed and consistency for straightforward functions, but often misses domain context, usage warnings, and examples that experienced developers would include. Models like Claude 3.5 Sonnet handle complex parameter relationships better than older models, but you should always review critical paths and add use-case examples manually.

How much slower is it to use a better model for documentation versus a faster one?

GPT-4 or Claude 3.5 Sonnet are typically 2-4x slower per file than GPT-3.5, but produce fewer errors that require rewrites. For a 500-file codebase, the slower model still finishes in hours rather than minutes, and the time savings from not fixing bad docs usually outweigh the generation delay.

Related tasks

The Model Movers Report

One email every Friday, built from this site's own rankings: the current top five by benchmark score, every model released in the last seven days, and one note worked out from that week's numbers. You can unsubscribe from any issue with one click.