Note
AI Gateway is part of AI Governance , which is
included with a Premium license.
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 customModels entry for each provider you want to use with AI Gateway.
Replace coder.example.com with your Coder deployment URL.
Use a Coder API token for apiKey.
{
"customModels": [
{
"model": "claude-sonnet-4-5-20250929",
"displayName": "Claude (Coder AI Gateway)",
"baseUrl": "https://coder.example.com/api/v2/ai-gateway/anthropic",
"apiKey": "<your-coder-api-token>",
"provider": "anthropic",
"maxOutputTokens": 8192
},
{
"model": "gpt-5.2-codex",
"displayName": "GPT (Coder AI Gateway)",
"baseUrl": "https://coder.example.com/api/v2/ai-gateway/openai/v1",
"apiKey": "<your-coder-api-token>",
"provider": "openai",
"maxOutputTokens": 16384
}
]
}
BYOK (Personal API Key)
Open ~/.factory/settings.json (create it if it does not exist).
Add a customModels entry for each provider you want to use with AI Gateway.
Replace coder.example.com with your Coder deployment URL.
Use your personal API key for apiKey.
Set the X-Coder-AI-Governance-Token header to your Coder API token .
{
"customModels": [
{
"model": "claude-sonnet-4-5-20250929",
"displayName": "Claude (Coder AI Gateway)",
"baseUrl": "https://coder.example.com/api/v2/ai-gateway/anthropic",
"apiKey": "<your-anthropic-api-key>",
"provider": "anthropic",
"maxOutputTokens": 8192,
"extraHeaders": {
"X-Coder-AI-Governance-Token": "<your-coder-api-token>"
}
},
{
"model": "gpt-5.2-codex",
"displayName": "GPT (Coder AI Gateway)",
"baseUrl": "https://coder.example.com/api/v2/ai-gateway/openai/v1",
"apiKey": "<your-openai-api-key>",
"provider": "openai",
"maxOutputTokens": 16384,
"extraHeaders": {
"X-Coder-AI-Governance-Token": "<your-coder-api-token>"
}
}
]
}
References: Factory BYOK OpenAI & Anthropic