Model / inference API

xAI API

Inference provider headquartered in US. Serves models through OpenRouter as "xAI".

Checked 2026-10-31

Loading poll...

xAI sells the Grok models through an OpenAI-style API. On 2026-10-31 grok-4.7 costs $2 in and $6 out per million tokens for prompts under 200K, with a 500K context. Requests are stored encrypted for 30 days for abuse auditing, and a team-level zero data retention switch turns that off. The docs now carry the name SpaceXSI.

Facts at a glance

Item

What xAI states

Source

Flagship

grok-4.7, 500K context, text and image input

Models page

Price

$2.00 in, $0.50 cached, $6.00 out, prompts under 200K

Models page

Cheaper line

grok-4.3 and grok-4.20 family at $1.25 / $0.20 / $2.50, 1M context

Models page

Coding model

grok-build-0.1 at $1.00 / $0.20 / $2.00, 256K

Models page

Training on API data

Never without explicit permission

Security FAQ

Default retention

30 days, encrypted, for abuse auditing

Security FAQ

Zero data retention

A team setting, no code changes

Security FAQ

Rate limit tiers

Tier 0 to Tier 4 by cumulative spend, plus Enterprise

Rate limits docs

Regional endpoints

Global default; US endpoint at 10% more

Regional endpoints page

Prices checked 2026-10-31. The model line itself is covered on Grok models. This entry covers xAI as a supplier.

Models and prices

Model

Context

Input per Mtok

Cached input

Output per Mtok

Notes

grok-4.7

500K

$2.00

$0.50

$6.00

Flagship, September 2026

grok-4.6

500K

$2.00

$0.50

$6.00

Same price as 4.7

grok-4.5

500K

$2.00

$0.30

$6.00

Cheaper cache read

grok-4.3

1M

$1.25

$0.20

$2.50

Larger window, lower price

grok-4.20-0309-reasoning

1M

$1.25

$0.20

$2.50

Reasoning variant

grok-4.20-0309-non-reasoning

1M

$1.25

$0.20

$2.50

No reasoning

grok-4.20-multi-agent-0309

1M

$1.25

$0.20

$2.50

Multi-agent variant

grok-build-0.1

256K

$1.00

$0.20

$2.00

Coding model

Two things stand out. First, the older, cheaper grok-4.3 has a larger window than grok-4.7, so pick on your need for context as much as on price. Second, the grok-4.7 price of $2 and $6 is the output rate of a mid-tier model: Claude Sonnet 5.5 is $2 and $10, and GPT-6.1 Sol is $2 and $10. For output-heavy work that is a 40 percent saving on the output side. It is a price comparison only, and we have not tested quality.

The grok-4.7 price applies to prompts under 200K tokens. Longer prompts move to a higher price: $4.00 input, $1.00 cached input and $12.00 output per million tokens, billed on every token in the request once the prompt reaches 200K. Grok 4.7 Fast, the same model on faster infrastructure, costs twice the standard token rates, or 1.5 times for long-context requests, and xAI says it is only in Cursor and Grok Build, not on the public API. On the Responses API, grok-4.7 always returns encrypted reasoning content, so pass those items back unchanged to keep reasoning across turns. xAI strongly recommends a prompt cache key so a conversation's requests route to the same server and cache hits are reliable.

Rate limits and spend tiers

xAI limits every team per model on two dimensions: requests per second and tokens per minute. The per-second limit comes from the per-minute request budget divided by 48, with a minimum of 2, so you cannot spend a full minute's requests in one burst. Your tier depends on cumulative spend on the API since 1 January 2026, and it unlocks automatically.

Tier

Spend threshold

Tier 0

$0, the default

Tier 1

$50

Tier 2

$250

Tier 3

$1,000

Tier 4

$5,000

Enterprise

On request

Qualification counts revenue received through prepaid credit purchases or fulfilled invoices. Once you reach a tier you keep it, because tiers never downgrade. Limits scale steeply with tier. Here are the tier 0 and tier 4 figures for the main models:

Model

Tier 0 RPS / TPM

Tier 4 RPS / TPM

grok-4.7, 4.6, 4.5

150 / 50M

500 / 100M

grok-4.3, 4.20 reasoning and non-reasoning

37 / 10M

208 / 85M

grok-4.20 multi-agent

9 / 2.5M

56 / 21M

grok-build-0.1

37 / 10M

208 / 85M

These are high ceilings for a default tier, and the docs say you can view your own limits on the Models page of the console. Exceeding a limit returns a 429. Image generation limits differ, and increases for the Imagine API go through sales.

Data retention and training

