May 28, 20263 min readModelsGrok Code Fast

Grok Code Fast API - pricing, context window and best use cases

Grok Code Fast is xAI's speed-tuned coding model. It trades the broad reasoning depth of a flagship for low latency and aggressive throughput, which makes it a strong fit for the inner loop of software work: code completion, refactors, test generation, and quick agentic edits. This guide covers what actually matters before you wire it into a workflow — context window, pricing, and the jobs it does well.

Context window

Grok Code Fast ships with a large context window (in the hundreds of thousands of tokens), which is generous enough to drop in multiple source files, a stack trace, and the surrounding type definitions without aggressive trimming. For most coding sessions you will hit your own relevance limits before the model's. The practical advice is unchanged from any long-context model: feed it the right files, not every file. A focused 20k-token prompt with the exact modules in play beats a 200k-token dump of the whole repo — it is cheaper, faster, and produces sharper diffs.

Pricing

Grok Code Fast is priced as a budget coding model: input tokens are cheap and output tokens cost a few times more than input, which is typical. Because it is fast and inexpensive, it shines in high-volume scenarios — agent loops that make dozens of small calls, CI helpers, or editor autocomplete — where a pricier reasoning model would blow the budget.

Through AnyModel you don't manage a separate xAI bill. Pricing is pay-per-token with no subscription and no minimums, and you start with 1,000,000 free tokens on signup (no credit card). Link your Telegram and the free allowance rises to 6,000,000 tokens total — enough to evaluate Grok Code Fast against other models before spending a cent. See live numbers on the models page and put it head-to-head on /compare.

Best use cases

Grok Code Fast earns its name on tasks where iteration speed compounds:

  • Agentic coding loops — tools like Codex, Claude Code, or OpenCode that plan, edit, run, and re-edit. Fast per-step latency makes the whole loop feel responsive.
  • Autocomplete and inline edits — sub-second suggestions inside an editor.
  • Bulk transformations — renaming APIs across a codebase, migrating syntax, adding type hints file by file.
  • Test and boilerplate generation — scaffolding that needs to be correct and idiomatic, not deeply novel.

For tasks that demand heavy multi-step reasoning — subtle algorithm design, tricky concurrency bugs, architecture trade-offs — reach for a flagship reasoning model instead. A common pattern is to use Grok Code Fast for the bulk of edits and escalate only the hard problems. On AnyModel that escalation is a one-word change to the model field; nothing else in your setup moves.

Calling it through one endpoint

AnyModel exposes a single OpenAI-compatible endpoint, so any client that speaks the OpenAI API can call Grok Code Fast. Base URL https://anymodel.org/v1, one key for every model (GPT, Claude, Gemini, DeepSeek, GLM, Kimi, Qwen, Grok). Switching models means changing the model id — that's it.

curl https://anymodel.org/v1/chat/completions \
  -H "Authorization: Bearer $ANYMODEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-code-fast",
    "messages": [{"role": "user", "content": "Refactor this function to be pure and add a unit test."}]
  }'

If you use a supported CLI, install in one line:

bash <(curl -fsSL "https://anymodel.org/i?tool=codex") <YOUR_API_KEY>

Swap tool=codex for tool=claude (Claude Code), opencode, or hermes. For Cursor, Windsurf, Zed, Cline, Aider, Continue, or the Gemini CLI, use a manual OpenAI-compatible setup: point base URL at https://anymodel.org/v1 and paste your key.

A note on privacy

If you are sending proprietary code, enable Ghost Mode — opt-in zero-retention keys where we store no prompts or responses, only a token counter. Note the model provider still receives the prompt to generate a response, so this is not absolute privacy; it removes our side of the retention chain.

Get started

Spin up a key, point your editor at the endpoint, and try Grok Code Fast on a real refactor today. More walkthroughs live on the blog.

Create your free AnyModel account and get 1,000,000 tokens to start.

Read next