NEW: Claude Code Security — research preview →

Model Comparison

Claude vs GPT-6 vs Gemini 3 vs DeepSeek V4 for coding tasks — benchmarks, cost, and when to use each

Updated Oct 2026Read time: 14 min

title: "Model Comparison" description: "Claude vs GPT-6 vs Gemini 3 vs DeepSeek V4 for coding tasks — benchmarks, cost, and when to use each" section: "Ecosystem" readTime: "14 min" badge: "Updated Oct 2026"

Model Comparison for Coding

Choosing the right model for a task has a significant impact on output quality, speed, and cost. This guide focuses on practical coding performance — not academic benchmarks.

Quick Reference

ModelBest ForContextSpeedCost
Claude Fable 5.1Hardest reasoning, long-horizon agentic work1MSlower$$$$
Claude Opus 5.5Default for most coding and agentic work1MModerate$$$
Claude Sonnet 5.5Everyday coding, speed/intelligence balance1MFast$$
Claude Haiku 5.5High-volume, latency-sensitive tasks (routing, classification)1MFastest$
GPT-6 AstraOpenAI flagship for complex reasoning and coding1.05MSlower$$$$
GPT-6.1 SolOpenAI balance of intelligence and cost1.05MModerate$$
GPT-6 LunaHigh-volume, focused tasks1.05MFast$
Gemini 3.1 Pro (preview)Very large codebases, long documents1MModerate$$$
Gemini 3.8 FlashAgentic coding at Flash prices1MFast$$
DeepSeek V4 (Pro / Flash)Cost-efficient coding1MFast$

Retired / deprecated models: Claude Opus 4, Opus 4.1, Sonnet 4, and Haiku 3.5 are retired on the Claude API (some remain on Amazon Bedrock or Google Cloud), and Claude Sonnet 4.5 is deprecated. In GitHub Copilot, Claude Sonnet 4 (May 6, 2026), Grok Code Fast 1 (May 15), GPT-4.1 (June 1), GPT-5.2 and GPT-5.2-Codex (June 5), Gemini 2.5 Pro (July 31), Gemini 3.1 Pro, Claude Opus 4.5/4.6, Sonnet 4.5/4.6 (September 1), and Gemini 3.5/3.6 Flash and Claude Opus 4.7 (October 2) were deprecated; GPT-5.5, GPT-5.4, GPT-5.4 mini, GPT-5 mini, Gemini 3.7 Flash, and Grok 4.5 follow on October 19, 2026. Remove these from any model-selection configs.

Claude Models (Anthropic)

When Claude Excels

  • Following complex, multi-part instructions — Claude rarely misses constraints buried in long prompts
  • Agentic tasks — Claude's tool use and multi-step reasoning are best-in-class for Claude Code workflows
  • Security-conscious code — tends to include validation and error handling unprompted
  • Long refactoring sessions — every current Claude model has a 1M-token context window and up to 128K output tokens

The Claude 5 Family

ModelAPI IDContextMax outputInput / Output (per MTok)Default effort (API)
Claude Fable 5.1claude-fable-5-11M128K$10 / $50high
Claude Opus 5.5claude-opus-5-51M128K$4 / $20medium
Claude Sonnet 5.5claude-sonnet-5-51M128K$2 / $10high
Claude Haiku 5.5claude-haiku-5-51M128K$0.10 / $0.50 (prompts up to 100K tokens); $0.50 / $2.50 abovemedium

All four use adaptive thinking (always on for Fable 5.1 and Opus 5.5), accept text and image input, and have a June 2026 knowledge cutoff. The Batch API is 50% off, and prompt-cache reads cost a fraction of base input ($0.25/MTok on Fable 5.1, $0.20 on Opus 5.5, $0.10 on Sonnet 5.5). Model IDs are dateless pinned snapshots; on Amazon Bedrock prefix them with anthropic. (for example anthropic.claude-opus-5-5).

