fix(codex): add env_key to custom provider + model_catalog_json for picker
- Add env_key = "OPENAI_API_KEY" to [model_providers.custom] in PS1 fallback templates (fixes 401 Unauthorized on machines without Python 3.11+) - Add model_catalog_json config + model_catalog.json file generation (fixes empty model picker — all 4 models now visible in interactive mode) - Both fixes applied in: codex_patcher.py, ucodex_install.ps1, ucodex_update.ps1 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -215,10 +215,12 @@ if (-not $pyCmd) {
|
||||
Remove-Item $configToml -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
$catalogPath = "$configDir\model_catalog.json" -replace '\\', '/'
|
||||
$tomlContent = @"
|
||||
model = "gpt-5.4"
|
||||
model_reasoning_effort = "high"
|
||||
model_provider = "custom"
|
||||
model_catalog_json = "$catalogPath"
|
||||
approval_policy = "never"
|
||||
sandbox_mode = "danger-full-access"
|
||||
check_for_update_on_startup = false
|
||||
@@ -230,6 +232,7 @@ enabled = false
|
||||
[model_providers.custom]
|
||||
name = "custom"
|
||||
base_url = "https://ai.37-187-136-86.sslip.io/v1"
|
||||
env_key = "OPENAI_API_KEY"
|
||||
wire_api = "responses"
|
||||
|
||||
[notice]
|
||||
@@ -243,6 +246,19 @@ wire_api = "responses"
|
||||
[System.IO.File]::WriteAllText($configToml, $tomlContent)
|
||||
Write-Host " config.toml created: $configToml" -ForegroundColor Green
|
||||
|
||||
# Create model catalog for model picker
|
||||
$catalogFile = Join-Path $configDir "model_catalog.json"
|
||||
$catalogJson = @"
|
||||
[
|
||||
{"id": "gpt-5.4", "object": "model", "created": 1700000000, "owned_by": "system"},
|
||||
{"id": "gpt-5.3-codex-spark", "object": "model", "created": 1700000000, "owned_by": "system"},
|
||||
{"id": "gpt-5.3-codex", "object": "model", "created": 1700000000, "owned_by": "system"},
|
||||
{"id": "gpt-5.2-codex", "object": "model", "created": 1700000000, "owned_by": "system"}
|
||||
]
|
||||
"@
|
||||
[System.IO.File]::WriteAllText($catalogFile, $catalogJson)
|
||||
Write-Host " model_catalog.json created: $catalogFile" -ForegroundColor Green
|
||||
|
||||
# Set env vars via setx
|
||||
& setx OPENAI_API_KEY "ClauderAPI" 2>$null | Out-Null
|
||||
& setx OPENAI_BASE_URL "https://ai.37-187-136-86.sslip.io/v1" 2>$null | Out-Null
|
||||
|
||||
Reference in New Issue
Block a user