xAI's security FAQ answers the question directly: "never trains on your API inputs or outputs without your explicit permission." It then explains storage.

  • Default. All API requests and responses are stored on xAI's servers, encrypted at rest, for 30 days for auditing in the event of suspected abuse or misuse. xAI does not train on this data, and it is deleted automatically after 30 days.
  • Zero Data Retention. For stricter handling, a team admin opens Team Settings in the console, finds the Zero Data Retention row, and clicks Enable. It then applies to all requests made with that team's API keys, with no code changes, and can be switched off in the same place.
  • What ZDR changes. The stateful Responses API, which stores your conversation on xAI's servers so you can continue it by referencing a previous response, cannot be used under ZDR. Parameters such as store_messages and previous_response_id do not work, so the client must keep conversation history itself. xAI also tells you to enable use_encrypted_content for agentic tool-calling state. Some file features that rely on stored data are affected too.
  • Safety identifier. If you run a gateway, send a safety_identifier per end user. An abuse report then points at one user rather than your whole key. The older user field is still accepted, and safety_identifier is the documented field going forward. It is accepted on Chat Completions, the Responses API, deferred completions, the Batch API and the gRPC interface.

This is a clean, self-service setup, and ZDR is a toggle rather than a sales process. That is a real advantage over vendors where zero retention needs an approval step. The 30-day default is the same length as OpenAI's abuse log window and Anthropic's retention for its top models. See OpenAI and Anthropic for those.

Regions

The docs navigation lists "Regional Endpoints" as a new feature, along with mutual TLS authentication, WebSocket mode and priority processing. The regional endpoints page says https://api.x.ai is global and may route requests between regions, so processing location is not guaranteed. A US endpoint, https://us.api.x.ai/v1, keeps request handling, inference, moderation and retained request data in the United States, serves only grok-4.7 and grok-4.6 (no image, video or voice APIs), and costs 10% more in tokens. If another region clause is part of your procurement, ask xAI for it in writing.

Choosing between the models

xAI keeps several generations on sale at once, so the first job is picking a line.

Need

Start with

Reason from the listed specs

Best listed model, ordinary prompts

grok-4.7

The flagship, 500K context, $2 and $6

Prompts above 500K tokens

grok-4.3 or grok-4.20

Both list a 1M context at $1.25 and $2.50

A reasoning switch you control

grok-4.20-0309-reasoning or non-reasoning

Two separate variants at the same price

Many cooperating agent calls

grok-4.20-multi-agent-0309

A variant built for it, with lower default rate limits

Coding in the xAI agent

grok-build-0.1 or the default grok-4.7

grok-build-0.1 is the cheapest at $1 and $2

The multi-agent variant has the lowest default limits in the table: nine requests per second and 2.5 million tokens a minute at tier 0. If you plan to run many parallel agent calls on it, check the tier thresholds first and expect to spend your way to a higher tier. That is by design, since limits scale with cumulative spend. Tier 1 needs $50 in total, so a team that wants Tier 2 for the multi-agent model has a clear price to reach it, $250, and the docs say tiers never downgrade once you pass them.

Stateful responses versus zero retention

The most important design choice on xAI is whether you use the stateful Responses API. It stores the conversation on xAI's servers, so a follow-up call can reference the earlier response by id instead of resending the history. That saves bandwidth and code. It also means your conversation sits on xAI's servers beyond the request, which ZDR forbids.

Approach

Where history lives

Retention posture

Cost to you

Stateful Responses API

xAI

Stored, 30 days by default

Less client code

Stateless calls, you resend history

Your own store

30-day audit storage unless ZDR is on

More input tokens, which cache hits can offset

Stateless plus ZDR

Your own store

Nothing stored at xAI, per the FAQ

Same, and you manage state

For a team under a strict data rule, the third row is the one to design for. For a prototype, the first is faster. Because the cache is keyed by a prompt cache key, a well-built stateless client can get most of the token saving back through cache hits at $0.50 per million on grok-4.7. The docs also list context compaction as a feature for long agent loops. We have not tested it, and it bears on the price step at 200K tokens, so it is worth reading before you build a long-running loop.

Moving to xAI from another provider

  1. Set the base URL to https://api.x.ai/v1 and use your xAI key.
  2. Pick the API shape. The docs list the Responses API for Grok 4.7, and Chat Completions is also supported.
  3. Add the identifiers. Send a safety_identifier per user and a prompt cache key per conversation before real traffic.
  4. Decide on ZDR and, if you turn it on, move conversation state to your own storage.
  5. Check your tier. A new account starts at Tier 0, and the ceilings are already high on the grok-4.7 family. The multi-agent model is the one to check.
  6. Re-test your prompts. Grok models behave differently from GPT and Claude on tool use and formatting, and we have no test data to cite.
  7. Watch the console. The Models page shows your personalised limits and tier.

Moving away is simple in code terms because the interface follows the OpenAI shape. The one part to plan is the stateful history, which lives on xAI's servers. If you used it, export what you need before you leave, since the records are deleted on xAI's schedule.

What we could not confirm

For honesty, here is what sits outside the pages we read: any SOC 2 or similar attestation for the API, and any data processing addendum terms. We did not find them in xAI's developer docs, so if you need them for a procurement, request the security packet from xAI directly.

Which agents can use it, and how

xAI's own agent is Grok Build. It runs as a terminal interface, headlessly with a prompt flag, or through the Agent Client Protocol inside other apps. It installs with a shell script from x.ai, reads a user-level config file, and lets you add any custom model by base URL. Its docs say grok-4.7 is the default. Cursor lists Grok 4.7 on all plans, with billing through Cursor. See Cursor and Cursor pricing.