Legacy models still available: Claude Fable 5, Opus 5, Opus 4.8, Opus 4.7, Opus 4.6, Opus 4.5, Sonnet 5, Sonnet 4.6, and Haiku 4.5.

Choosing Within Claude Code

Opus 5.5 is the default model in Claude Code on Pro, Max, Team, Enterprise, and the Anthropic API. Use it for:

  • Feature implementation
  • Bug fixes
  • Code review
  • Test generation
  • Day-to-day pair programming

Switch to Fable 5.1 (alias fable, or best) for:

  • System architecture design where depth matters more than speed
  • Long-horizon agentic tasks
  • Problems where Opus 5.5 at higher effort still falls short

Use Sonnet 5.5 when you want faster turns at lower cost, and Haiku 5.5 for subagents, routing, and bulk scripted jobs.

# Override model in Claude Code (aliases: default, best, fable, opus, sonnet, haiku, opusplan)
claude --model fable "Design the database schema for a multi-tenant SaaS application..."
 
# Or mid-session
/model sonnet

The opusplan alias uses Opus in plan mode and Sonnet for execution. Alias resolution differs by provider (on Amazon Bedrock and Google Cloud, sonnet still resolves to Sonnet 4.5), so pin a full model ID when you need consistency. Precedence is: /model in-session, then --model, then ANTHROPIC_MODEL, then the model key in settings.

Effort Levels

Effort controls how much the model thinks. Current Claude models accept low, medium, high, xhigh, and max. Set it with /effort, --effort, the CLAUDE_CODE_EFFORT_LEVEL env var, or effortLevel in settings; skills and subagents can set effort in frontmatter.

claude --model opus --effort xhigh "Find the race condition in the job scheduler"

GPT-6 (OpenAI)

The GPT-6 Family

ModelAPI IDContextMax outputInput / Output (per MTok)
GPT-6 Astragpt-6-astra1.05M128K$10 / $50
GPT-6.1 Solgpt-6.1-sol1.05M128K$2 / $10
GPT-6 Lunagpt-6-luna1.05M128K$0.10 / $0.50

All three accept text and image input (maximum input 922K tokens). Prompts over 272K input tokens cost 2x input and 1.5x output for the whole request; Batch and Flex are 50% off.

  • Astra: OpenAI's flagship for complex reasoning and coding
  • Sol: the middle tier, balancing intelligence and cost
  • Luna: the most efficient tier, for focused, high-volume tasks

Via Claude Code

Claude Code is built for Claude models and officially supports the Claude API, Amazon Bedrock, Google Cloud, Microsoft Foundry, and Claude Platform on AWS. Routing it to non-Claude models requires a third-party gateway that translates the Anthropic Messages API and is not officially supported, so use GPT models in their native tools instead.

In Copilot

Copilot offers Claude, GPT, Gemini, Grok, Kimi, and MAI models, and the roster changes often. Switch models:

  • VS Code → Copilot Chat → model picker
  • Completions: run GitHub Copilot: Change Completions Model from the command palette

Bring Your Own Key (BYOK): Local BYOK lets you add your own provider keys (for example Anthropic, OpenAI, Azure OpenAI, Google AI Studio, Amazon Bedrock, Ollama, or any OpenAI-compatible endpoint) in VS Code, JetBrains IDEs, Xcode, Copilot CLI, the Copilot app, and the Copilot SDK. Business and Enterprise organizations can disable it by policy, and enterprise BYOK (keys set by owners for all users) is in public preview. BYOK usage is billed by your provider, so it is a way to use models Copilot does not list.

Gemini 3 (Google)

ModelAPI IDContextMax outputInput / Output (per MTok)
Gemini 3.1 Pro (preview)gemini-3.1-pro-preview1M64K$2 / $12 (prompts up to 200K); $4 / $18 above
Gemini 3.8 Flashgemini-3.8-flash1M64K$0.75 / $3.75 (rising to $1.50 / $7.50 on Jan 1, 2027)

