mirror of
https://github.com/openai/codex.git
synced 2026-05-04 21:32:21 +03:00
Remove OPENAI_BASE_URL config fallback (#16720)
The `OPENAI_BASE_URL` environment variable has been a significant support issue, so we decided to deprecate it in favor of an `openai_base_url` config key. We've had the deprecation warning in place for about a month, so users have had time to migrate to the new mechanism. This PR removes support for `OPENAI_BASE_URL` entirely.
This commit is contained in:
@@ -148,7 +148,6 @@ pub(crate) const DEFAULT_AGENT_MAX_DEPTH: i32 = 1;
|
||||
pub(crate) const DEFAULT_AGENT_JOB_MAX_RUNTIME_SECONDS: Option<u64> = None;
|
||||
|
||||
pub const CONFIG_TOML_FILE: &str = "config.toml";
|
||||
const OPENAI_BASE_URL_ENV_VAR: &str = "OPENAI_BASE_URL";
|
||||
const RESERVED_MODEL_PROVIDER_IDS: [&str; 3] = [
|
||||
OPENAI_PROVIDER_ID,
|
||||
OLLAMA_OSS_PROVIDER_ID,
|
||||
@@ -2306,24 +2305,8 @@ impl Config {
|
||||
.openai_base_url
|
||||
.clone()
|
||||
.filter(|value| !value.is_empty());
|
||||
let openai_base_url_from_env = std::env::var(OPENAI_BASE_URL_ENV_VAR)
|
||||
.ok()
|
||||
.filter(|value| !value.is_empty());
|
||||
if openai_base_url_from_env.is_some() {
|
||||
if openai_base_url.is_some() {
|
||||
tracing::warn!(
|
||||
env_var = OPENAI_BASE_URL_ENV_VAR,
|
||||
"deprecated env var is ignored because `openai_base_url` is set in config.toml"
|
||||
);
|
||||
} else {
|
||||
startup_warnings.push(format!(
|
||||
"`{OPENAI_BASE_URL_ENV_VAR}` is deprecated. Set `openai_base_url` in config.toml instead."
|
||||
));
|
||||
}
|
||||
}
|
||||
let effective_openai_base_url = openai_base_url.or(openai_base_url_from_env);
|
||||
|
||||
let mut model_providers = built_in_model_providers(effective_openai_base_url);
|
||||
let mut model_providers = built_in_model_providers(openai_base_url);
|
||||
// Merge user-defined providers into the built-in list.
|
||||
for (key, provider) in cfg.model_providers.into_iter() {
|
||||
model_providers.entry(key).or_insert(provider);
|
||||
|
||||
Reference in New Issue
Block a user