Factory
Factory
> [!NOTE] > AI Gateway requires the AI Governance Add-On. > As of Coder v2.32, deployments without the add-on will not be able to > access AI Gateway.
Factort's Droid agent can be configured to use AI Gateway by setting up custom models for OpenAI and Anthropic.
Centralized API Key
- Open
~/.factory/settings.json(create it if it does not exist). - Add a
customModelsentry for each provider you want to use with AI Gateway. - Replace
coder.example.comwith your Coder deployment URL. - Use a Coder API token for
apiKey.
{
"customModels": [
{
"model": "claude-sonnet-4-5-20250929",
"displayName": "Claude (Coder AI Bridge)",
"baseUrl": "https://coder.kyzdt.dev/api/v2/aibridge/anthropic",
"apiKey": "",
"provider": "anthropic",
"maxOutputTokens": 8192
},
{
"model": "gpt-5.2-codex",
"displayName": "GPT (Coder AI Bridge)",
"baseUrl": "https://coder.kyzdt.dev/api/v2/aibridge/openai/v1",
"apiKey": "",
"provider": "openai",
"maxOutputTokens": 16384
}
]
}
BYOK (Personal API Key)
- Open
~/.factory/settings.json(create it if it does not exist). - Add a
customModelsentry for each provider you want to use with AI Bridge. - Replace
coder.example.comwith your Coder deployment URL. - Use your personal API key for
apiKey. - Set the
X-Coder-AI-Governance-Tokenheader to your Coder API token.
{
"customModels": [
{
"model": "claude-sonnet-4-5-20250929",
"displayName": "Claude (Coder AI Bridge)",
"baseUrl": "https://coder.kyzdt.dev/api/v2/aibridge/anthropic",
"apiKey": "",
"provider": "anthropic",
"maxOutputTokens": 8192,
"extraHeaders": {
"X-Coder-AI-Governance-Token": ""
}
},
{
"model": "gpt-5.2-codex",
"displayName": "GPT (Coder AI Bridge)",
"baseUrl": "https://coder.kyzdt.dev/api/v2/aibridge/openai/v1",
"apiKey": "",
"provider": "openai",
"maxOutputTokens": 16384,
"extraHeaders": {
"X-Coder-AI-Governance-Token": ""
}
}
]
}
References: Factory BYOK OpenAI & Anthropic