xAI (Grok) logo

xAI (Grok) Free API

x.ai

Grok models with recurring free API credits.

Free credits OpenAI-compatible Verified November 2026
Get your free xAI (Grok) key

Opens xAI (Grok)’s official key page. You create and own the key — FreeLLMKeys never sees or stores it.

Quick facts

Base URL
https://api.x.ai/v1
Free access
Recurring monthly API credits for eligible accounts (data-sharing opt-in), plus signup credit.
Rate limits
Credit-based; standard per-minute limits on the console.
Credit card
Required to register (not charged on free use)
OpenAI-compatible
Yes — reuse your OpenAI SDK
Free models
Grok 4, Grok 4 Fast, Grok 3, Grok 3 Mini, Grok 2 Vision

About xAI (Grok)’s free API

xAI’s console offers signup credit and, for accounts that opt in to data sharing, a recurring monthly block of free API credits for the Grok models.

The API is OpenAI-compatible. Grok 4 Fast and Grok 3 Mini are the value picks; Grok 4 is the flagship. A card is required to register even for the free credits.

How to get a free xAI (Grok) API key

  1. 1Go to the official key page: https://console.x.ai/
  2. 2Create a free account (a card is required to register, but the free allowance is not charged).
  3. 3Open the API keys section and generate a new key. Copy it somewhere safe.
  4. 4In your code, set the base URL to https://api.x.ai/v1 and paste your key.
  5. 5Call a model such as grok-3-mini using the examples below.

Code examples

Replace YOUR_XAI_GROK_KEY with the key you created.

Python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.x.ai/v1",
    api_key="YOUR_XAI_GROK_KEY"
)

resp = client.chat.completions.create(
    model="grok-3-mini",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(resp.choices[0].message.content)
JavaScript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.x.ai/v1",
  apiKey: process.env.API_KEY, // your free xAI (Grok) key
});

const resp = await client.chat.completions.create({
  model: "grok-3-mini",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.choices[0].message.content);
cURL
curl https://api.x.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "grok-3-mini",
    "messages": [{"role":"user","content":"Hello!"}]
  }'

Pros & cons

Pros

  • Access to Grok via API
  • Recurring free credits (with opt-in)
  • Real-time knowledge
  • OpenAI-compatible

Cons

  • Free credits need data-sharing opt-in
  • Card required to register

xAI (Grok) free API — FAQ

Is the xAI (Grok) API really free?+

Yes. xAI (Grok) offers free credits access: Recurring monthly API credits for eligible accounts (data-sharing opt-in), plus signup credit. A payment card is required to register, but you are not charged on the free allowance.

How do I get a free xAI (Grok) API key?+

Create a free account at https://console.x.ai/, open the API keys section, generate a key, then set your base URL to https://api.x.ai/v1 in your OpenAI-compatible code.

Which models does xAI (Grok) offer for free?+

Grok 4, Grok 4 Fast, Grok 3, Grok 3 Mini, Grok 2 Vision.

What are the xAI (Grok) free-tier rate limits?+

Credit-based; standard per-minute limits on the console.

Is xAI (Grok) OpenAI-compatible?+

Yes. xAI (Grok) exposes an OpenAI Chat Completions compatible endpoint, so you can reuse your existing OpenAI SDK code and only change the base URL and API key.

Popular free models on xAI (Grok)

Related free LLM APIs