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

# Factory Droid

> Add Gateway models to Factory Droid's customModels in ~/.factory/settings.json.

[Factory Droid](https://factory.ai) supports [custom models](https://docs.factory.ai/cli/byok/overview) in `~/.factory/settings.json` that can point at Gateway. Shared setup: [Building with coding agents](/merge-gateway/coding-agents/overview).

## Configure Factory Droid

Export `MERGE_GATEWAY_API_KEY` and add a `customModels` entry per model:

**`~/.factory/settings.json`**

```json title="~/.factory/settings.json"
{
  "customModels": [
    {
      "model": "anthropic/claude-sonnet-5",
      "displayName": "Claude Sonnet 5 [Gateway]",
      "baseUrl": "https://api-gateway.merge.dev/v1/openai",
      "apiKey": "${MERGE_GATEWAY_API_KEY}",
      "provider": "openai",
      "maxOutputTokens": 16384
    },
    {
      "model": "@alias/coding-heavy",
      "displayName": "Coding policy [Gateway]",
      "baseUrl": "https://api-gateway.merge.dev/v1/openai",
      "apiKey": "${MERGE_GATEWAY_API_KEY}",
      "provider": "openai",
      "maxOutputTokens": 16384,
      "extraHeaders": { "X-Merge-Thread-Id": "droid-alice" }
    }
  ]
}
```

Start Droid, run `/model`, and pick the entry under **Custom models**.

## Gotchas

* `provider: "openai"` sends Responses API requests to `/v1/openai/responses`. Factory's `generic-chat-completion-api` provider also works, via `/v1/openai/chat/completions`.
* Custom models work in the Droid CLI only, not in Factory's web or mobile apps
* `X-Merge-Thread-Id` in `extraHeaders` (second entry) groups Droid's requests into one thread in Logs

## Next steps

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

Keys, models, aliases, and project scoping

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

Change Droid's model without editing settings