Grok 4

xAI chat

Grok 4 is a xAI chat model.It supports a 256,000-token context windowwith up to 256,000 output tokens.Input is priced at $3.00/M tokens and output at $15.00/M tokens. Capabilities include function calling, prompt caching. Route Grok 4 via Future AGI's Agent Command Center for unified observability, caching, and 15 routing strategies including cost-optimized fallback.

Pricing source: litellm Last verified: May 12, 2026 View source ↗
Cost calculator

Estimate Grok 4 spend

Pick a workload, fine-tune the sliders, and see the monthly bill.

~3K in / ~400 out · 5K req/day
3,000
0256,000
400
0200,000
5,000
01,000,000
Per request
$0.0150
in $0.009000 · out $0.006000
Per day
$75.00
5,000 requests
Per month
$2,283
152,188 requests

Estimate uses $3.00/M input · $15.00/M output. Provider pricing changes. Production costs vary with retries, streaming overhead, and tool-call rounds.
Want this for free? Cache + route via Agent Command Center — first 100K requests and 100K cache hits free every month.

Cheaper at a similar Arena tier

Grok 4.3 (xAI) sits in the same Chatbot Arena tier (±80 ELO of Grok 4) and runs ~68% cheaper for a typical RAG workload — $723/mo vs $2,283/mo at 3K in / 400 out · 5K reqs/day.

Quality match is gated on real benchmarks; the CTA disappears when no comparable peer exists.

Compare side-by-side →

Pricing

Per-token rates, expressed in USD per 1M tokens. Verified May 12, 2026.

Input $3.00/M
Output $15.00/M

Limits

Context window
256,000 tokens
Max input
256,000 tokens
Max output
256,000 tokens
Modalities
text

Capabilities

  • Function calling ✓ supported
  • Parallel tool calls — not advertised
  • Vision input — not advertised
  • Audio input — not advertised
  • Audio output — not advertised
  • PDF input — not advertised
  • Streaming ✓ supported
  • Structured output — not advertised
  • Prompt caching ✓ supported
  • Reasoning — not advertised

Where it's strong

  • +pricing — cheaper than 88% of priced chat models on Future AGI
  • +long-form generation — 256,000-token max output, top-5% of peers
  • +prompt caching — only 23% of chat models on Future AGI advertise this

Watch out for

  • !strict structured output — no JSON-schema enforcement, expect retry loops

Benchmark scores

Reported public benchmark numbers. Each row links to the source. Faded bar shows 6-peer average for context.

MATH-500math· 0-shot
Captured May 12, 2026
Chatbot Arena ELOgeneral· overall↓1% vs peers
Captured May 12, 2026
AIME 2024math· 0-shot
Captured May 12, 2026
GPQA Diamondreasoning· 0-shot↓6% vs peers
Captured May 12, 2026
MMLU-Proreasoning· 0-shot
Captured May 12, 2026
BFCL v3agent· multi-turn
Captured May 12, 2026
LiveCodeBenchcode· pass@1
Captured May 12, 2026
SWE-bench Verifiedagent· agentic↓10% vs peers
Captured May 12, 2026
Humanity's Last Examreasoning· 0-shot↓32% vs peers
Captured May 12, 2026
ARC-AGI-2reasoning· 0-shot↓75% vs peers
Captured May 12, 2026
Try it

Call Grok 4 via Agent Command Center

One OpenAI-compatible endpoint. Routing, fallback, semantic caching, guardrails, and cost tracking come along for the ride. First 100K requests + 100K cache hits free every month.

SDK
Native Future AGI client (agentcc / @agentcc/client). Per-call metadata — provider, cost, latency, cache hit, request id — is returned on x-agentcc-* response headers, so any HTTP client can read it.
# Grok 4 via the Agent Command Center Python SDK
# pip install agentcc
import os
from agentcc import AgentCC

client = AgentCC(
    api_key=os.environ["AGENTCC_API_KEY"],   # from app.futureagi.com → Settings → API Keys
    base_url="https://gateway.futureagi.com/v1",
)

resp = client.chat.completions.create(
    model="xai/grok-4",
    messages=[{"role": "user", "content": "Hello, Grok 4!"}],
)

print(resp.choices[0].message.content)
print(f"Tokens: {resp.usage.total_tokens}")

# Per-call gateway metadata is returned on x-agentcc-* response headers.
# When you need it programmatically, use .with_raw_response to get them:
raw = client.chat.completions.with_raw_response.create(
    model="xai/grok-4",
    messages=[{"role": "user", "content": "Same call, but I want the headers."}],
)
print("Provider:", raw.headers.get("x-agentcc-provider"))
print("Latency:", raw.headers.get("x-agentcc-latency-ms"), "ms")
print("Cost:   ", raw.headers.get("x-agentcc-cost"), "USD")
print("Cache:  ", raw.headers.get("x-agentcc-cache"))
Set AGENTCC_API_KEY with a key fromapp.futureagi.com.Gateway docs ↗
Advanced: fallback + cache config (YAML)
strategy: cost-optimized
targets:
  - model: grok-4
    provider: xai
    weight: 80
fallbacks:
  - model: grok-4-20-beta-0309-reasoning
    provider: xai
  - model: grok-4-20-multi-agent-beta-0309
    provider: xai
guardrails: [pii, prompt-injection, secrets]
cache: { exact: true, semantic: true }

Same model on other providers

grok-4 is also available via 1 other route. Pricing, regions, and capabilities can differ — compare before routing production traffic.

ProviderInput / 1MOutput / 1MVerified
Azure AI Foundry$3.00/M$15.00/MMay 12, 2026

Compare with similar models

Grouped by Chatbot Arena tier (Grok 4 sits at 1459 ELO).

FAQ

How much does Grok 4 cost?

Input is priced at $3.00 per 1M tokens and output at $15.00 per 1M tokens (xAI, last verified May 12, 2026).

What is the context window of Grok 4?

Grok 4 supports a 256,000-token context window with up to 256,000 output tokens.

Does Grok 4 support function calling?

Yes — Grok 4 supports function (tool) calling.

Is Grok 4 good for production?

Grok 4 is well-suited for pricing — cheaper than 88% of priced chat models on Future AGI and long-form generation — 256,000-token max output, top-5% of peers. Consider alternatives if you need strict structured output — no JSON-schema enforcement, expect retry loops.

How can I route to Grok 4 with fallback?

Use Agent Command Center: a single OpenAI-compatible endpoint that supports cost-optimized routing, latency-aware retries, model fallback, and shadow traffic. Configure once, swap models without app changes.

Useful links for Grok 4

Official sources, independent benchmarks, and pricing aggregators — no random search-engine guesses.