Language

Code generation & completion

Models and APIs built for writing, completing and fixing code.

Rank for my needs

Cheapest right now

As of December 2026, the cheapest API for code generation & completion is grok-build-0.1 from xAI (Grok) at $2.00 per 1M output tokens, then Kimi K2.7 Code from Moonshot AI (Kimi) at $4.00 and Kimi K2.7 Code (high-speed) from Moonshot AI (Kimi) at $8.00. Prices verified Nov 21 – Dec 1, 2026 against each provider's pricing page; confirm there before you buy.

  1. #1 · xAI (Grok)grok-build-0.1$2.00 per 1M output tokens
  2. #2 · Moonshot AI (Kimi)Kimi K2.7 Code$4.00 per 1M output tokens
  3. #3 · Moonshot AI (Kimi)Kimi K2.7 Code (high-speed)$8.00 per 1M output tokens

What it is

Code models are LLMs trained and tuned specifically for programming: autocomplete inside an editor (including fill-in-the-middle), generating functions and tests, editing whole repositories as an agent, and explaining or reviewing code. They sit behind IDE assistants and coding agents.

How pricing works

Billed per token like any LLM, with input and output priced separately; we rank on output price. Coding agents send large repository context repeatedly, so input price, prompt caching and context window often matter more than the output price. Some providers sell a faster 'high-speed' variant at about double the price.

We compare everything in one unit: USD per 1M output tokens.

Typical uses

  • Autocomplete and inline edits in IDEs
  • Agentic coding: reading a repo, editing files, running tests
  • Writing tests, docs and migrations
  • Code review and bug explanation
  • Code translation between languages

What to compare

  • Pass rate on SWE-bench / LiveCodeBench-style benchmarks
  • Context window (how much of the repo fits)
  • Fill-in-the-middle support and latency for autocomplete
  • Tool-use reliability for agents
  • Output speed

Watch out for

  • Cost per task, not per token, is what counts: a cheaper model that needs more retries can cost more.
  • Autocomplete needs low latency and FIM; a chat-style model is a poor fit even if it is smart.
  • Agents re-send long context each step, so input and cache pricing dominate.

All 5 APIs, cheapest first

Free to browse
Tick 2 to 4 APIs to compare them side by side.
API$ / 1M out tokensContext windowFill-in-the-middleTool use / agent modeQualityPrice dataCompare
Codestral

Mistral AI

$0.90

in $0.30

256K tokensYesYes
–
Unverified sample
grok-build-0.1

xAI (Grok)

$2.00256K tokens—Yes
–
Verified Nov 21, 2026
Kimi K2.7 Code

Moonshot AI (Kimi)

$4.00262.144K tokens—Yes
–
Verified Dec 1, 2026
Qwen3-Coder

Alibaba Cloud (Qwen)

$5.00

in $1.00

256K tokensYesYes
–
Unverified sample
Kimi K2.7 Code (high-speed)

Moonshot AI (Kimi)

$8.00262.144K tokens—Yes
–
Verified Dec 1, 2026

Questions

What is the cheapest API for code generation & completion?
grok-build-0.1 from xAI (Grok) at $2.00 per 1M output tokens, verified Nov 21, 2026. Proxlai ranks 3 verified offerings in this market in the same unit.
How is API pricing for code generation & completion compared?
Billed per token like any LLM, with input and output priced separately; we rank on output price. Coding agents send large repository context repeatedly, so input price, prompt caching and context window often matter more than the output price. Some providers sell a faster 'high-speed' variant at about double the price. Proxlai converts every offering to one unit, USD per 1M output tokens, so prices can be ranked side by side.
How current are these prices?
Each price shows the date it was last checked against the provider's own pricing page and links to it. In this market, prices were verified Nov 21 – Dec 1, 2026. Sample prices that have not been checked yet are left out of this summary.