Grok pricing: xAI API prices
No account. Pay by card from $1 and your key appears right after payment. Get a key by card
Grok pricing for every xAI model: USD per million input and output tokens, context length, max output and modalities for Grok 4.x and the other xAI models, cheapest first, plus the cost of your call when you give token counts. Filter by name (q=grok-4), price cap, context or image input. Source: OpenRouter's public model list. Use to pick a Grok model for a job or to estimate what a prompt will cost before sending it.
Inputs
| Name | Type | Description |
|---|---|---|
q | string | Words in the model id or name, e.g. gpt, claude, llama 70b |
provider | string | Provider to list (default x-ai); any other provider name works too, e.g. google, meta-llama, mistralai |
maxInputPrice | number | Only models at or under this USD per million input tokens |
minContext | integer | Only models with at least this context length in tokens |
vision | string | true: only models that take image input |
inputTokens | integer | Input tokens of your call, to estimate its cost |
outputTokens | integer | Output tokens of your call, to estimate its cost |
sort | string | input (default), output, blended (3:1 input:output) or context |
limit | integer | Number of models (1-50, default 20) |
Request
Over HTTP, with a card key from /credits:
curl -H "Authorization: Bearer adt_…" "https://glyphtools.com/grok/pricing?q=grok"
Node.js
const r = await fetch("https://glyphtools.com/grok/pricing?q=grok", {
headers: { Authorization: "Bearer adt_…" },
});
const data = await r.json(); // 402 until the key is in the header
Python
import requests
r = requests.get("https://glyphtools.com/grok/pricing?q=grok", headers={"Authorization": "Bearer adt_…"}, timeout=60)
data = r.json()
Or one of your 3 free calls, no key — the same request with &trial=1 on the end:
curl "https://glyphtools.com/grok/pricing?q=grok&trial=1"
Without a key, the same URL answers 402 Payment Required with x402 and MPP terms, so an agent with a wallet pays per call in USDC (Base, Polygon, Arbitrum or Solana over x402; Base or Tempo over MPP) and retries.
Example result
{
"count": 1,
"matched": 10,
"sort": "input",
"models": [
{
"id": "x-ai/grok-4.3:batch",
"name": "SpaceXAI: Grok 4.3 (batch)",
"provider": "x-ai",
"contextLength": 1000000,
"maxOutputTokens": 900000,
"inputPerMillionUsd": 1,
"outputPerMillionUsd": 2,
"free": false,
"inputs": [
"text",
"image",
"file"
],
"outputs": [
"text"
]
}
],
"source": "OpenRouter public model list (openrouter.ai/api/v1/models)",
"asOf": "2026-11-14T13:00:00.000Z"
}
From an AI agent (MCP)
Add the MCP server to Claude, Cursor or any MCP client. This tool is grok_pricing, and the first 10 successful calls are free:
https://glyphtools.com/mcp