Azure OpenAI: `/model` selector does not preserve Azure deployment names
What version of Codex CLI is running?
0.144.4
What subscription do you have?
Free
Which model were you using?
Azure OpenAI deployment: gpt-5.6-sol-sejun
What platform is your computer?
Linux
What terminal emulator and version are you using (if applicable)?
Kitty
Codex doctor report
What issue are you seeing?
When using Azure OpenAI with custom deployment names, the /model selector replaces the configured Azure deployment name with the logical model name.
Codex correctly accepts Azure deployment names configured in config.toml. For example, my Azure deployment is named gpt-5.6-sol-sejun, and requests work correctly when this deployment name is configured.
However, after switching models using /model (for example, selecting Terra), Codex changes the model to the logical model name gpt-5.6-terra instead of using the Azure deployment name gpt-5.6-terra-sejun.
The next request fails with:
404 DeploymentNotFound
The API deployment for this resource does not exist.
This appears to happen because the /model selector does not preserve or map Azure deployment names when switching models.
What steps can reproduce the bug?
- Configure Codex to use Azure OpenAI with a custom deployment name.
Example:
model_provider = "azure"
model = "gpt-5.6-sol-sejun"
[model_providers.azure]
name = "Azure OpenAI"
base_url = "https://<resource>.cognitiveservices.azure.com/openai"
env_key = "AZURE_OPENAI_API_KEY"
wire_api = "responses"
query_params = { api-version = "2025-04-01-preview" }
- Start Codex.
- Send a prompt and verify that requests succeed.
- Use
/modelto switch from Sol to Terra.
- Observe that Codex changes the model to
gpt-5.6-terrainstead of the Azure deploymentgpt-5.6-terra-sejun.
- Send another prompt.
- The request fails with:
404 DeploymentNotFound
The API deployment for this resource does not exist.
What is the expected behavior?
When using Azure OpenAI, the /model selector should preserve Azure deployment names or provide a way to map logical model names to Azure deployment names.
For example:
Logical model:
gpt-5.6-terra
Azure deployment:
gpt-5.6-terra-sejun
Selecting "GPT-5.6 Terra" should internally use the configured Azure deployment name instead of replacing it with the logical model name.
This would allow organizations using Azure OpenAI with custom deployment names to use the model selector normally.
Additional information
The Azure deployment works correctly when using the OpenAI Python SDK and explicitly passing the deployment name:
model="gpt-5.6-terra-sejun"
Azure OpenAI deployments are often named differently from the underlying model names because organizations use custom naming conventions.
A deployment alias or model-to-deployment mapping mechanism would solve this while preserving the current model selector experience.