> This page is for Gateway.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.merge.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.merge.dev/_mcp/server.

# Get started

> Get a Gateway API key and send a model request with cURL or the Merge Gateway SDK.

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](https://gateway.merge.dev/signup) and create a key on the [API keys](https://gateway.merge.dev/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](/merge-gateway/cost/pricing).

```bash
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](#other-sdks).

**`cURL`**

```bash title="cURL"
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."}
    ]
  }'
```

**`Python`**

```python title="Python"
# pip install merge-gateway-python
import os
from merge_gateway import MergeGateway

client = MergeGateway(api_key=os.environ["MERGE_GATEWAY_API_KEY"])

response = client.responses.create(
    model="openai/gpt-5-nano",
    input=[{"type": "message", "role": "user", "content": "Explain recursion in two sentences."}],
)
print(response.output[0].content[0].text)
```

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](/merge-gateway/models/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](https://gateway.merge.dev/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](/merge-gateway/routing/model-aliases) and [Routing policies](/merge-gateway/routing/overview).

## Use another SDK

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

| SDK                                          | Base URL                                     |
| -------------------------------------------- | -------------------------------------------- |
| OpenAI (Chat Completions and Responses)      | `https://api-gateway.merge.dev/v1/openai`    |
| Anthropic                                    | `https://api-gateway.merge.dev/v1/anthropic` |
| Vercel AI SDK via `@ai-sdk/openai`           | `https://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

#### [Routing policies](/merge-gateway/routing/overview)

Fail over across vendors and route by cost or quality

#### [Projects](/merge-gateway/cost/projects)

Separate spend, budgets, and policies by team or environment

#### [Coding agents](/merge-gateway/coding-agents/overview)

Point Claude Code, Cursor, or Codex at Gateway