All insights

Coding agents

xAI Grok Code: Model Choice, API Access, and Pricing

Grok Code Fast 1 was retired in May 2026. See the documented replacement, a minimal xAI API request, current documented API pricing, and the limits of historical coding-test results.

Illustration for Xai grok code

Short answer: For a new coding integration, use the explicit model ID grok-build-0.1, the replacement listed for grok-code-fast-1 in xAI’s migration guide. The guide also contains conflicting language about where requests using retired model IDs are routed and billed, so don’t rely on the old identifier; confirm the model and charges shown for your own requests. (xAI migration guide)

“xAI Grok code” can also mean a coding agent or editor that uses a Grok model. That is distinct from the model itself: for example, the community-built grok-cli repository says it is not affiliated with xAI, so its features should not be mistaken for native model capabilities. (grok-cli README)

Which Grok model is for coding now?

The migration guide lists grok-build-0.1 as the replacement for the retired grok-code-fast-1 API slug. The model documentation describes Grok Build 0.1 for agentic software and engineering tasks, and lists capabilities including function calling and structured outputs. Those capabilities can support tool-driven applications, but they do not by themselves provide a coding-agent harness, repository permissions, or a safe execution environment. (xAI model documentation)

The retirement page is not fully consistent: its general text says requests to retired slugs redirect to Grok 4.3 and are billed at Grok 4.3 rates, while its model table maps grok-code-fast-1 to grok-build-0.1. The page does not resolve that discrepancy. Use the explicit replacement ID for new requests, and check your request logs and billing rather than assuming how a legacy slug will be handled. (xAI migration guide)

Is it a good fit for your coding work?

Consider Grok Build 0.1 as a candidate for agentic coding, debugging, or web-development tasks when your workflow can test and review the changes. Evaluate it on your own codebase and stack; listed model capabilities are not a guarantee of correctness on a particular repository task.

Historical results offer context, not a current benchmark for Grok Build 0.1. In an evaluation published August 30, 2025, 16x Eval reported a 7.64 average human rating across seven tasks for grok-code-fast-1. It reported 9.5/10 for a folder-watcher fix, 8/10 for a TypeScript-narrowing problem on the second attempt, and 1/10 on a Tailwind CSS v3 z-index task in both attempts. The evaluator also warned that reasoning could delay the final response despite reported throughput of around 100 tokens per second. These were limited, task-specific results for the earlier model ID—not a verified evaluation of Grok Build 0.1. (16x Eval)

Practical selection rule: test representative issues from your own workload, including difficult cases in your main languages and frameworks. Run proposed changes through your normal tests and review process; measure correctness, end-to-end response time, and actual token use. Token throughput alone does not tell you how long an agent workflow will take.

Direct API example

The xAI API quickstart documents a text request to the Responses API using bearer authentication. This example uses the replacement model ID from xAI’s migration table and the quickstart’s documented string form for input. (xAI API quickstart; xAI Responses API reference)

export XAI_API_KEY="your_api_key"

curl https://api.x.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -d '{
    "model": "grok-build-0.1",
    "input": "Find the bug in this function and suggest a fix: function median(a) { a.sort(); return a[a.length / 2] }"
  }'

With the xAI quickstart’s Python SDK example, generated text is available as response.output_text. In the raw Responses API result, the generated response is in the output array. This is a minimal text-generation example, not a complete production integration: add and test the error handling, timeouts, usage accounting, and any tool-calling or structured-output behavior your application needs. (xAI API quickstart; Responses API reference)

Current API pricing—and why old prices mislead

As checked November 9, 2026, xAI’s pricing page lists these USD prices per 1 million tokens for Grok Build 0.1: short-context input $1.00, cached input $0.20, and output $2.00; long-context input $2.00, cached input $0.40, and output $4.00. The page defines the long-context threshold as a prompt reaching 200,000 tokens and says the higher rates then apply to all tokens in the request. It lists cached-input rates but does not specify here which requests qualify for caching. A request to the US regional endpoint is listed at a 1.1× token-rate premium. (xAI API pricing)

At the short-context rates, an estimate for 100,000 uncached input tokens plus 10,000 output tokens is about $0.12 ($0.10 + $0.02). If all 100,000 input tokens qualify for the listed cached rate, the estimate is about $0.04 ($0.02 + $0.02). These examples assume the stated rates apply and exclude any regional-endpoint premium or other charges. (xAI API pricing)

For comparison, 16x Eval’s August 2025 table reported the old Grok Code Fast 1 at $0.20 per 1 million input tokens, $0.02 per 1 million cached input tokens, and $1.50 per 1 million output tokens. Those are historical figures, not current Grok Build 0.1 rates. Budget against the current pricing page and use an explicit model ID. (16x Eval)

Bottom line

For a new xAI API coding integration, use grok-build-0.1, the replacement listed for grok-code-fast-1, rather than relying on the retired slug. The official quickstart documents a minimal Responses API request, and xAI’s pricing page lists current token rates and the long-context threshold. Choose the model only after testing it on your own codebase and checking actual latency, token use, and billing. Treat the 2025 Grok Code Fast 1 evaluation as historical context—not proof of current Grok Build 0.1 performance.

Sources

Grok Model Retirement on May 15, 2026

Grok Build 0.1 — xAI API model documentation

Grok API Quickstart

Responses API Reference

API Pricing

Grok Code Fast 1 Coding Evaluation: Strong Performance with Some Quirks

grok-cli README

Contact us