(apiKey)
| 86258 | return []; |
| 86259 | } |
| 86260 | const data = await response.json(); |
| 86261 | return data.data?.map((m5) => m5.id) || []; |
| 86262 | } catch { |
| 86263 | return []; |
| 86264 | } |
| 86265 | } |
| 86266 | async function fetchAnthropicModels(apiKey) { |
| 86267 | try { |
| 86268 | const response = await fetch("https://api.anthropic.com/v1/models", { |
| 86269 | headers: { |
| 86270 | "x-api-key": apiKey, |
| 86271 | "anthropic-version": "2023-06-01" |
| 86272 | } |
| 86273 | }); |
| 86274 | if (!response.ok) { |
| 86275 | return MODEL_LIST.anthropic; |
| 86276 | } |
| 86277 | const data = await response.json(); |
| 86278 | const models = data.data?.map((m5) => m5.id).filter((id) => id.startsWith("claude-")).sort(); |
| 86279 | return models && models.length > 0 ? models : MODEL_LIST.anthropic; |
| 86280 | } catch { |
no test coverage detected