Lightweight coding agent that runs in your terminal
Rust
core: route realtime and memories through HTTP client factory (#31362)
Michael Bolin89aeae6c21b1
diff --git a/codex-rs/core/src/client.rs b/codex-rs/core/src/client.rsindex 2bd4ae3bcf..251b7c1dcf 100644--- a/codex-rs/core/src/client.rs+++ b/codex-rs/core/src/client.rs@@ -70,7 +70,6 @@ use codex_login::CodexAuth;use codex_login::RefreshTokenError;use codex_login::UnauthorizedRecovery;use codex_login::default_client::build_default_reqwest_client_for_route;-use codex_login::default_client::build_reqwest_client;use codex_otel::SessionTelemetry;use codex_otel::current_span_w3c_trace_context;use codex_protocol::auth::AuthMode;@@ -155,6 +154,7 @@ const WS_REQUEST_HEADER_RESPONSES_LITE_CLIENT_METADATA_KEY: &str =const RESPONSES_WEBSOCKETS_V2_BETA_HEADER_VALUE: &str = "responses_websockets=2026-02-06";const X_OPENAI_INTERNAL_CODEX_RESPONSES_LITE_HEADER: &str ="x-openai-internal-codex-responses-lite";+const REALTIME_CALLS_ENDPOINT: &str = "/realtime/calls";const RESPONSES_ENDPOINT: &str = "/responses";const RESPONSES_COMPACT_ENDPOINT: &str = "/responses/compact";// `/responses/compact` is unary, so the timeout covers the full response rather than one idle@@ -549,7 +549,7 @@ impl ModelClient {}let client_setup = self.current_client_setup().await?;let transport =- self.build_responses_transport(&client_setup.api_provider, RESPONSES_COMPACT_ENDPOINT)?;+ self.build_api_transport(&client_setup.api_provider, RESPONSES_COMPACT_ENDPOINT)?;let request_telemetry = Self::build_request_telemetry(session_telemetry,AuthRequestTelemetryContext::new(@@ -651,8 +651,8 @@ impl ModelClient {sideband_headers.extend(sideband_websocket_auth_headers(client_setup.api_auth.as_ref(),));- let transport = ReqwestTransport::new(build_reqwest_client());let api_provider = api_provider_override.unwrap_or(client_setup.api_provider);+ let transport = self.build_api_transport(&api_provider, REALTIME_CALLS_ENDPOINT)?;let response = ApiRealtimeCallClient::new(transport, api_provider, client_setup.api_auth).create_with_session_and_headers(sdp, session_config, extra_headers).await@@ -682,7 +682,8 @@ impl ModelClient {}let client_setup = self.current_client_setup().await?;- let transport = ReqwestTransport::new(build_reqwest_client());+ let transport =+ self.build_api_transport(&client_setup.api_provider, MEMORIES_SUMMARIZE_ENDPOINT)?;let request_telemetry = Self::build_request_telemetry(session_telemetry,AuthRequestTelemetryContext::new(@@ -961,7 +962,7 @@ impl ModelClient {})}- fn build_responses_transport(+ fn build_api_transport(&self,api_provider: &ApiProvider,endpoint: &str,@@ -1413,7 +1414,7 @@ impl ModelClientSession {let client_setup = self.client.current_client_setup().await?;let transport = self.client- .build_responses_transport(&client_setup.api_provider, RESPONSES_ENDPOINT)?;+ .build_api_transport(&client_setup.api_provider, RESPONSES_ENDPOINT)?;let request_auth_context = AuthRequestTelemetryContext::new(client_setup.auth.as_ref().map(CodexAuth::auth_mode),client_setup.api_auth.as_ref(),