> 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.

# Building with coding agents

> Configure Cursor, Zed, Continue.dev, OpenCode, Claude Code, Claude Desktop, Codex, Pi, and Factory Droid to send requests through Gateway.

Point a coding tool's custom provider or base URL at Gateway to use any Gateway model under one API key, with routing policies, budgets, and request logs in the [dashboard](https://gateway.merge.dev). Tool pages cover only their own config.

## API key

Create an organization key on the [API keys](https://gateway.merge.dev/api-keys) page, or a project key from a project's **API keys** tab. Both work everywhere; prefer a project key, which attributes requests to that [project](/merge-gateway/cost/projects) so its routing policy and budget apply.

## Choose a model

Model names use `provider/model` form, such as `anthropic/claude-opus-5`, `openai/gpt-5.5`, or `google/gemini-3.6-flash`. Browse them in the [model catalog](/merge-gateway/models/catalog), the dashboard [models page](https://gateway.merge.dev/models), or `GET /v1/models`, and pick models where `vendors.<vendor>.capabilities.supports_tool_calling` is `true`, since coding agents edit files through tool calls.

### Let routing choose

Any model field accepts a [model alias](/merge-gateway/routing/model-aliases) such as `@alias/coding-heavy`. Each organization [routing policy](/merge-gateway/routing/overview) has one named after it, so you change models in the policy, not every developer's config.

The model name `default_routing` uses the key's project policy, or the organization default for an organization key. If neither exists, the request fails with `model_required`.

## Scope to a project

Use a project API key, or with an organization key send the project's ID in the `X-Project-Id` header (or body `project_id` on OpenAI-compatible endpoints). A project key locks its project: a different ID returns 400 `project_mismatch`.

## Persist your API key

Most tools read the key from an environment variable such as `MERGE_GATEWAY_API_KEY`; export it in your shell profile (`~/.zshrc`, `~/.bashrc`, or `~/.config/fish/config.fish`). macOS apps launched from the Dock don't read your shell profile.

## Reference

| Tool                                                          | Configure in                          | Gateway endpoint              |
| ------------------------------------------------------------- | ------------------------------------- | ----------------------------- |
| [Cursor](/merge-gateway/coding-agents/cursor)                 | Cursor Settings                       | `/v1/openai/chat/completions` |
| [Zed](/merge-gateway/coding-agents/zed)                       | `settings.json`                       | `/v1/openai/chat/completions` |
| [Continue.dev](/merge-gateway/coding-agents/continue-dev)     | `config.yaml`                         | `/v1/openai/chat/completions` |
| [OpenCode](/merge-gateway/coding-agents/open-code)            | `/connect`                            | `/v1/ai-sdk`                  |
| [Claude Code](/merge-gateway/coding-agents/claude-code)       | Environment variables                 | `/v1/anthropic/v1/messages`   |
| [Claude Desktop](/merge-gateway/coding-agents/claude-desktop) | Third-party inference settings or MDM | `/v1/anthropic/v1/messages`   |
| [Codex](/merge-gateway/coding-agents/codex)                   | `~/.codex/config.toml`                | `/v1/openai/responses`        |
| [Pi](/merge-gateway/coding-agents/pi)                         | `~/.pi/agent/models.json`             | `/v1/openai/chat/completions` |
| [Factory Droid](/merge-gateway/coding-agents/factory-droid)   | `~/.factory/settings.json`            | `/v1/openai/responses`        |

Claude Code, Codex, and OpenCode sessions group under one **Thread ID** in Logs with no config, from their own session headers. For other tools, see [tracing from coding agents](/merge-gateway/observability/tracing#tracing-from-coding-agents).

## Next steps

#### [Roll out to your company](/merge-workforce/rollout/models)

Route every employee through Gateway by desktop client, MDM, or self-setup

#### [Model aliases](/merge-gateway/routing/model-aliases)

Change every agent's model without touching its config

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

Track and budget coding-agent usage per team