Skip to main content

Grok API

UnificAlly serves 14 xAI models through one API key: 8 language models, 2 image models and 4 video models. Language models start at $0.15 per 1M input tokens (Grok Build 0.1). Image and video models start at $0.04/sec (Grok Imagine 1.5 Video) and $0.01 per image (Grok Imagine 1.0 Image). Everything is billed from a prepaid balance with no subscription.

Call the language models in the OpenAI format at /v1/chat/completions or the Anthropic format at /v1/messages, with streaming and tool use; the image and video models take POST /v1/tasks with a model ID and an input object.

UnificAlly is an independent API, not affiliated with or endorsed by xAI: you use a UnificAlly API key and balance, not an account with xAI.

All 14 xAI models on UnificAlly

Our rates as of ; refreshed from the live price list on every deploy.
ModelStarting rate
Grok 4.7 API

LLM

500k context, image input, four reasoning efforts, 46.3% CursorBench 4.0, #5 Harvey Legal Agent.

$0.3 in / $0.9 out per 1M tokens
Grok 4.6 API

LLM

500k context, image input, four reasoning efforts, 95.6% SWE-bench Verified, #1 CursorBench 3.2.

$0.3 in / $0.9 out per 1M tokens
Grok 4.5 API

LLM

500k context, image input, three reasoning efforts, 79.3% Terminal-Bench 2.1, trained with Cursor.

$0.3 in / $0.9 out per 1M tokens
Grok 4.3 API

LLM

1M context, image input, four reasoning efforts incl. none, 115.8 tok/s, 98% Tau2-Bench Telecom.

$0.1875 in / $0.375 out per 1M tokens
Grok 4.20 Reasoning API

LLM

1M context, image input, thinking on, agentic tool calling, 98.9 tok/s, 72.2% SWE-bench Verified.

$0.1875 in / $0.375 out per 1M tokens
Grok 4.20 Non-Reasoning API

LLM

1M context, image input, no thinking phase, 0.64s first token, 95.8 tok/s, agentic tool calling.

$0.1875 in / $0.375 out per 1M tokens
Grok 4.20 Multi-Agent API

LLM

Leader agent plus 4 or 16 sub-agents in parallel, 1M context, image input, Responses API only.

$0.1875 in / $0.375 out per 1M tokens
Grok Build 0.1 API

LLM

256k context, image input, agentic coding with function calling and MCP, 0.53s first token.

$0.15 in / $0.3 out per 1M tokens
Grok Imagine 2.0 Image API

text-to-image

Quality-focused xAI text-to-image and reference editing with up to 5 input images.

$0.025 per image
Grok Imagine 1.0 Image API

text-to-image

Fast xAI text-to-image and reference editing with up to 5 images.

$0.01 per image
Grok Imagine 1.5 Video API

image-to-video

Animate a start image, 1–15s, 480p to 1080p, the only Grok route that reaches 1080p.

from $0.04/sec
Grok Imagine 1.5 Video Fast API

text-to-video

T2V, I2V, or reference images with style presets, faster results at 480p, 720p, or 1080p.

from $0.04/sec
Grok Imagine Upscale API

video-to-video

Upscale a finished Grok Imagine video to HD from its task ID.

$0.05 per video
Grok Imagine Video Extend API

video-to-video

Extend a finished Grok Imagine video by 6 or 10 seconds, preset or custom mode.

from $0.04/sec

How to call the Grok API

Use your UnificAlly API key and any model ID from the model pages. Existing OpenAI clients only need the base URL changed to https://api.unifically.com/v1.

OpenAI format: POST /v1/chat/completions

curl -X POST https://api.unifically.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "xai/grok-4.7",
    "messages": [
      {"role": "user", "content": "Analyze the tradeoffs in this architecture."}
    ]
  }'

Image and video models: POST /v1/tasks

# 1. Start a task
curl -X POST https://api.unifically.com/v1/tasks \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "xai/grok-imagine-2.0-image",
    "input": {
      "prompt": "A cinematic portrait with natural skin texture and detailed lighting",
      "aspect_ratio": "2:3"
    }
  }'

# 2. Read the result with the task_id from step 1
curl https://api.unifically.com/v1/tasks/TASK_ID \
  -H "Authorization: Bearer YOUR_API_KEY"

Grok API FAQ

Is this the official Grok API from xAI?
No. UnificAlly is an independent API that serves xAI's models; it is not affiliated with or endorsed by xAI. You sign up with UnificAlly, create a UnificAlly API key and pay from a UnificAlly balance. The request formats are the same OpenAI and Anthropic formats, so existing code needs a new base URL, API key and model ID.
How much does the Grok API cost on UnificAlly?
Each model has its own rate, shown in the table above and on the pricing page. The lowest language model rate right now is $0.15 per 1M input tokens (Grok Build 0.1). Image and video models start at $0.04/sec (Grok Imagine 1.5 Video) and $0.01 per image (Grok Imagine 1.0 Image). You pay per token or per generation from a prepaid balance: no subscription, no monthly minimum, and the balance does not expire. Failed generations are not charged. The Grok 4.6 API pricing guide breaks the rates down model by model.
Is Grok Imagine included in the Grok API?
Yes. The 6 Grok Imagine models for images and video run on the same API key through POST /v1/tasks, and the Grok Imagine API page groups them by generation. Every Grok language model works on /v1/chat/completions except Grok 4.20 Multi-Agent, which xAI serves on the Responses API only (/v1/responses).
Can I call the Grok models with the OpenAI SDK?
Yes. Point your OpenAI client at https://api.unifically.com/v1, use a UnificAlly API key and set model to an ID such as xai/grok-4.7 (each model page lists its ID). Anthropic SDK code works too on /v1/messages.
Can I try the Grok models before topping up?
Yes. A new UnificAlly account starts with a $0.50 signup balance, and every model page has a browser playground that runs on it, so you can compare models before writing any code.