MCPcopy Create free account
hub / github.com/coder/aibridge / InjectAuthHeader

Method InjectAuthHeader

provider/openai.go:170–182  ·  view source on GitHub ↗
(headers *http.Header)

Source from the content-addressed store, hash-verified

168}
169
170func (p *OpenAI) InjectAuthHeader(headers *http.Header) {
171 if headers == nil {
172 headers = &http.Header{}
173 }
174
175 // BYOK: if the request already carries user-supplied credentials,
176 // do not overwrite them with the centralized key.
177 if headers.Get("Authorization") != "" {
178 return
179 }
180
181 headers.Set(p.AuthHeader(), "Bearer "+p.cfg.Key)
182}
183
184func (p *OpenAI) CircuitBreakerConfig() *config.CircuitBreaker {
185 return p.circuitBreaker

Callers 1

Calls 2

AuthHeaderMethod · 0.95
GetMethod · 0.80

Tested by 1