Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Expose current ChatGPT subscription models (#64625)
Ben Kunkleee8dd5f861b6
diff --git a/crates/openai_subscribed/src/openai_subscribed.rs b/crates/openai_subscribed/src/openai_subscribed.rsindex 9d8de4e0938..ca77c61c49d 100644--- a/crates/openai_subscribed/src/openai_subscribed.rs+++ b/crates/openai_subscribed/src/openai_subscribed.rs@@ -38,11 +38,10 @@ const CLIENT_ID: &str = "app_EMoamEEZ73f0CkXaXp7hrann";const CREDENTIALS_KEY: &str = "https://chatgpt.com/backend-api/codex";const TOKEN_REFRESH_BUFFER_MS: u64 = Duration::from_mins(5).as_millis() as u64;-/// Requests the complete account catalog without Codex CLI version filtering.+/// Client compatibility version sent to the ChatGPT model catalog.///-/// The backend treats this exact version as an ungated sentinel. Other versions-/// are compared with each model's `minimal_client_version`.-const UNGATED_MODEL_CATALOG_CLIENT_VERSION: &str = "0.0.0";+/// The backend compares this value with each model's `minimal_client_version`.+const MODEL_CATALOG_CLIENT_VERSION: &str = "0.999.0";// Codex applies the same bound because model discovery is a startup-critical request.const MODEL_CATALOG_REQUEST_TIMEOUT: Duration = Duration::from_secs(5);@@ -165,7 +164,7 @@ impl State {load_task: Some(load_task),credentials_provider,http_client,- client_version: UNGATED_MODEL_CATALOG_CLIENT_VERSION.into(),+ client_version: MODEL_CATALOG_CLIENT_VERSION.into(),available_models: ChatGptModel::all(),auth_generation: 0,model_catalog_generation: 0,@@ -1726,7 +1725,9 @@ mod tests {let http: Arc<dyn HttpClient> = FakeHttpClient::create(|request| async move {assert_eq!(request.uri().to_string(),- "https://chatgpt.com/backend-api/codex/models?client_version=0.0.0"+ format!(+ "https://chatgpt.com/backend-api/codex/models?client_version={MODEL_CATALOG_CLIENT_VERSION}"+ ));Ok(http_client::Response::builder().status(200)