For a general-purpose API evaluation, start with grok-4.7. xAI recommends it for code and other general tasks. Consider grok-4.3 if its 1-million-token context window or reasoning-effort options fit your workload, or evaluate grok-4.20-0309-reasoning when its documented reasoning, function-calling, and structured-output capabilities are relevant. For coding-focused work, consider grok-build-0.1, also documented under the grok-code-fast-1 alias. These are shortlist criteria—not claims that one model performs best on your workload. (docs.x.ai)
Check xAI’s model-list reference and your account’s access before deploying. A model name in documentation does not by itself establish that it is available to your API key.
Grok model shortlist
| Workload or need | Model to evaluate | Documented details | Standard token rates (USD per 1M tokens) |
|---|---|---|---|
| General text, coding, or tool use | grok-4.7 |
xAI recommends it for general tasks, including code. Its page lists a 500,000-token context window, text and image input, text output, function calling, and configurable reasoning. | Input $2.00; output $6.00. (docs.x.ai) |
| Long-context work or adjustable reasoning effort | grok-4.3 |
The model page lists a 1-million-token context window, function calling, and reasoning-effort options. | Input $1.25; output $2.50. (docs.x.ai) |
| Reasoning, function calling, and structured output | grok-4.20-0309-reasoning |
The model page lists a 1-million-token context window and support for reasoning, function calling, and structured outputs. Confirm the exact identifier and account access before relying on it. | Input $1.25; output $2.50. (docs.x.ai) |
| Coding-focused agentic software and workflow tasks | grok-build-0.1 (aliases include grok-code-fast-1) |
xAI describes it as a coding model. Its model page lists a 256,000-token context window, function calling, and structured outputs. | Input $1.00; output $2.00. (docs.x.ai) |
| Image, video, or voice tasks | Dedicated Imagine or Voice APIs | xAI lists separate APIs for these media tasks. Check the relevant API documentation for supported operations and billing rather than inferring behavior from a model name. (docs.x.ai) |
Rates depend on the service and operation; see the current pricing table. |
The listed standard rates are not a complete bill estimate. Cached-input charges, long-context pricing, regional routing, tool calls, and media operations may affect cost. (docs.x.ai)
How to choose for your workload
- Start with the task. For general text work, code, and tool use, evaluate Grok 4.7 first. For image, video, or voice operations, look at the dedicated API for that task.
- Check the specific model page for required features. For example, Grok 4.20 Reasoning lists function calling and structured outputs; don't assume another model supports the same features.
- Compare context and cost together. A larger context window can accommodate a longer prompt; it does not by itself show better quality or lower cost. Check the applicable pricing tier before estimating token charges.
- Test candidates on representative work. Use the same prompts, tools, and expected outputs. Compare correctness, format compliance, tool-call success, latency, and cost for your application. This is an evaluation method, not a claim that one model wins.
- Choose an alias or a release-specific ID deliberately. xAI’s general alias guidance says model-name aliases can track newer versions, while date-specific IDs refer to a specific release and are not updated. An alias may suit teams that want newer versions; a fixed release ID may suit workflows that require version consistency. (
docs.x.ai)
Verify API access and make a test request
xAI’s Grok 4.7 guide shows a Responses API request to https://api.x.ai/v1/responses, using Bearer-token authentication, the grok-4.7 model name, and a string for input. (docs.x.ai)
curl https://api.x.ai/v1/responses \
-H "Authorization: Bearer $XAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-4.7",
"input": "Summarize this sentence in five words: Models should be tested against the work they will do."
}'
Create an API key in the xAI console and set it as XAI_API_KEY. Before deploying, check xAI’s model-list API reference for models available to your account. Do not treat a name copied from a third-party catalog as proof that your key can request it.
What API usage costs—and what it does not
xAI lists text API prices in USD per 1 million tokens, with separate charges for input, cached input, and output. For Grok 4.7, the standard rates are $2.00 input, $0.50 cached input, and $6.00 output. The pricing table sets the long-context threshold at 200,000 prompt tokens; when a request reaches that threshold, the long-context rates apply to all tokens in the request. For Grok 4.7, those rates are $4.00 input, $1.00 cached input, and $12.00 output per 1 million tokens. xAI also lists a 1.1× token-rate multiplier for requests sent to the US regional endpoint. Check the current pricing table when budgeting. (docs.x.ai)
The other shortlist models have separate cached-input and long-context rates too. The official table lists standard input/output rates of $1.25/$2.50 for Grok 4.3 and Grok 4.20 Reasoning, and $1.00/$2.00 for Grok Build 0.1. For their cached-input rates, long-context rates, or other charges, consult the model’s current row in the pricing table rather than carrying over Grok 4.7’s figures. (docs.x.ai)
For a simple hypothetical estimate, suppose an application uses 1 million uncached input tokens and 100,000 output tokens, across requests that each stay below the 200,000-token prompt threshold. At Grok 4.7’s standard rates, the token arithmetic is $2.00 + (0.1 × $6.00) = $2.60. This excludes tool invocations, regional premiums, and other applicable charges; it is an illustration, not a measured bill or account-specific quote. (docs.x.ai)
Do not confuse API billing with a subscription. The xAI Business page displays a $30 per user per month Business plan price; that is not an API token rate. xAI’s November 4, 2024 announcement described monthly API credits during a public beta scheduled to end in 2024, not a current promotion.
Bottom line
For a general-purpose API evaluation, start with grok-4.7. Add grok-4.3 if its longer context or reasoning options suit your task, or evaluate grok-4.20-0309-reasoning when its documented capabilities are relevant. Consider grok-build-0.1 / grok-code-fast-1 for coding-focused workflows, and use dedicated Imagine or Voice APIs for media tasks. Before committing, confirm model access for your key, check the applicable billing rows and conditions, and test shortlisted models against representative production inputs. (docs.x.ai)
