MCPcopy Create free account
hub / github.com/arctic-cli/interface / fetchModelsDevData

Function fetchModelsDevData

packages/arctic/src/provider/pricing.ts:76–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

74}
75
76async function fetchModelsDevData(): Promise<ModelsDevResponse> {
77 if (modelsDevCache && Date.now() - modelsDevCache.timestamp < MODELSDEV_CACHE_TTL) {
78 return modelsDevCache.data
79 }
80
81 const response = await fetch(MODELSDEV_API_URL)
82 if (!response.ok) {
83 throw new Error(`models.dev API error: ${response.status}`)
84 }
85
86 const data = (await response.json()) as ModelsDevResponse
87 modelsDevCache = { data, timestamp: Date.now() }
88 return data
89}
90
91export type TokenUsage = {
92 input?: number

Callers 2

initModelsDevPricingFunction · 0.85
getModelPricingAsyncFunction · 0.85

Calls 2

fetchFunction · 0.70
jsonMethod · 0.65

Tested by

no test coverage detected