Build HTTP headers for OpenAI-compatible API request. Args: api_key: API key for authorization. If empty, no Authorization header. Returns: Headers dict with Content-Type and optional Authorization.
(self, api_key: str)
| 313 | return content |
| 314 | |
| 315 | def _build_openai_headers(self, api_key: str) -> dict: |
| 316 | """Build HTTP headers for OpenAI-compatible API request. |
| 317 | |
| 318 | Args: |
| 319 | api_key: API key for authorization. If empty, no Authorization header. |
| 320 | |
| 321 | Returns: |
| 322 | Headers dict with Content-Type and optional Authorization. |
| 323 | """ |
| 324 | headers = {"Content-Type": "application/json"} |
| 325 | if api_key: |
| 326 | headers["Authorization"] = f"Bearer {api_key}" |
| 327 | return headers |
| 328 | |
| 329 | def _calculate_retry_delay(self, attempt: int, max_delay: float = 2.0) -> float: |
| 330 | """Calculate exponential backoff delay with full jitter. |
nothing calls this directly
no outgoing calls
no test coverage detected