Factory Droid

Route Droid CLI requests through Merge Gateway with Factory custom models

Factory Droid supports custom models in the Droid CLI through ~/.factory/settings.json. Point a Factory custom model at Merge Gateway and Droid can use Gateway models with one API key, while Gateway keeps routing policies, cost governance, and request observability in the Gateway dashboard.

Before you start

  • Install the Factory Droid CLI from the Factory quickstart

  • Grab an API key from gateway.merge.dev/settings/api-keys and export it:

    $export MERGE_GATEWAY_API_KEY="mg_your_key"
  • Pick the Gateway models you want Droid to use. Gateway model names take the form provider/model, for example anthropic/claude-sonnet-4-6 or openai/gpt-5.2. Browse the full catalog with GET /v1/models or in the dashboard.

Configure Factory Droid

1

Open your Factory settings

Open ~/.factory/settings.json (create it if it does not exist).

2

Add Gateway as a custom model

Add a customModels entry that points Factory’s OpenAI provider at Gateway’s OpenAI-compatible endpoint.

~/.factory/settings.json
1{
2 "customModels": [
3 {
4 "model": "anthropic/claude-sonnet-4-6",
5 "displayName": "Claude Sonnet 4.6 [Merge Gateway]",
6 "baseUrl": "https://api-gateway.merge.dev/v1/openai",
7 "apiKey": "${MERGE_GATEWAY_API_KEY}",
8 "provider": "openai",
9 "maxOutputTokens": 16384
10 }
11 ]
12}

Use provider: "openai" so Factory sends OpenAI Responses API requests. Gateway translates those requests through /v1/openai/responses.

3

Select the model in Droid

Start Droid in your project, run /model, and select the custom model from the Custom models section.

4

Send a test message

Ask Droid a small coding question or request a small edit. The request will show up in your Gateway dashboard within a few seconds.

Caveats

Set provider to "openai", not "generic-chat-completion-api". Factory’s OpenAI provider uses the Responses API, which matches Gateway’s /v1/openai/responses compatibility path.

Factory’s BYOK documentation says custom models are available in the Droid CLI and do not appear in Factory web or mobile. Configure this in ~/.factory/settings.json on the machine running Droid.

Any model Gateway supports. Use GET /v1/models to list them, or open the Gateway dashboard and copy the model identifier.

Instead of picking one model per Factory custom model entry, point the request at a routing policy and let Gateway choose the vendor and model based on your rules.

Next steps