Get the Anthropic API URL. Checks the user preference first, then falls back to system configuration ONLY when no preference is set. A preference URL that fails the SSRF allowlist check is dropped (and a warning is logged) — it is NOT silently substituted with the admin default
()
| 372 | |
| 373 | |
| 374 | def get_anthropic_api_url(): |
| 375 | """ |
| 376 | Get the Anthropic API URL. |
| 377 | |
| 378 | Checks the user preference first, then falls back to system |
| 379 | configuration ONLY when no preference is set. A preference URL |
| 380 | that fails the SSRF allowlist check is dropped (and a warning is |
| 381 | logged) — it is NOT silently substituted with the admin default. |
| 382 | |
| 383 | Returns: |
| 384 | The URL string, or empty string if not configured or rejected. |
| 385 | """ |
| 386 | return _resolve_pref_url( |
| 387 | 'anthropic_api_url', config.ANTHROPIC_API_URL |
| 388 | ) |
| 389 | |
| 390 | |
| 391 | def get_anthropic_api_key(): |
no test coverage detected