Code Generation

28 recommended models

Writing, debugging, and explaining code across programming languages

Best Models for Code Generation

Claude Opus 4

by Anthropic

Anthropic's most capable model, excelling at complex analysis, nuanced content creation, and advanced coding tasks. Features superior reasoning and the ability to work autonomously on extended tasks.

200K contextFrom $15/MTokAPI Available

Claude Sonnet 4

by Anthropic

The best combination of performance and speed for efficient, high-throughput tasks. Excellent balance of intelligence and cost-effectiveness.

200K contextFrom $3/MTokAPI Available

GPT-4o

by OpenAI

OpenAI's flagship multimodal model with advanced reasoning, vision, and audio capabilities. Fast and versatile for most tasks.

128K contextFrom $2.50/MTokAPI Available

o1

by OpenAI

OpenAI's reasoning model designed to solve hard problems across science, coding, and math using chain-of-thought reasoning.

200K contextFrom $15/MTokAPI Available

o3-mini

by OpenAI

Fast, cost-efficient reasoning model excelling at STEM tasks. Offers adjustable reasoning effort levels.

200K contextFrom $1.10/MTokAPI Available

Gemini 2.0 Flash

by Google

Google's latest multimodal model with native tool use, code execution, and agentic capabilities. Fast and efficient.

1000K contextFrom $0.10/MTokAPI Available

Llama 3.3 70B

by Meta

Meta's latest open-source model offering performance comparable to Llama 3.1 405B at a fraction of the cost. Excellent for self-hosting.

128K contextAPI Available

Mistral Large

by Mistral AI

Mistral's flagship model with top-tier reasoning, coding, and multilingual capabilities. Strong at complex tasks.

128K contextFrom $2/MTokAPI Available

Codestral

by Mistral AI

Specialized coding model trained on 80+ programming languages. Optimized for code completion and generation.

32K contextFrom $0.30/MTokAPI Available

Grok-2

by xAI

xAI's flagship model with strong reasoning and coding capabilities. Known for witty responses and real-time knowledge.

128K contextFrom $2/MTokAPI Available

Llama 3.1 405B

by Meta

Meta's largest open-source model with 405 billion parameters. Competitive with leading closed models on benchmarks.

128K contextAPI Available

Mistral Nemo

by Mistral AI

Efficient 12B model developed with NVIDIA. Drop-in replacement for Mistral 7B with improved performance.

128K contextFrom $0.15/MTokAPI Available

DeepSeek-V3

by DeepSeek

Highly efficient 671B MoE model trained on 14.8T tokens. Achieves top benchmark scores at fraction of typical training cost.

128K contextFrom $0.27/MTokAPI Available

DeepSeek-R1

by DeepSeek

Reasoning-focused model achieving strong performance on math and coding benchmarks through reinforcement learning.

64K contextFrom $0.55/MTokAPI Available

Qwen 2.5 72B

by Alibaba Cloud

Alibaba's flagship open-source model with strong coding and math capabilities. Supports 29 languages.

128K contextAPI Available

Qwen2.5-Coder

by Alibaba Cloud

Specialized coding model available in sizes from 0.5B to 32B. State-of-the-art for open-source code models.

128K contextAPI Available

GPT-4.1

by OpenAI

OpenAI's latest flagship model with improved coding, instruction following, and long-context understanding. Excels at complex multi-step tasks with a 1M token context window.

1000K contextFrom $2.00/MTokAPI Available

GPT-4.1 mini

by OpenAI

A smaller, faster, and more affordable version of GPT-4.1. Ideal for tasks requiring quick responses while maintaining strong performance.

1000K contextFrom $0.40/MTokAPI Available

o3

by OpenAI

OpenAI's most powerful reasoning model. Uses extended thinking time to solve complex problems in math, science, and coding. Achieves expert-level performance on technical benchmarks.

200K contextFrom $10.00/MTokAPI Available

o4-mini

by OpenAI

A cost-effective reasoning model that balances strong logical capabilities with faster response times. Great for everyday reasoning tasks.

200K contextFrom $1.10/MTokAPI Available

GPT-4 Turbo

by OpenAI

An optimized version of GPT-4 with vision capabilities and improved performance. Supports both text and image inputs with a 128K context window.

128K contextFrom $10.00/MTokAPI Available

GPT-4

by OpenAI

OpenAI's original GPT-4 model. A highly capable large language model for complex tasks requiring advanced reasoning and broad knowledge.

8K contextFrom $30.00/MTokAPI Available

o1-mini

by OpenAI

A smaller, faster reasoning model optimized for coding and STEM tasks. Offers strong logical capabilities at a lower cost than o1.

128K contextFrom $1.10/MTokAPI Available

GPT-5

by OpenAI

OpenAI's most advanced language model to date. Features unprecedented reasoning, creativity, and multimodal understanding. Represents a major leap in AI capabilities across all domains.

1000K contextFrom $5.00/MTokAPI Available

GPT-5.1

by OpenAI

The latest iteration of GPT-5 with improved instruction following, reduced hallucinations, and enhanced safety. Offers the best balance of capability and reliability for production use.

1000K contextFrom $5.00/MTokAPI Available

GPT-5.2

by OpenAI

GPT-5.2 is OpenAI's flagship model series for 2025, achieving unprecedented performance in reasoning, coding, and mathematics. Available in three variants—Instant (optimized for speed), Thinking (step-by-step reasoning), and Pro (maximum capability)—it sets new industry benchmarks including a perfect 100% on AIME 2025 and 55.6% on SWE-Bench Pro. The model excels at professional knowledge work including complex spreadsheets, presentations, and business documents. It demonstrates 30% fewer hallucinations than GPT-5.1 and introduces improved agentic capabilities for executing multi-step tasks with high reliability. Key improvements include enhanced tool calling, superior front-end code generation, and better long-context reasoning.

From Varies by variantAPI Available

Claude Opus 4.5

by Anthropic

Claude Opus 4.5 is Anthropic's latest AI model, launched on November 24, 2025. It is designed to be intelligent and efficient, excelling in coding, agents, and computer use. The model significantly improves performance in everyday tasks such as deep research and working with slides and spreadsheets. It is state-of-the-art in real-world software engineering tests and is available on various platforms, including apps, API, and major cloud services.

From $5.00/MTokAPI Available

Claude Haiku 4.5

by Anthropic

Claude Haiku 4.5 is Anthropic's latest small AI model, launched on October 15, 2025. It offers similar coding performance to the previous state-of-the-art model, Claude Sonnet 4, but at one-third the cost and more than twice the speed. This model excels in real-time, low-latency tasks, making it particularly beneficial for applications like chat assistants and customer service agents. Claude Haiku 4.5 also enhances the coding experience, providing a responsive environment for multiple-agent projects and rapid prototyping, while maintaining high intelligence and speed.

From $1 per million tokensAPI Available