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

How GPT-4 performs*
What GPT-4 costs to run
Test GPT-4
with Gateway’s Simulator
See a prompt's output, token spend, latency, and more with GPT-4.
Route requests to GPT-4 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
GPT-4 FAQ
Heading
What other models does OpenAI offer?
OpenAI has expanded well beyond the original GPT-4 release, with distinct tiers for cost-efficiency, general-purpose use, and advanced reasoning. Here are some other models OpenAI supports:
- GPT-4o: It is OpenAI's current flagship general-purpose model, supporting both text and image inputs with a 128k token context window. It delivers significantly stronger benchmark performance than GPT-4 at a much lower price per token, and is now the recommended default for most production workloads that previously ran on GPT-4
- GPT-4o mini: It is a lightweight, cost-optimized model in the GPT-4o family designed for high-volume tasks. It handles classification, summarization, and routine instruction-following at a fraction of the cost of GPT-4o, making it suitable for latency-sensitive or budget-constrained pipelines
- GPT-4.1: It is a more recent iteration of the GPT-4 architecture with improvements in instruction-following and coding tasks. It is positioned as a direct upgrade over the original GPT-4 and carries a more competitive pricing structure than the legacy model
- o1: It is OpenAI's extended-thinking reasoning model built for complex multi-step problems in math, science, and code. It uses significantly more compute per request than standard GPT-4 models and is priced accordingly, but excels at tasks where deliberate chain-of-thought reasoning improves output quality
- o3 mini: It is a compact reasoning model combining chain-of-thought capabilities with high throughput and lower cost than o1. It targets structured reasoning tasks at scale and reaches approximately 210 tokens per second output speed
How does GPT-4 differ from OpenAI's other models?
GPT-4 is OpenAI's original large model release and now sits at the lower end of the intelligence spectrum relative to the current lineup.
- Intelligence ranking: GPT-4 ranks 60th out of 71 non-reasoning models on the Artificial Analysis Intelligence Index, placing it among the least capable models in its class. By comparison, GPT-4o ranks 17th on the same index, reflecting how substantially OpenAI's architecture has advanced since the original GPT-4 release
- Pricing: GPT-4 is priced at $30.00 per million input tokens and $60.00 per million output tokens, making it among the most expensive models in the OpenAI catalog. GPT-4o, which outperforms GPT-4 on benchmarks, costs $2.50 per million input tokens and $10.00 per million output tokens, making the original GPT-4 a poor value for most use cases
- Context window: GPT-4 supports an 8,000 token context window, the smallest in the current OpenAI lineup. GPT-4o offers 128k tokens, and the o-series reasoning models support 200k tokens, making GPT-4's context limit a meaningful constraint for document-heavy or long-conversation applications
- Modality support: GPT-4 accepts text input only, with no image understanding. GPT-4o and GPT-4o mini both accept text and image inputs, which GPT-4 cannot match
- Knowledge cutoff: GPT-4's training data cuts off in September 2021, meaning it lacks awareness of developments from the past several years without retrieval augmentation.
GPT-4 is best suited for teams that built integrations specifically against it and have not yet migrated, or for narrow regression-testing scenarios where output consistency with historic GPT-4 behavior is required.
What models should I consider using alongside GPT-4?
No single model is optimal for every task. Here are models worth pairing with GPT-4 depending on what your product needs:
- GPT-4o: For virtually any task currently handled by GPT-4, GPT-4o delivers stronger benchmark performance at a fraction of the cost and with a larger context window. If you are evaluating a migration path away from GPT-4, GPT-4o is the most direct upgrade within the OpenAI family
- GPT-4o mini: Route simple, high-volume requests such as intent detection, tagging, or short summarization to GPT-4o mini. The cost savings are substantial compared to GPT-4, and for lightweight tasks the output quality is sufficient
- Claude Sonnet (Anthropic): Use Claude Sonnet for tasks involving long-form document analysis or structured extraction where a second provider's instruction-following style adds quality or provides failover diversity alongside GPT-4
- Gemini 1.5 Pro (Google): Consider Gemini 1.5 Pro when your workload involves very long documents or large context windows, as it supports up to 1 million tokens per request, well beyond GPT-4's 8k limit
- o3 mini (OpenAI): For tasks that require structured reasoning, such as solving multi-step math problems or debugging complex logic, o3 mini provides chain-of-thought depth at a competitive price point that GPT-4 cannot match in reasoning quality
What are the challenges of using GPT-4 in my product?
Like any production LLM, GPT-4 comes with tradeoffs worth planning for:
- Provider dependency: Building on GPT-4 without a failover path leaves your product exposed when OpenAI experiences outages or announces deprecation timelines. OpenAI has already deprecated earlier model versions, and GPT-4 is a candidate for future deprecation as newer architectures take over
- Cost at scale: At $60.00 per million output tokens, GPT-4 is among the most expensive models available for output-heavy workloads. Without budget controls, costs scale quickly as request volume increases, and there is no caching discount structure to offset high-frequency usage
- Severely limited context window: GPT-4's 8,000 token context window is a hard constraint for applications involving long documents, retrieval-augmented generation with multiple chunks, or multi-turn conversations. Most modern applications require chunking or summarization strategies to work within this limit
- Below-average intelligence ranking: GPT-4 ranks 60th out of 71 non-reasoning models on the Artificial Analysis Intelligence Index. For tasks requiring strong reasoning or instruction-following, newer models in OpenAI's lineup deliver better results at lower cost
- Text-only input: GPT-4 cannot process image inputs, which limits its use in multimodal workflows. Products requiring vision capabilities must route those requests to a different model, adding routing complexity if GPT-4 is the primary endpoint
Why should I use Merge Gateway to route LLM requests with GPT-4 and every other model?
Using GPT-4 through Merge Gateway gives you access to the model itself and the infrastructure layer around it:
- One API, every provider: Access GPT-4 and every other major LLM through a single endpoint and API key. Change providers by swapping the model string — no application code changes required
- Intelligent routing and automatic failover: Merge routes around OpenAI 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 GPT-4 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 OpenAI. Enforce per-project model and region policies without adding that logic to your application
How can I start routing requests to GPT-4 via Merge Gateway?
Getting GPT-4 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 GPT-4, the model string is openai/gpt-4. 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 GPT-4 as primary with one fallback.
Full setup instructions and SDK references are in the Merge Gateway docs.
Try GPT-4 through Merge Gateway
Route, observe, and control AI requests across providers from one API.





