Resolve the Copilot chat API base URL. The mint response sometimes carries an ``endpoints.api`` override (e.g. enterprise tenants on a custom endpoint). Honor it when present; otherwise default to the public api.githubcopilot.com.
()
| 252 | |
| 253 | |
| 254 | def _api_base() -> str: |
| 255 | """Resolve the Copilot chat API base URL. |
| 256 | |
| 257 | The mint response sometimes carries an ``endpoints.api`` override |
| 258 | (e.g. enterprise tenants on a custom endpoint). Honor it when |
| 259 | present; otherwise default to the public api.githubcopilot.com. |
| 260 | """ |
| 261 | endpoints = _token_cache.get("endpoints") or {} |
| 262 | if isinstance(endpoints, dict): |
| 263 | url = endpoints.get("api") or "" |
| 264 | if isinstance(url, str) and url.strip(): |
| 265 | return url.strip() |
| 266 | return GITHUB_COPILOT_API_BASE |
| 267 | |
| 268 | |
| 269 | def _upstream_model_slug(model: str) -> str: |