Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions codex-rs/core/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -961,7 +962,7 @@ impl ModelClient {
})
}

fn build_responses_transport(
fn build_api_transport(
&self,
api_provider: &ApiProvider,
endpoint: &str,
Expand Down Expand Up @@ -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(),
Expand Down
Loading