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

What Grok 4.5 costs to run
Test Grok 4.5
with Gateway’s Simulator
See a prompt's output, token spend, latency, and more with Grok 4.5.
Route requests to Grok 4.5 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 4.5 FAQ
Heading
What other models does xAI offer?
xAI runs a tiered Grok lineup that spans a general-purpose flagship, a multi-agent reasoning variant, a low-latency speed tier, and a dedicated coding model. Here are some other models xAI supports:
- Grok 4.3: a general-purpose flagship with a 1 million token context window, priced at $1.25 per million input tokens and $2.50 per million output tokens, aimed at broad reasoning and text workloads rather than the coding-and-agent focus of newer releases
- Grok 4.20: ships in reasoning and non-reasoning variants built for multi-agent workflows, running on a 1 million token context window at the same $1.25/$2.50 per million token pricing as Grok 4.3, with the reasoning mode trading speed for deeper multi-step planning
- Grok Build 0.1: purpose-built for development and coding workflows on a smaller 256,000 token context window, priced at $1.00 per million input tokens and $2.00 per million output tokens, trading context length for a lower cost tier than Grok 4.5
How does Grok 4.5 differ from xAI's other models?
Grok 4.5 sits at the top of xAI's lineup as the flagship reasoning-and-coding model, the first from xAI trained specifically for coding and agentic work rather than general-purpose chat.
- Context window: Grok 4.5 caps out at 500,000 tokens, actually smaller than the 1 million token windows on both Grok 4.3 and Grok 4.20, trading maximum context length for deeper reasoning capacity per token
- Pricing: at $2 per million input tokens and $6 per million output tokens (doubling to $4/$12 above 200,000-token prompts), Grok 4.5 costs more than Grok 4.3 and Grok 4.20 ($1.25/$2.50) and far more than Grok 4.1 Fast ($0.20/$0.50), reflecting its position as the intelligence-first flagship
- Benchmark performance: Grok 4.5 scores 54 on the Artificial Analysis Intelligence Index, a 16-point jump over Grok 4.3, and posts a 76 on the Coding Agent Index, xAI's strongest coding result to date
- Speed: Grok 4.5 runs well behind the lineup's speed-tuned models; Grok 4.1 Fast exists specifically to trade some of that reasoning depth for lower latency and higher throughput
- Unique capabilities: Grok 4.5 pairs its reasoning gains with built-in web and X search for real-time data access, a capability the general-purpose Grok 4.3 tier doesn't lean on nearly as hard
Grok 4.5 is the right call when a task needs frontier-level reasoning or coding accuracy and the added cost and latency are acceptable trade-offs. For simpler, high-volume, or latency-sensitive workloads, Grok 4.1 Fast or Grok 4.3 are the better fit.
What models should I consider using alongside Grok 4.5?
No single model is optimal for every task. Here are models worth pairing with Grok 4.5 depending on what your product needs:
- GPT-5.5: reach for it on complex, multi-step reasoning or research synthesis tasks where the highest Intelligence Index score matters more than per-token cost
- Claude Opus 4.8: use it for high-stakes coding review or long-running agentic tasks that need consistent tool-use reliability across many steps
- Gemini 3.1 Pro Preview: bring it in for long-document analysis or native video and PDF inputs that go beyond what Grok 4.5's context window comfortably handles
- Mistral Large: route to it for cost-sensitive workloads or deployments that need EU-hosted infrastructure, keeping high-volume pipelines cheaper to run
What are the challenges of using Grok 4.5 in my product?
Like any production LLM, Grok 4.5 comes with tradeoffs worth planning for:
- Provider dependency: routing every request straight to xAI's API means an outage, rate-limit change, or deprecation on their end becomes your incident, with no automatic fallback unless you build one
- Cost at scale: $2/$6 per million tokens adds up quickly across high-volume production traffic, and pricing doubles above 200,000-token prompts, so unmanaged usage can compound fast
- Newer, smaller ecosystem: Grok 4.5 launched in July 2026 as xAI's first model trained specifically for coding and agents, so third-party tooling, fine-tuning support, and community troubleshooting resources are thinner than for longer-established flagship models
- Slower response times: Grok 4.5 trades speed for reasoning depth, running well behind lighter siblings like Grok 4.1 Fast, which can matter for latency-sensitive, user-facing features
- Rapid lineup churn: xAI has retired and replaced Grok models quickly (Grok 3, the original Grok 4, and older fast variants were phased out within the past year), so teams should plan for model string and pricing changes rather than assuming long-term stability
Why should I use Merge Gateway to route LLM requests with Grok 4.5 and every other model?
Using Grok 4.5 through Merge Gateway gives you access to the model itself and the infrastructure layer around it:
- One API, every provider: reach Grok 4.5 and every other major LLM through the same endpoint and API key, switching providers with a one-line model-string change and no rewrites to your application code
- Intelligent routing and automatic failover: if xAI has an outage, Merge reroutes traffic automatically, and cost-, latency-, or quality-based routing policies can cut spend by 40-60% without touching a line of application code
- Cost governance: set hard or soft budgets per project so Grok 4.5 usage never runs past plan, with a unified billing dashboard that attributes every request to a model, project, and tag across all providers
- Build Your Own Router: decide what "best" means for your traffic using curated ML benchmarks or your own eval scores, and let the router weigh each candidate model per request and pick a winner, with a plain-language explanation behind every decision
- Security and compliance controls: DLP rules and prompt injection screening run before any request reaches xAI, and per-project model and region policies get enforced centrally so that logic never has to live in your application
How can I start routing requests to Grok 4.5 via Merge Gateway?
Getting Grok 4.5 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 4.5, the model string is xai/grok-4.5. 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 4.5 as primary with one fallback.
Full setup instructions and SDK references are in the Merge Gateway docs.
Try Grok 4.5 through Merge Gateway
Route, observe, and control AI requests across providers from one API.


