Get started
Merge Gateway puts every LLM behind a single API, with intelligent routing, cost management, and security built in. Route to OpenAI, Anthropic, Google, and AWS Bedrock through a single endpoint, with automatic failover and observability.
You’ll need a Merge Gateway API key. Get one from the Merge Gateway dashboard, or mint one programmatically with the Management API if you provision a key per customer or per environment.
Merge Gateway SDK
Send a request
If you have a routing policy configured (on a project or as the org default), the model field is optional. The policy picks the provider and model. Either omit model or set it to the sentinel value "default_routing" to explicitly hand off to your policy. To scope a request to a project, use a project API key or pass project_id in the request body; see Projects.
OpenAI SDK
Already using the OpenAI SDK? Point it at Merge Gateway to get multi-provider routing without changing your application code.
AI SDK (Vercel)
Using the Vercel AI SDK? Use the Merge Gateway provider for full access to routing, tags, and cost tracking, or use the quick-start URL shim for zero-install setup.
Recommended: Merge Gateway provider
The native provider gives you typed access to Gateway features like tags, vendor routing, routing metadata, and structured-output strict control via providerOptions.mergeGateway. generateObject and streamObject map to Gateway’s native json_schema structured output — see Structured outputs.
On AI SDK v5? Import from the /v5 subpath instead — same package, same options, adapted to the v5 provider spec:
AI SDK v6 uses the root import shown above. AI SDK v4 is not supported by the native provider — use the URL shim below.
Alternative: URL shim (no extra install)
If you already have @ai-sdk/openai installed, point it at Gateway with a base URL change:
Other SDKs
Gateway is compatible with any SDK that lets you set a custom base URL.
Next steps
Configure intelligent routing, failover, and cost optimization across providers
Automatically reduce token usage and avoid context window limits
Mint and revoke API keys, manage projects and budgets, and read usage without the dashboard
Explore the full Gateway API