mirror of
https://github.com/openai/codex.git
synced 2026-11-14 21:40:39 +00:00
## Why Custom OpenAI base URLs caused Codex backend authentication to lose Responses headers and Guardian metadata when the URL did not match a recognized backend route. ## What changed Apply model-scoped Responses headers, Guardian reviewer and classifier markers, and eligible ChatGPT parent credit requests based on the OpenAI provider and authentication configuration, regardless of the base URL. Keep API-key requests and other providers excluded from this behavior. ## Testing Extend coverage for custom `/v1` URLs and direct `/api/codex` endpoints with ChatGPT, header-based, and API-key authentication, including HTTP fallback and WebSocket requests. GitOrigin-RevId: cc4bb5b4a1a6596904ecf8965237c7a4f09e112b
26 lines
970 B
Rust
26 lines
970 B
Rust
//! Header overrides for host-created threads on the Codex Responses endpoint.
|
|
//! Headers are scoped to a model and rechecked against current auth on each attempt.
|
|
|
|
use http::HeaderMap;
|
|
|
|
/// Seed in `StartThreadOptions::thread_extension_init` to supply Responses headers.
|
|
///
|
|
/// Applied only to the selected model on the OpenAI provider with Codex backend
|
|
/// auth, regardless of the base URL. The headers are sent on HTTP requests and
|
|
/// WebSocket handshakes; changes require a new socket. Other providers and
|
|
/// unrelated threads do not inherit these headers.
|
|
#[derive(Clone)]
|
|
pub struct CodexResponsesHeaders {
|
|
pub model: String,
|
|
pub headers: HeaderMap,
|
|
}
|
|
|
|
impl std::fmt::Debug for CodexResponsesHeaders {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
f.debug_struct("CodexResponsesHeaders")
|
|
.field("model", &self.model)
|
|
.field("header_names", &self.headers.keys())
|
|
.finish()
|
|
}
|
|
}
|