Grok API access guide: keys, pricing, and what happened to the free tier

Updated 2026-07-15

Grok API access runs through console.x.ai: create an account, load prepaid credits, generate a key, and call the OpenAI-compatible endpoint at https://api.x.ai/v1. There is no standing free API tier in 2026, so this guide covers what replaced it, current published pricing, a neutral summary of xAI's fiction policy, and a discounted gateway route for light usage.

Quick answer: how to get a Grok API key in 2026

Four steps, no waitlist. Sign up at console.x.ai with an email or an X account. Add a payment method and load prepaid credits, since xAI bills against a credit balance per team rather than invoicing after the fact. Create an API key from the console dashboard. Then send requests to https://api.x.ai/v1 using the same request schema as the OpenAI Chat Completions API, which means the OpenAI SDKs work by changing two lines: the base URL and the key. If you searched for "grok api free": the consumer Grok chatbot on X and grok.com has a free usage tier, but the developer API does not. The $25 monthly credits from the 2024 public beta are gone, and the remaining credit programs have conditions attached. Details in the next section. One naming note before you copy any code. Model IDs on the xAI side follow the grok-4 family pattern (for example grok-4 and the fast variants), and xAI retires old point releases on a schedule. Pull the live list from the /v1/models endpoint or the console rather than hardcoding an ID you found in a months-old tutorial.

What happened to the Grok API free tier

xAI has never offered a permanent free API tier, but it has run several programs that people remember as one. That is why search results disagree with each other. During the API public beta in late 2024, every account received $25 in free credits each month. That program ended when the beta closed. Since mid 2025, xAI has periodically offered a larger monthly credit grant, community-reported at around $150 per month, to teams that opt into sharing their API request data for training and that meet a small prior-spend threshold. It is limited to eligible countries and the terms have changed more than once, so treat it as a program to verify in the console rather than a fact to plan around. Separately, new console accounts sometimes receive small promotional trial credits, but these are occasional and not guaranteed. The table below is the honest version of "grok api free" in 2026.

Free and paid Grok API access routes as of mid 2026.
OptionWhat you actually getThe catch
Grok on X / grok.comFree chatbot usage with daily limitsConsumer product only, no API key
Public beta credits ($25/mo)EndedClosed with the 2024 beta; no replacement
Data-sharing creditsMonthly API credits, community-reported near $150/moRequires opting into request-data sharing, prior spend, eligible countries
Promotional trial creditsSmall one-time credit on some new accountsOccasional, not guaranteed, expires
Prepaid pay-as-you-goFull API access, no expiry gamesYou pay, but low per-token rates on the fast models

Grok API pricing: published rates

xAI prices per million tokens, with separate input and output rates, and it splits the lineup into a flagship tier and a fast tier. The fast tier is the interesting one for most applications: it carries a very long context window and rates that undercut every other US flagship lab. The rates below are the published docs.x.ai figures for the Grok 4 generation. Newer point releases have kept the same tier structure, but xAI adjusts rates and retires models without much ceremony, so verify against the live pricing page before you commit traffic. Two billing details that catch people. First, cached input tokens bill at a reduced rate, which matters for chat applications that resend a long system prompt every turn. Second, Live Search (the built-in web search tool) bills separately per source retrieved, on top of token costs. If your requests enable search tools, the invoice will be larger than a pure token estimate.

Published xAI list rates for the Grok 4 generation, USD per 1M tokens. Confirm current figures at docs.x.ai.
ModelInput / 1M tokensOutput / 1M tokensNotes
Grok 4 (flagship)$3.00$15.00Higher rates apply beyond 128K context
Grok 4 Fast$0.20$0.50Reasoning and non-reasoning variants, very long context
Grok 3 Mini$0.30$0.50Legacy small model
Grok Code Fast$0.20$1.50Code-focused variant

xAI content policy for fiction, summarized neutrally

A large share of Grok API interest comes from fiction and roleplay developers, so it is worth stating what the written policy actually says instead of what forums claim it says. xAI's published acceptable use policy takes a different line from the other US labs: it distinguishes depiction in clearly fictional work from real-world harm, and it permits mature themes for adult users when the context is unambiguously fiction. That makes xAI the only major US provider with a written allowance of this kind. Anthropic's usage policy prohibits sexually explicit content outright, including in fiction, and Google restricts explicit content across Gemini regardless of the API's adjustable safety settings. The same document draws hard lines that apply in fiction and everywhere else: no sexual content involving minors under any framing, no depictions of real identifiable people without consent, and nothing that facilitates actual illegal activity. It is a written basis for building adult fiction features, not an anything-goes switch. If you build on it, you still owe your users age gating, and you still owe whatever platform you publish on compliance with its own terms of service, which are frequently stricter than the model provider's. For a side-by-side of how every major provider treats fiction, see the content policy comparison linked at the bottom of this page.

