()
| 23 | * (or api-staging.anthropic.com for ant users). |
| 24 | */ |
| 25 | export function isFirstPartyAnthropicBaseUrl(): boolean { |
| 26 | const baseUrl = process.env.ANTHROPIC_BASE_URL |
| 27 | if (!baseUrl) { |
| 28 | return true |
| 29 | } |
| 30 | try { |
| 31 | const host = new URL(baseUrl).host |
| 32 | const allowedHosts = ['api.anthropic.com'] |
| 33 | if (process.env.USER_TYPE === 'ant') { |
| 34 | allowedHosts.push('api-staging.anthropic.com') |
| 35 | } |
| 36 | return allowedHosts.includes(host) |
| 37 | } catch { |
| 38 | return false |
| 39 | } |
| 40 | } |
| 41 |
no test coverage detected