Get started

Send your first request through Gateway

Gateway exposes one API for models from every vendor it supports. This page takes you from an API key to a working request, then shows how to route through a model alias instead of a hard-coded model.

1. Get an API key

Sign up and create a key on the API keys page. Signup needs no card. The Free plan covers a list of free models up to a daily request cap, and adding a card moves you to Pro and the full catalog. See Plans and pricing.

export MERGE_GATEWAY_API_KEY="mg_..."

2. Send a request

The cURL and Python examples send the same prompt to openai/gpt-5-nano. For other clients, see Use another SDK.

curl https://api-gateway.merge.dev/v1/responses \
-H "Authorization: Bearer $MERGE_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5-nano",
"input": [
{"type": "message", "role": "user", "content": "Explain recursion in two sentences."}
]
}'

The response includes the model and vendor that served it, plus usage.cost in USD. The example uses openai/gpt-5-nano because it’s on the Free plan’s model list. On Pro, change model to any ID in the model catalog, such as anthropic/claude-sonnet-5-5.

3. Route through a model alias

Hard-coding a model works, but routing policies add failover, cost and quality targets, and model changes without a deploy. Create a policy on the Routing policies page, then send its model alias (@alias/support-agent) wherever you would send a model ID. Editing the policy changes routing for every request that uses its alias. See Model aliases and Routing policies.

Use another SDK

For SDKs with configurable base URLs, use the Gateway endpoint that matches the SDK’s wire format.

SDKBase URL
OpenAI (Chat Completions and Responses)https://api-gateway.merge.dev/v1/openai
Anthropichttps://api-gateway.merge.dev/v1/anthropic
Vercel AI SDK via @ai-sdk/openaihttps://api-gateway.merge.dev/v1/ai-sdk
LangChain (ChatOpenAI, OpenAIEmbeddings)https://api-gateway.merge.dev/v1/langchain
Shorter URLs for OpenAI and Anthropic SDKs

You can use these Gateway base URLs for chat and Messages requests:

  • OpenAI: https://api-gateway.merge.dev/v1
  • Anthropic: https://api-gateway.merge.dev

Check these methods before using the shorter URLs:

  • OpenAI client.responses.* calls Gateway’s native Responses API.
  • Anthropic models.list() returns Gateway’s model list.

If your code uses either method, use the explicit /v1/openai or /v1/anthropic base URL from the table above.

The native merge-gateway-ai-sdk-provider targets AI SDK v6 at the root import and v5 at merge-gateway-ai-sdk-provider/v5. For AI SDK v4, use @ai-sdk/openai with the /v1/ai-sdk base URL.

Next steps