Gemini 2.5 models are still served but only to existing users; Google recommends Gemini 3.8 Flash or 3.5 Flash-Lite for new projects.

When Gemini Excels

  • Massive codebase analysis: 1M-token context window — fit a large monorepo in one prompt
  • Long document analysis: Analyze full spec documents and code together
  • Mixed media input: Gemini 3.8 Flash accepts text, images, video, audio, and PDF

In Cursor

Cursor's model picker includes Gemini 3.8 Flash and Gemini 3.1 Pro, alongside Claude, GPT, Grok, and its own Composer models. Non-Cursor models are billed at API rates, and Auto mode routes each request for cost, balance, or intelligence.

# Gemini CLI use case — full codebase architecture review
# Concatenate entire src/ into one input
find src/ -name "*.ts" -exec cat {} \; | \
  gemini -p "Identify all circular dependencies and suggest how to break each cycle"

Model Selection by Task Type

TaskRecommendedWhy
Autocomplete / ghost textCopilot (default completion model)Latency matters
Bug fix in 1-3 filesClaude Sonnet 5.5 or GPT-6.1 SolBoth excel; pick your default
Feature from scratchClaude Opus 5.5Best instruction following
Architecture designClaude Fable 5.1Deepest reasoning
Screenshot → codeClaude Opus 5.5 or GPT-6 AstraBoth accept image input
Whole-repo refactorClaude Opus 5.5 or Gemini 3.1 ProBoth have a 1M-token context
Security auditClaude Opus 5.5Best at compliance and caution
High-volume automationClaude Haiku 5.5, GPT-6 Luna, or DeepSeek FlashCost efficiency
Offline/private codeLocal model (Ollama)No data leaves machine

Cost Optimization

Token Management

# Claude Code has no --max-tokens flag. In print mode, cap turns and spend instead
claude -p --max-turns 5 --max-budget-usd 2.00 "Review this function for security issues"
 
# Use lower effort (or a smaller model) for routine work
claude -p --model haiku --effort low "Summarize the changes in CHANGELOG.md"
 
# Use -p (non-interactive) for batch jobs — no conversation overhead
for f in src/api/*.ts; do
  claude -p "Review $f for security issues" >> review.log
done

Model Router Strategy

Use a cheap model for screening, expensive model for execution:

NEEDS_COMPLEX=$(claude -p --model haiku "Does this task require deep reasoning? Answer YES or NO only: $TASK")
if [ "$NEEDS_COMPLEX" = "YES" ]; then
  claude --model fable "$TASK"
else
  claude --model sonnet "$TASK"
fi

Local / Private Models

For code that can't leave your infrastructure:

ToolModelsNotes
OllamaQwen3-Coder, Devstral, gpt-ossFree; serves an Anthropic-compatible /v1/messages API
ContinueAny Ollama modelVS Code and JetBrains extensions, plus a CLI
LM StudioAny GGUF modelGUI + API server; Anthropic-compatible /v1/messages (0.4.1+)

Ollama and LM Studio both document running Claude Code against a local model. This is their setup, not one Anthropic supports:

# Ollama (default port 11434); the token is a placeholder
ollama pull qwen3-coder
ANTHROPIC_AUTH_TOKEN=ollama ANTHROPIC_BASE_URL=http://localhost:11434 claude --model qwen3-coder
 
# LM Studio (default port 1234)
ANTHROPIC_AUTH_TOKEN=lmstudio ANTHROPIC_BASE_URL=http://localhost:1234 claude --model openai/gpt-oss-20b

Local models are significantly behind frontier models for complex agentic tasks. Use them for completions and simple edits; use cloud models for multi-step agent workflows.

Benchmarks

Published scores (SWE-bench Verified, Terminal-Bench, LiveCodeBench, and others) change with every model release, so static comparison tables go stale quickly. Check each model's official launch page for current numbers.

Benchmarks measure narrow capabilities. Real-world agentic coding performance depends heavily on instruction following, tool use quality, and context management — evaluate on your actual tasks.