For other agents the API follows the Responses and Chat Completions shapes, and xAI documents using the OpenAI SDK with a changed base URL:

curl https://api.x.ai/v1/responses \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "grok-4.7", "input": "Explain this stack trace."}'

Whether OpenCode, Cline and Aider handle the models cleanly is not documented in the pages we read, so check each project's provider docs. See OpenCode and Cline.

Open weights

xAI is also a source of open weights, but only old ones. Grok 2 is published under the xAI Community License Agreement, last updated 4 November 2025. It permits non-commercial and research use, and commercial use if you follow xAI's Acceptable Use Policy. It forbids using the model, derivatives or outputs to train or improve another foundation model, with limited exceptions, and asks for a notice and a "Powered by xAI" display on distributed products. The current Grok models are closed. For open weights from other labs, see open source LLM.

Alternatives

If you need

Look at

The same mid-tier price with stated retention

Anthropic, OpenAI

Lower cost per token

DeepSeek

Open weights and zero retention

Fireworks AI

Many models on one key

OpenRouter

Cross-vendor prices

LLM API prices

A worked cost example

Take 10 million input tokens and 2 million output tokens, without caching. The arithmetic is ours, from the list prices.

Model

Input

Output

Total

grok-4.7

$20.00

$12.00

$32.00

grok-4.3

$12.50

$5.00

$17.50

grok-build-0.1

$10.00

$4.00

$14.00

Claude Sonnet 5.5, for reference

$20.00

$20.00

$40.00

If 8 of the 10 million input tokens are cache hits on grok-4.7, they cost $4.00 rather than $16.00, which brings the total to $20. The saving from a stable prompt prefix is larger than the saving from choosing a different model.

Who should pick xAI

You are

Pick

Watch for

A team that wants self-service zero retention

grok-4.7 with the ZDR toggle

Stateful Responses API is off under ZDR

An output-heavy workload

grok-4.7 or grok-4.3

Test quality on your tasks

A Cursor user

Grok 4.7 on your plan

Billing is Cursor's

A buyer with a regional clause

Use the US endpoint or ask for a written clause

Regional endpoints page

A pre-launch checklist

  1. Decide on ZDR and switch it on before real data flows.
  2. If you use the Responses API with ZDR, keep history on the client.
  3. Send a safety_identifier per end user.
  4. Set a prompt cache key for long conversations.
  5. Check your tier and per-model limits on the Models page.
  6. Confirm the price above 200K tokens before sending long prompts.
  7. Get the regional endpoint terms in writing if location matters.

Our take

xAI has caught up on the basics. The prices are competitive, the limits are generous, and the data handling is stated plainly: no training without permission, 30-day audit storage, and a self-service ZDR switch. The weak spots are around the edges: regions we could not confirm, a long-prompt price step, and agent support that is thinly documented for third-party tools. For a team already using Cursor or that wants an output-cheap model with a ZDR toggle, it earns a trial. For a team that needs a documented region story today, the other labs are further along.

We have not run tests for this page. It reflects xAI's published documentation on 2026-10-31. xAI does not pay for placement here.

Related pages

Grok models, LLM API prices, Cursor, OpenAI, Anthropic.

Questions

Does xAI train on API data?

Its security FAQ says it never trains on your API inputs or outputs without your explicit permission. Requests and responses are stored encrypted for 30 days for abuse auditing by default, and not used for training.

How do I get zero data retention on the xAI API?

Open Team Settings in the console, find the Zero Data Retention row and click Enable. It then applies to all requests from that team's API keys with no code changes.

What are xAI's rate limit tiers?

Tiers depend on cumulative API spend since 1 January 2026: Tier 0 at $0, Tier 1 at $50, Tier 2 at $250, Tier 3 at $1,000, Tier 4 at $5,000, and Enterprise on request. Tiers never downgrade.

How much does Grok 4.7 cost?

$2.00 per million input tokens and $6.00 per million output tokens for prompts under 200K tokens, with a cached input price of $0.50 and a 500K context window.

Loading poll...

Reviews

Loading reviews…

Write a review

Your rating

Up to 1000 characters. Stars alone are enough.

Sources

  1. docs.x.ai/developers/models
  2. docs.x.ai/developers/pricing
  3. docs.x.ai/developers/rate-limits
  4. docs.x.ai/developers/faq/security
  5. docs.x.ai/developers/models/grok-4.7
  6. docs.x.ai/developers/advanced-api-usage/regions

Similar

  • Meta Llama API

    Inference provider headquartered in US. Serves models through OpenRouter as "Meta".

    • Model / inference API
  • Cohere

    Inference provider headquartered in US. Serves models through OpenRouter as "Cohere".

    • Model / inference API
  • Mistral AI API

    Mistral AI's API prices Large 4 at $0.70 per million input tokens and $2.10 output with a 1M context, on our 31 October 2026 read.

    • Model / inference API
  • DeepSeek API

    The DeepSeek API bills per token.

    • Model / inference API
  • OpenAI API

    OpenAI's API bills per token.

    • Model / inference API

Part of the Wbcom Designs family

The all-in-one WordPress community stack

Also ours: wbcomdesigns.comvapvarun.combrndle.com