Fix OpenAI family local auth to use bearer (#302)

* Fix OpenAI family local auth to use bearer

* test(gateway): fix bearer auth assertions for openai local flows

* test(usage): make local usage status wait resilient

* style(gateway): apply rustfmt to usage test helper

---------

Co-authored-by: fawney19 <[email protected]>
This commit is contained in:
RWDai
2026-04-17 11:10:05 +08:00
committed by GitHub
co-authored by fawney19
parent 6964729cb7
commit 96a25d058b
15 changed files with 89 additions and 37 deletions
@@ -5,7 +5,8 @@ use serde_json::Value;
use crate::ai_pipeline::planner::candidate_preparation::resolve_candidate_mapped_model;
use crate::ai_pipeline::planner::spec_metadata::local_video_create_spec_metadata;
use crate::ai_pipeline::transport::auth::{
build_passthrough_headers_with_auth, resolve_local_gemini_auth, resolve_local_openai_chat_auth,
build_passthrough_headers_with_auth, resolve_local_gemini_auth,
resolve_local_openai_bearer_auth,
};
use crate::ai_pipeline::transport::url::{
build_gemini_video_predict_long_running_url, build_passthrough_path_url,
@@ -72,7 +73,7 @@ pub(super) async fn resolve_local_video_create_candidate_payload_parts(
}
let auth = match spec.family {
LocalVideoCreateFamily::OpenAi => resolve_local_openai_chat_auth(transport),
LocalVideoCreateFamily::OpenAi => resolve_local_openai_bearer_auth(transport),
LocalVideoCreateFamily::Gemini => resolve_local_gemini_auth(transport),
};
let Some((auth_header, auth_value)) = auth else {
@@ -16,7 +16,8 @@ use crate::ai_pipeline::planner::standard::{
use crate::ai_pipeline::transport::apply_local_header_rules;
use crate::ai_pipeline::transport::auth::{
build_claude_passthrough_headers, build_complete_passthrough_headers_with_auth,
build_openai_passthrough_headers, ensure_upstream_auth_header, resolve_local_openai_chat_auth,
build_openai_passthrough_headers, ensure_upstream_auth_header,
resolve_local_openai_bearer_auth,
};
use crate::ai_pipeline::transport::local_openai_chat_transport_unsupported_reason;
use crate::ai_pipeline::{ConversionMode, ExecutionStrategy, GatewayProviderTransportSnapshot};
@@ -76,7 +77,7 @@ pub(crate) async fn resolve_local_openai_chat_candidate_payload_parts(
planner_state,
transport,
candidate,
resolve_local_openai_chat_auth(transport),
resolve_local_openai_bearer_auth(transport),
OauthPreparationContext {
trace_id,
api_format: "openai:chat",
@@ -24,7 +24,7 @@ use crate::ai_pipeline::transport::apply_local_header_rules;
use crate::ai_pipeline::transport::auth::{
build_claude_passthrough_headers, build_complete_passthrough_headers_with_auth,
build_openai_passthrough_headers, ensure_upstream_auth_header, resolve_local_gemini_auth,
resolve_local_standard_auth,
resolve_local_openai_bearer_auth, resolve_local_standard_auth,
};
use crate::ai_pipeline::transport::local_standard_transport_unsupported_reason_with_network;
use crate::ai_pipeline::{ConversionMode, ExecutionStrategy};
@@ -107,9 +107,8 @@ pub(crate) async fn resolve_local_openai_cli_candidate_payload_parts(
let direct_auth = if same_format {
match provider_api_format {
"gemini:cli" => resolve_local_gemini_auth(transport),
"claude:cli" | "openai:cli" | "openai:compact" => {
resolve_local_standard_auth(transport)
}
"claude:cli" => resolve_local_standard_auth(transport),
"openai:cli" | "openai:compact" => resolve_local_openai_bearer_auth(transport),
_ => None,
}
} else {