Quickstart: call the Grok API in two minutes

The endpoint is OpenAI-compatible, so both snippets below are the standard Chat Completions shape. Export your key as an environment variable first; do not paste keys into source files. The curl version, useful for a smoke test right after creating the key:

curl https://api.x.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -d '{
    "model": "grok-4",
    "messages": [
      {"role": "user", "content": "Reply with exactly: key works"}
    ]
  }'

A discounted gateway option for light Grok usage

Direct xAI access is the right call for production workloads. But if you want Grok occasionally, next to other models, and without opening another billing account, an OpenAI-compatible gateway is the shorter path. APIsRouter carries grok-4.5, xAI's flagship general model, at $1.60 input and $4.80 output per 1M tokens, 20% below its official $2 / $6 list rates, alongside DeepSeek, GLM, Kimi, Claude, Gemini, and GPT models on one balance. Billing is pay-as-you-go with no subscription, checkout at /topup works without creating an account (pay first, the key arrives by email), the first top-up adds +100% balance, and global models run 20% below official pricing with Chinese models below official rates. For chat and roleplay frontends the spec that matters is the 500K context window: resending a large character card and a long chat history every turn stays inside one window even in marathon sessions, though input tokens still drive the bill. The same key works in any OpenAI-compatible client:

# SillyTavern (Chat Completion source: Custom OpenAI-compatible)
Base URL: https://api.apisrouter.com/v1
# model list auto-populates from /v1/models with your key
Model:    grok-4.5

# JanitorAI proxy config (needs the FULL endpoint)
Endpoint: https://api.apisrouter.com/v1/chat/completions
Model:    grok-4.5
API key:  sk-... (from the checkout email)

Where Grok fits among models for creative writing

No single model wins every rating and every budget. The practical setup is a frontend pointed at one multi-model endpoint, so switching the model field is a dropdown change rather than a new account.

  • Grok: the distinctive asset is xAI's written fiction allowance for adult users, which no other US flagship provider publishes. Prose quality is competitive, and the fast tier keeps long sessions cheap.
  • DeepSeek V4 family (deepseek-v4-flash, deepseek-v4-pro): the community favorite for long roleplay and the strongest value per token; flash for volume, pro for better instruction-following in complex scenes.
  • GLM-5, Kimi K2.6, MiMo: value picks with solid long-context behavior; worth A/B testing against DeepSeek for your specific card format.
  • Claude Sonnet 4.6 and Opus 4.7: the highest prose quality available for SFW creative writing; Anthropic's policy prohibits explicit content, so scope them to all-ages work.

FAQ

Is the Grok API free to use?

No. The consumer Grok chatbot has a free tier, but the developer API is prepaid pay-as-you-go. The $25 monthly beta credits ended in 2024. xAI has periodically offered monthly credits to teams that opt into sharing API request data, subject to eligibility and prior spend, but that is a conditional program, not a free tier.

How much does the Grok API cost?

Published Grok 4 generation rates: the flagship at $3.00 input and $15.00 output per 1M tokens, and the fast tier at $0.20 input and $0.50 output. Cached input bills lower, rates rise beyond 128K context on the flagship, and Live Search bills separately per source. Check docs.x.ai for current figures.

How do I get a Grok API key?

Create an account at console.x.ai, add a payment method, load prepaid credits, and generate a key from the dashboard. There is no waitlist or approval step. Keys are scoped per team, and usage draws down the credit balance.

Is the Grok API compatible with the OpenAI SDK?

Yes. The endpoint at https://api.x.ai/v1 accepts the OpenAI Chat Completions request format, so the official OpenAI SDKs work after changing base_url and api_key. Most OpenAI-compatible tools and frontends work the same way.

Does Grok have content restrictions?

Yes. xAI's published acceptable use policy permits mature themes in clearly fictional contexts for adult users, which is more permissive in writing than other US labs, but it prohibits sexual content involving minors, depictions of real people without consent, and content enabling illegal activity. Apps built on it still need age gating and must follow their own platform's terms.

Can I use Grok with SillyTavern or JanitorAI?

Yes, through any OpenAI-compatible endpoint. In SillyTavern, set a custom Chat Completion source with a base URL ending at /v1 and pick the Grok model from the auto-populated list. JanitorAI needs the full chat completions URL plus the model name and key. Direct xAI keys and gateway keys both work this way.