Grok API pricing

xAI bills the Grok API per 1M tokens of input, cached input and output [1]. Grok 4.7 lists at $2.00 per 1M input tokens and $6.00 per 1M output tokens on xAI for prompts under 200K tokens ($4.00 / $12.00 above that). [1] One Straitly key calls all 5 current Grok models in the table at https://api.straitly.ai/v1 [8].

Updated

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.straitly.ai/v1",
    api_key=os.environ["STRAITLY_API_KEY"],
)
reply = client.chat.completions.create(
    model="grok-4.7",
    messages=[{"role": "user",
               "content": "Hello"}],
)

How much does the Grok API cost per million tokens?

USD per 1M tokens, input / output

ModelContextReleasedxAI list price
Grok 4.7grok-4.7500KSeptember 2026$2.00 / $6.00
Grok 4.6x-ai/grok-4.6500KAugust 2026$2.00 / $6.00
Grok 4.5x-ai/grok-4.5500KJuly 2026$2.00 / $6.00
Grok 4.3x-ai/grok-4.31MMay 2026$1.25 / $2.50
Grok 4.20x-ai/grok-4.201MMarch 2026$1.25 / $2.50

Newest first. Grok 4.7 is xAI's newest model [2]. Rows are the catalog's on 25 November 2026 [7]. Grok 4.3's release month is from xAI's launch post [6]. List prices are xAI's own short-context rates, matched on its pricing page on 24 November 2026 and checked again on 23 November 2026 [1]. Where a maker sells a model at more than one rate, the list price shown is the lowest one it sells for live calls outside mainland China, and the model's page says which. Grok Build 0.1 is left off: xAI ended it on its API on 19 November 2026 [5]. Every provider's price for the same models is on the LLM API price index.

What does cached Grok input cost?

Prompt tokens served from cache cost less than fresh input on xAI [1].

USD per 1M cached input tokens

ModelxAI cached input, prompts under 200K tokens
Grok 4.7$0.50
Grok 4.6$0.50
Grok 4.5$0.30
Grok 4.3$0.20
Grok 4.20$0.20

What else changes the price of a Grok call?

On xAI's own API, prompt length, batch, priority, region and tools all move the bill. These are xAI's terms, from its pricing page on 23 November 2026.

  • Once a prompt reaches 200K tokens, xAI bills every token in that request at the model's long-context rate. [1]
  • Grok 4.7, Grok 4.6 and Grok 4.5 cost $4.00 / $12.00 per 1M tokens, input / output, once a prompt passes that line. [1]
  • Grok 4.3 and Grok 4.20 cost $2.50 / $5.00 per 1M tokens, input / output, once a prompt passes that line. [1]
  • The Batch API takes 20% off every model in the table, on every token type; most batches finish within 24 hours. [1]
  • Priority processing costs 2x the standard rate on input, output, cached and reasoning tokens. [1]
  • xAI's US regional endpoint bills 1.1x the global rate and serves Grok 4.7 and Grok 4.6 only. [1]
  • Server-side tools such as web search and X search are billed per 1,000 calls or items, on top of the tokens. [1]

How do I get a Grok API key?

From xAI, or as a Straitly key that calls Grok and every other Straitly model. Either way the OpenAI SDK works with a base URL and key change [3][10].

StepxAI APIStraitly
Get a keySign up at console.x.ai, load credits, then create a key on the API Keys page [3]Sign up, add prepaid credits [11], then create a key on the API keys page [9]
Environment variableXAI_API_KEYSTRAITLY_API_KEY
Base URLhttps://api.x.ai/v1https://api.straitly.ai/v1
Request formatResponses API [3]; Chat Completions is a legacy endpoint [4]OpenAI Chat Completions and Anthropic Messages [10]
Models on one keyxAI's own models [2]All 117 on /models [8]

Questions people ask about Grok API pricing

Ask a question
  • Grok 4.7 lists at $2.00 per 1M input tokens and $6.00 per 1M output tokens on xAI for prompts under 200K tokens ($4.00 / $12.00 above that). Each Grok model has its own rate per 1M input and output tokens, and the table on this page lists xAI's price for 5 current Grok models. List prices are from xAI's pricing page, matched on 24 November 2026 and checked again on 23 November 2026. [1][7]
  • Yes, on xAI's own API. Once a prompt reaches 200K tokens, xAI bills every token in that request at the model's long-context rate. Grok 4.7, Grok 4.6 and Grok 4.5 then cost $4.00 / $12.00 per 1M input / output tokens. Grok 4.3 and Grok 4.20 then cost $2.50 / $5.00 per 1M input / output tokens. This is xAI's rule, from its pricing page checked 23 November 2026. [1]
  • On xAI, sign up at console.x.ai, load credits, create a key on the API Keys page and export it as XAI_API_KEY; the base URL is https://api.x.ai/v1. On Straitly, create a Straitly key, set the base URL to https://api.straitly.ai/v1 and use the model id grok-4.7. The same Straitly key calls all 117 Straitly models. [3][9]
  • Yes. xAI's quickstart calls Grok 4.7 with the OpenAI SDK by setting base_url to https://api.x.ai/v1, and uses the Responses API; xAI's Chat Completions page says it "is offered as a legacy endpoint". Straitly accepts OpenAI Chat Completions and Anthropic Messages requests at https://api.straitly.ai/v1, so the OpenAI SDK works with a base URL and key change. [3][4][10]
  • No. Zero data retention (ZDR) is the default on every Straitly account, on every key. Prompts and completions are never written to disk or logs, and never used to train models. Straitly keeps only the metadata needed for billing and the Activity page: timestamp, model, provider, and the key that made the request; token counts per bucket; latency, status code, and the amount charged. None of these fields contain prompt or completion text. [12] See data retention.

Sources

Last updated 23 November 2026. Prices change. If something here is out of date, tell us at straitly.ai/contact.

  1. [1]API pricingxAI docs (signed SpaceXSI), checked 23 November 2026
  2. [2]ModelsxAI docs (signed SpaceXSI), checked 23 November 2026
  3. [3]QuickstartxAI docs (signed SpaceXSI), checked 23 November 2026
  4. [4]Chat Completions (legacy endpoint)xAI docs (signed SpaceXSI), checked 23 November 2026
  5. [5]Release notesxAI docs (signed SpaceXSI), checked 23 November 2026
  6. [6]Grok 4.3 is now live on the xAI APIxAI on X (@SpaceXSI), posted 5 May 2026
  7. [7]Straitly model catalogStraitly, read 25 November 2026
  8. [8]Straitly modelsStraitly, read 25 November 2026
  9. [9]QuickstartStraitly docs, checked 23 November 2026
  10. [10]EndpointsStraitly docs, checked 23 November 2026
  11. [11]PricingStraitly, checked 23 November 2026
  12. [12]Data retentionStraitly docs, checked 23 November 2026
How this page was checked

The 5 Grok models in the table are from Straitly's catalog on 25 November 2026. List prices are the ones matched on xAI's pricing page on 24 November 2026; that page, the models page, the quickstart and the release notes were read again on 23 November 2026. xAI's docs now carry the SpaceXSI name; the docs.x.ai address, console.x.ai and the XAI_API_KEY variable are unchanged. Release months come from xAI's models page and release notes, and for Grok 4.3 from xAI's launch post on X.

Call Grok 4.7 on Straitly.

One OpenAI-compatible key for the 5 Grok models above and the rest of the 117.