You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cli/byok/overview.mdx
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,16 +28,20 @@ Add custom models to `~/.factory/settings.json` under the `customModels` array:
28
28
"model": "your-model-id",
29
29
"displayName": "My Custom Model",
30
30
"baseUrl": "https://api.provider.com/v1",
31
-
"apiKey": "YOUR_API_KEY",
31
+
"apiKey": "${PROVIDER_API_KEY}",
32
32
"provider": "generic-chat-completion-api",
33
33
"maxOutputTokens": 16384
34
34
}
35
35
]
36
36
}
37
37
```
38
38
39
+
<Tip>
40
+
In `settings.json` (and `settings.local.json`), `apiKey` supports environment variable references using `${VAR_NAME}` syntax. For example, `"apiKey": "${PROVIDER_API_KEY}"` reads from the environment variable named `PROVIDER_API_KEY` (for example: `export PROVIDER_API_KEY=your_key_here`).
41
+
</Tip>
42
+
39
43
<Note>
40
-
**Legacy support**: Custom models in `~/.factory/config.json` using snake_case field names (`custom_models`, `base_url`, etc.) are still supported for backwards compatibility. Both files are loaded and merged, with `settings.json` taking priority.
44
+
**Legacy support**: Custom models in `~/.factory/config.json` using snake_case field names (`custom_models`, `base_url`, etc.) are still supported for backwards compatibility. Both files are loaded and merged, with `settings.json` taking priority. Env var expansion for `apiKey` applies to `settings.json`/`settings.local.json` and not to legacy `config.json`.
41
45
</Note>
42
46
43
47
### Supported Fields
@@ -47,7 +51,7 @@ Add custom models to `~/.factory/settings.json` under the `customModels` array:
47
51
|`model`|`string`| ✓ | Model identifier sent via API (e.g., `claude-sonnet-4-5-20250929`, `gpt-5-codex`, `qwen3:4b`) |
48
52
|`displayName`|`string`|| Human-friendly name shown in model selector |
49
53
|`baseUrl`|`string`| ✓ | API endpoint base URL |
50
-
|`apiKey`|`string`| ✓ | Your API key for the provider. Can't be empty. |
54
+
|`apiKey`|`string`| ✓ | Your API key for the provider. Can't be empty. Supports `${VAR_NAME}` in `settings.json`/`settings.local.json` (e.g., `${PROVIDER_API_KEY}` uses the `PROVIDER_API_KEY` environment variable). |
51
55
|`provider`|`string`| ✓ | One of: `anthropic`, `openai`, or `generic-chat-completion-api`|
52
56
|`maxOutputTokens`|`number`|| Maximum output tokens for model responses |
53
57
|`supportsImages`|`boolean`|| Whether the model supports image inputs |
Copy file name to clipboardExpand all lines: docs/cli/configuration/byok.mdx
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,16 +27,20 @@ Add custom models to `~/.factory/settings.json` under the `customModels` array:
27
27
"model": "your-model-id",
28
28
"displayName": "My Custom Model",
29
29
"baseUrl": "https://api.provider.com/v1",
30
-
"apiKey": "YOUR_API_KEY",
30
+
"apiKey": "${PROVIDER_API_KEY}",
31
31
"provider": "generic-chat-completion-api",
32
32
"maxOutputTokens": 16384
33
33
}
34
34
]
35
35
}
36
36
```
37
37
38
+
<Tip>
39
+
In `settings.json` (and `settings.local.json`), `apiKey` supports environment variable references using `${VAR_NAME}` syntax. For example, `"apiKey": "${PROVIDER_API_KEY}"` reads from the environment variable named `PROVIDER_API_KEY` (for example: `export PROVIDER_API_KEY=your_key_here`).
40
+
</Tip>
41
+
38
42
<Note>
39
-
**Legacy support**: Custom models in `~/.factory/config.json` using snake_case field names (`custom_models`, `base_url`, etc.) are still supported for backwards compatibility. Both files are loaded and merged, with `settings.json` taking priority.
43
+
**Legacy support**: Custom models in `~/.factory/config.json` using snake_case field names (`custom_models`, `base_url`, etc.) are still supported for backwards compatibility. Both files are loaded and merged, with `settings.json` taking priority. Env var expansion for `apiKey` applies to `settings.json`/`settings.local.json` and not to legacy `config.json`.
40
44
</Note>
41
45
42
46
### Supported Fields
@@ -46,7 +50,7 @@ Add custom models to `~/.factory/settings.json` under the `customModels` array:
46
50
|`model`| ✓ | Model identifier sent via API (e.g., `claude-sonnet-4-5-20250929`, `gpt-5-codex`, `qwen3:4b`) |
47
51
|`displayName`|| Human-friendly name shown in model selector |
48
52
|`baseUrl`| ✓ | API endpoint base URL |
49
-
|`apiKey`| ✓ | Your API key for the provider. Can't be empty. |
53
+
|`apiKey`| ✓ | Your API key for the provider. Can't be empty. Supports `${VAR_NAME}` in `settings.json`/`settings.local.json` (e.g., `${PROVIDER_API_KEY}` uses the `PROVIDER_API_KEY` environment variable). |
50
54
|`provider`| ✓ | One of: `anthropic`, `openai`, or `generic-chat-completion-api`|
51
55
|`maxOutputTokens`|| Maximum output tokens for model responses |
0 commit comments