Code · best for

Top picks for Code Documentation (2026)

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

Updated 2026-09-04 · 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 $1.04/M input.

#ModelScoreIn / 1MOut / 1MContext
1 Anthropic: Claude Opus 4.7 (batch)anthropic/claude-opus-4.7:batch 152 $2.50 $12.50 1,000,000 Details →
2 Anthropic: Claude Sonnet 4.6 (batch)anthropic/claude-sonnet-4.6:batch 151 $1.50 $7.50 1,000,000 Details →
3 Anthropic: Claude Sonnet 4.6anthropic/claude-sonnet-4.6 149 $3.00 $15.00 1,000,000 Details →
4 OpenAI: GPT-5.4 (batch)openai/gpt-5.4:batch 148 $1.25 $7.50 1,050,000 Details →
5 Anthropic: Claude Opus 4.8 (batch)anthropic/claude-opus-4.8:batch 148 $2.50 $12.50 1,000,000 Details →
6 DeepSeek: DeepSeek V4 Pro 0423deepseek/deepseek-v4-pro 148 $1.04 $2.08 1,048,576 Details →
7 OpenAI: GPT-5.5 (batch)openai/gpt-5.5:batch 147 $2.50 $15.00 1,050,000 Details →
8 Z.ai: GLM 5.2z-ai/glm-5.2 147 $0.97 $3.04 1,048,576 Details →
9 OpenAI: GPT-5.4openai/gpt-5.4 147 $2.50 $15.00 1,050,000 Details →
10 Google: Gemini 3.1 Pro Preview (batch)google/gemini-3.1-pro-preview:batch 146 $1.00 $6.00 1,048,576 Details →
11 Google: Gemini 3.1 Pro Previewgoogle/gemini-3.1-pro-preview 145 $2.00 $12.00 1,048,576 Details →
12 Z.ai: GLM 5.3 Flashz-ai/glm-5.3-flash 145 $0.07 $0.25 1,310,720 Details →
13 Z.ai: GLM 5.3 Flash (batch)z-ai/glm-5.3-flash:batch 145 $0.15 $0.50 1,048,575 Details →
14 Meta: Muse Spark 1.3meta/muse-spark-1.3 144 $1.25 $4.25 1,048,576 Details →
15 Google: Gemini 3.8 Flash (batch)google/gemini-3.8-flash:batch 144 $0.38 $1.88 1,048,576 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