MCPcopy Create free account
hub / github.com/anomalyco/models.dev / fetchModels

Function fetchModels

packages/core/src/sync/providers/openrouter.ts:83–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

81 name: "OpenRouter",
82 modelsDir: "providers/openrouter/models",
83 async fetchModels() {
84 const headers = process.env.OPENROUTER_API_KEY
85 ? { Authorization: `Bearer ${process.env.OPENROUTER_API_KEY}` }
86 : undefined;
87 const response = await fetch(API_ENDPOINT, { headers });
88 if (!response.ok) {
89 throw new Error(`OpenRouter request failed: ${response.status} ${response.statusText}`);
90 }
91 return response.json();
92 },
93 parseModels(raw) {
94 return OpenRouterResponse.parse(raw).data;
95 },

Callers

nothing calls this directly

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected