feat(gateway): add Codex Live and OpenAI Realtime

Implement preflighted Live/Realtime WebSocket transports, protocol-aware authentication, usage auditing, UI filtering, and legacy Codex permission migration.
This commit is contained in:
ZheFox
2026-08-21 04:27:34 +08:00
parent fe38dcd294
commit 2c89202001
105 changed files with 7553 additions and 947 deletions
@@ -243,7 +243,7 @@ fn select_primary_credential(
if signature.starts_with("claude:") {
return select_claude_messages_credential(bundle);
}
if signature.starts_with("openai:") {
if signature.starts_with("openai:") || signature.starts_with("codex:") {
return select_openai_credential(bundle);
}
if signature.starts_with("aether:") {
@@ -491,6 +491,25 @@ mod tests {
);
}
#[test]
fn selects_codex_live_bearer_as_provider_api_key() {
let mut headers = http::HeaderMap::new();
headers.insert(
http::header::AUTHORIZATION,
"Bearer sk-codex-live".parse().unwrap(),
);
let extracted =
extract_request_credentials(&headers, &uri("/v1/live?model=gpt-live"), "codex:live");
assert_eq!(
extracted.primary,
Some(GatewayPrimaryCredential::ProviderApiKey {
raw: "sk-codex-live".to_string(),
carrier: GatewayCredentialCarrier::AuthorizationBearer,
})
);
}
#[test]
fn prefers_claude_chat_x_api_key_over_bearer() {
let mut headers = http::HeaderMap::new();