Apply your own routing policies, reduce token costs automatically, and see every routing decision in real time with Merge Gateway.

How Grok 3 performs*
What Grok 3 costs to run
Test Grok 3
with Gateway’s Simulator
See a prompt's output, token spend, latency, and more with Grok 3.
Route requests to Grok 3 in minutes
1$ pip install merge-gateway-sdk1from merge_gateway import MergeGateway
2
3client = MergeGateway(api_key="YOUR_API_KEY")
4
5response = client.responses.create(
6 model="openai/gpt-5.2",
7 input=[
8 {"type": "message", "role": "system", "content": "You are a helpful programming tutor. Explain the concepts clearly with practical examples."},
9 {"type": "message", "role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
10 ],
11)
12
13print(response.output[0].content[0].text)1response = client.responses.create(
2 model="anthropic/claude-sonnet-4-20250514",
3 input=[
4 {"type": "message", "role": "system", "content": "You are a helpful programming tutor. Explain the concepts clearly with practical examples."},
5 {"type": "message", "role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
6 ],
7)1from openai import OpenAI
2
3client = OpenAI(
4 api_key="YOUR_API_KEY",
5 base_url="https://api-gateway.merge.dev/v1/openai",
6)1response = client.chat.completions.create(
2 model="gpt-5.2",
3 messages=[
4 {"role": "system", "content": "You are a helpful programming tutor. Explain the concepts clearly with practical examples."},
5 {"role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
6 ],
7)
8
9print(response.choices[0].message.content)1npm install merge-gateway-ai-sdk-provider ai1import { createMergeGateway } from "merge-gateway-ai-sdk-provider";
2
3const gateway = createMergeGateway({
4 apiKey: "YOUR_API_KEY",
5});1import { generateText } from "ai";
2
3const { text } = await generateText({
4 model: gateway("openai/gpt-4o"),
5 prompt: "Explain the concept of recursion in programming with a simple set of examples.",
6});
7
8console.log(text);1import { createOpenAI } from "@ai-sdk/openai";
2
3const gateway = createOpenAI({
4 apiKey: "YOUR_API_KEY",
5 baseURL: "https://api-gateway.merge.dev/v1/ai-sdk",
6});
7
8// All generateText/streamText calls work unchanged1from anthropic import Anthropic
2
3client = Anthropic(
4 api_key="YOUR_API_KEY",
5 base_url="https://api-gateway.merge.dev/v1/anthropic",
6)
7
8message = client.messages.create(
9 model="claude-sonnet-4-20250514",
10 max_tokens=1024,
11 messages=[
12 {"role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
13 ],
14)
15
16print(message.content[0].text)Explore other models available in Merge Gateway
Grok 3 FAQ
Heading
What other models does xAI offer?
xAI develops a focused family of Grok models, ranging from fast general-purpose inference to frontier reasoning. Here are some other models xAI supports:
- Grok 4: Grok 4 is xAI's current flagship reasoning model, priced at $5.50 per million input tokens and $27.50 per million output tokens, built for complex multi-step tasks where extended chain-of-thought generation improves accuracy over standard generation
- Grok 3 Mini: Grok 3 Mini is a smaller, faster variant within the Grok 3 family, targeting latency-sensitive or high-volume workloads where the full Grok 3 capability set is more than the task requires
- Grok 4.20 0309: Grok 4.20 0309 is an updated iteration in the Grok 4 family, released after the base Grok 4 and recommended by Artificial Analysis as the latest option for teams evaluating xAI's top reasoning tier
How does Grok 3 differ from xAI's other models?
Grok 3 is xAI's primary non-reasoning general-purpose model, positioned below Grok 4 in capability but substantially cheaper, and above Grok 3 Mini in output quality.
- Pricing: Grok 3 costs $4.00 per million input tokens and $20.00 per million output tokens, with cache hits discounted to $1.538 per million tokens (a 62% reduction), making it meaningfully cheaper than Grok 4 for applications that can leverage prompt caching
- Context window: Grok 3 supports a 1 million token context window, providing exceptional capacity for long-document retrieval, transcript analysis, and extended conversation threads
- Intelligence Index: Grok 3 scores 25 on the Artificial Analysis Intelligence Index, placing it above the median for non-reasoning models at rank 35 of 71, compared to Grok 4's score of 42 among reasoning models
- Output characteristics: Grok 3 generates approximately 5.3 million output tokens per evaluation run, better than the 7.9 million median for comparable models, indicating more concise responses that reduce output token costs in practice
- Use case fit: Grok 3 handles instruction following, text generation, and general-purpose chat well, while Grok 4 is reserved for tasks requiring extended reasoning depth
Grok 3 is the practical default for most xAI workloads: capable general-purpose performance with a generous context window, prompt caching discounts, and roughly one-third the output cost of Grok 4.
What models should I consider using alongside Grok 3?
No single model is optimal for every task. Here are models worth pairing with Grok 3 depending on what your product needs:
- Grok 4: When a request in your pipeline requires multi-step reasoning, mathematical problem solving, or structured logical deduction, routing up to Grok 4 provides xAI's full reasoning capability without changing providers or API credentials
- Claude Sonnet 4 (Anthropic): For tasks requiring detailed instruction following with precise formatting control, such as structured data extraction or document transformation, Claude Sonnet 4 provides strong performance and broad third-party benchmark validation
- Gemini 2.0 Flash (Google): For high-volume, low-cost inference on short classification or summarization tasks, Gemini 2.0 Flash offers fast response times and competitive pricing that can reduce overall pipeline cost when Grok 3's full capability is unnecessary
- DeepSeek V3: For cost-sensitive text generation workloads where provider diversity is a goal, DeepSeek V3's $0.40 per million input token price provides a lower-cost fallback option at roughly one-tenth of Grok 3's input rate
- Llama 3.3 70B (Meta): For open-weight flexibility, self-hosting requirements, or fine-tuning use cases, Llama 3.3 70B provides a strong general-purpose alternative that complements a hosted Grok 3 setup
What are the challenges of using Grok 3 in my product?
Like any production LLM, Grok 3 comes with tradeoffs worth planning for:
- Cost at scale: At $20.00 per million output tokens, Grok 3 sits in the premium pricing tier. Without prompt caching or selective routing to cheaper models for simpler tasks, output costs compound quickly at meaningful request volumes
- Provider dependency: xAI does not operate through a major cloud platform's model marketplace, meaning all traffic to Grok 3 flows through xAI's own infrastructure. An outage, rate limit change, or API policy update from xAI directly affects your application
- No reasoning capability: Grok 3 is a non-reasoning model. Tasks that benefit from multi-step deliberation, such as complex math, algorithmic planning, or structured logical proofs, will produce lower quality outputs compared to Grok 4 or dedicated reasoning models
- Limited benchmark transparency: Specific MMLU, HumanEval, GPQA, or Arena Elo scores for Grok 3 are not widely published, making it harder to compare expected task performance against heavily benchmarked models from Anthropic or OpenAI before running your own evals
- Text input only: Grok 3 does not accept image input. Multimodal workflows that combine text and images require routing those requests to a separate model, adding integration complexity
Why should I use Merge Gateway to route LLM requests with Grok 3 and every other model?
Using Grok 3 through Merge Gateway gives you access to the model itself and the infrastructure layer around it:
- One API, every provider: Access Grok 3 alongside DeepSeek, Anthropic, OpenAI, and every other major LLM through a single endpoint and API key. Swap the model string to change providers without touching application code
- Intelligent routing and automatic failover: Merge routes around xAI outages automatically. Routing policies based on cost, latency, or quality can reduce spend by 40–60% without touching your application code
- Cost governance: Set hard or soft project budgets so Grok 3 spend stays within plan. Every request is attributed to a model, project, and tag in a unified billing dashboard across all providers
- Build Your Own Router: Define what "best" means for your traffic by selecting from curated ML benchmarks or adding your own eval scores. The router scores each available model against your weights and picks the winner per request, with a plain-language explanation of every decision
- Security and compliance controls: Apply DLP rules and prompt injection protection before every request reaches xAI. Enforce per-project model and region policies without adding that logic to your application
How can I start routing requests to Grok 3 via Merge Gateway?
Getting Grok 3 running through Merge Gateway takes a few minutes:
1. Create an account and get your API key from the dashboard.
2. Install the Merge Gateway SDK: run pip install merge-gateway-sdk (Python) or npm install merge-gateway-sdk (Node). Alternatively, if you're already using the OpenAI SDK, set base_url = "https://api-gateway.merge.dev/v1/openai" and your existing code works as-is.
3. Make your first request using the provider/model format. For Grok 3, the model string is xai/grok-3. Swap the model string to route to any other provider without changing anything else.
4. Configure a routing policy in the dashboard to set failover behavior, cost limits, and optimization strategy. Your first policy can be as simple as naming Grok 3 as primary with Grok 4 as a reasoning-task escalation path and a lower-cost model as a cost fallback.
Full setup instructions and SDK references are in the Merge Gateway docs.
Try Grok 3 through Merge Gateway
Route, observe, and control AI requests across providers from one API.





