feat: add query_params option to ModelProviderInfo to support Azure (#1435)

As discovered in https://github.com/openai/codex/issues/1365, the Azure
provider needs to be able to specify `api-version` as a query param, so
this PR introduces a generic `query_params` option to the
`model_providers` config so that an Azure provider can be defined as
follows:

```toml
[model_providers.azure]
name = "Azure"
base_url = "https://YOUR_PROJECT_NAME.openai.azure.com/openai"
env_key = "AZURE_OPENAI_API_KEY"
query_params = { api-version = "2025-04-01-preview" }
```

This PR also updates the docs with this example.

While here, we also update `wire_api` to default to `"chat"`, as that is
likely the common case for someone defining an external provider.

Fixes https://github.com/openai/codex/issues/1365.
This commit is contained in:
Michael Bolin
2025-06-30 11:39:54 -07:00
committed by GitHub
parent cd2d84d496
commit 6dad5c3b17
7 changed files with 96 additions and 9 deletions

View File

@@ -107,6 +107,7 @@ async fn keeps_previous_response_id_between_tasks() {
env_key: Some("PATH".into()),
env_key_instructions: None,
wire_api: codex_core::WireApi::Responses,
query_params: None,
};
// Init session

View File

@@ -96,6 +96,7 @@ async fn retries_on_early_close() {
env_key: Some("PATH".into()),
env_key_instructions: None,
wire_api: codex_core::WireApi::Responses,
query_params: None,
};
let ctrl_c = std::sync::Arc::new(tokio::sync::Notify::new());