(headers *http.Header)
| 168 | } |
| 169 | |
| 170 | func (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 | |
| 184 | func (p *OpenAI) CircuitBreakerConfig() *config.CircuitBreaker { |
| 185 | return p.circuitBreaker |