Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5999a8b
feat: add ChatGPT OAuth passthrough toggle for OpenAI provider
thiscantbeserious Apr 16, 2026
3baddea
fix: refactor ChatGPT OAuth — centralize body transform, fix stream f…
thiscantbeserious Apr 16, 2026
fdca85d
refactor: add route map and generic path resolver for ChatGPT OAuth
thiscantbeserious Apr 16, 2026
86f563e
test: comprehensive 100% coverage tests for ChatGPT OAuth module
thiscantbeserious Apr 16, 2026
5fae39c
security: sanitize chatgpt_account_id against HTTP header injection
thiscantbeserious Apr 16, 2026
f3397fb
docs: add ChatGPT OAuth passthrough setup guide for Codex CLI
thiscantbeserious Apr 16, 2026
4216635
feat: auto-extract OAuth token — remove allow_direct_keys requirement
thiscantbeserious Apr 16, 2026
56b7f9d
fix(ws): default WebSocket /v1/responses to OpenAI provider
thiscantbeserious Apr 16, 2026
d45462d
fix(ws): also default OpenAI provider in convertEventToRequest
thiscantbeserious Apr 16, 2026
27ae868
fix(ws): apply ChatGPT OAuth transformations to upstream WebSocket too
thiscantbeserious Apr 16, 2026
5c6aa0a
fix: apply ChatGPT OAuth to ALL OpenAI provider routes
thiscantbeserious Apr 16, 2026
31a41ff
fix(chatgpt-oauth): append required client_version query param to /mo…
thiscantbeserious Apr 16, 2026
fe93133
debug: include upstream HTTP response in WS dial errors
thiscantbeserious Apr 16, 2026
12ffa61
fix(openai): scope /v1/models requests to OpenAI provider only
thiscantbeserious Apr 16, 2026
dd432c7
fix(openai): preserve Azure SDK detection in /v1/models converter
thiscantbeserious Apr 16, 2026
84017e0
review: address CodeRabbit findings + 100% coverage
thiscantbeserious Apr 17, 2026
e66af1c
review: address 2nd-round CodeRabbit + Greptile findings
thiscantbeserious Apr 17, 2026
510d00d
test: 100% coverage on OpenAIListModelsResponse.UnmarshalJSON
thiscantbeserious Apr 17, 2026
e5f63ea
Merge branch 'main' into feature/openai-oauth-passthrough
thiscantbeserious Apr 22, 2026
39fe955
fix(openai): forward Codex identity headers over chatgpt_oauth WebSocket
thiscantbeserious Apr 22, 2026
ff64e21
fix(openai): move Codex identity defaults to merge helper, harden WS …
thiscantbeserious Apr 22, 2026
2f02179
fix(openai): gate Codex identity defaults injection to chatgpt_oauth …
thiscantbeserious Apr 22, 2026
7ecad8f
fix(wsresponses): finalize logs for native WS upstream when parse fai…
thiscantbeserious Apr 22, 2026
19639c5
fix(wsresponses): add idle timeout to upstream WS reads in tryNativeW…
thiscantbeserious Apr 23, 2026
44a6aad
chore(wsresponses): log raw upstream WS frames for OAuth terminal-eve…
thiscantbeserious Apr 23, 2026
b58517e
fix(logging): flush WS responses trace so log row is written to DB
thiscantbeserious Apr 23, 2026
a9acea3
Merge remote-tracking branch 'origin/main' into feature/openai-oauth-…
thiscantbeserious Apr 24, 2026
7ad281b
chore: remove /openai/v1/responses WS bare-model fix (extracted to #3…
thiscantbeserious Apr 24, 2026
d0a743e
chore: remove /openai/v1/models fanout fix (extracted to #3007)
thiscantbeserious Apr 24, 2026
a5b7a4e
chore: remove WS pool dial error verbosity (extracted to #3012)
thiscantbeserious Apr 24, 2026
fbf395f
chore: remove WS upstream idle timeout (extracted to #3013)
thiscantbeserious Apr 24, 2026
be767a6
chore: remove x-bf-eh-* WS forwarding (extracted to #3014)
thiscantbeserious Apr 24, 2026
870575d
chore: remove WS log finalization on parse failure and close (extract…
thiscantbeserious Apr 24, 2026
5c4f9fc
chore: remove WS tracer flush (extracted to #3017)
thiscantbeserious Apr 24, 2026
9a1771d
chore: remove WS logging switch case (extracted to #3019)
thiscantbeserious Apr 24, 2026
c85ea5d
chore: remove accumulator WS responses case (extracted to #3020)
thiscantbeserious Apr 24, 2026
d39ea5a
chore: pool session liveness probe extracted to #3021 (no feature-bra…
thiscantbeserious Apr 24, 2026
1e22773
chore: TTL sweeper orphan flush extracted to #3022 (no feature-branch…
thiscantbeserious Apr 24, 2026
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
19 changes: 19 additions & 0 deletions core/bifrost.go
Original file line number Diff line number Diff line change
Expand Up @@ -5547,6 +5547,25 @@ func (bifrost *Bifrost) requestWorker(provider schemas.Provider, config *schemas
// Tells the logging plugin whether to persist raw bytes in log records.
req.Context.SetValue(schemas.BifrostContextKeyShouldStoreRawInLogs, effectiveStore)

// ChatGPT OAuth: extract Bearer token from request headers and inject as direct key.
// This bypasses the need for allow_direct_keys — the provider's chatgpt_oauth flag
// is sufficient authorization to forward the caller's token. Logic lives in the
// openai package to keep all ChatGPT-specific code in one module.
if config.OpenAIConfig != nil && config.OpenAIConfig.ChatGPTOAuth {
if _, alreadySet := req.Context.Value(schemas.BifrostContextKeyDirectKey).(schemas.Key); !alreadySet {
if headers, ok := req.Context.Value(schemas.BifrostContextKeyRequestHeaders).(map[string]string); ok {
if token := openai.ExtractChatGPTOAuthBearerToken(headers); token != "" {
req.Context.SetValue(schemas.BifrostContextKeyDirectKey, schemas.Key{
ID: openai.ChatGPTOAuthDirectKeyID,
Value: *schemas.NewEnvVar(token),
Models: []string{},
Weight: 1.0,
})
}
}
}
Comment thread
thiscantbeserious marked this conversation as resolved.
}

var keys []schemas.Key
// keyProvider is passed to executeRequestWithRetries to manage key selection and rotation.
// It is nil when no key is required (e.g. providerRequiresKey=false) or for multi-key
Expand Down
1 change: 1 addition & 0 deletions core/providers/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ func (provider *AzureProvider) ResponsesStream(ctx *schemas.BifrostContext, post
nil,
nil,
nil,
nil,
provider.logger,
postHookSpanFinalizer,
)
Expand Down
3 changes: 2 additions & 1 deletion core/providers/fireworks/fireworks.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ func (provider *FireworksProvider) ListModels(ctx *schemas.BifrostContext, keys
)
}


// TextCompletion performs a text completion request to the Fireworks AI API.
func (provider *FireworksProvider) TextCompletion(ctx *schemas.BifrostContext, key schemas.Key, request *schemas.BifrostTextCompletionRequest) (*schemas.BifrostTextCompletionResponse, *schemas.BifrostError) {
return openai.HandleOpenAITextCompletionRequest(
Expand Down Expand Up @@ -188,6 +187,7 @@ func (provider *FireworksProvider) Responses(ctx *schemas.BifrostContext, key sc
nil,
nil,
provider.logger,
nil,
)
}

Expand All @@ -212,6 +212,7 @@ func (provider *FireworksProvider) ResponsesStream(ctx *schemas.BifrostContext,
nil,
nil,
nil,
nil,
provider.logger,
postHookSpanFinalizer,
)
Expand Down
Loading