MCPcopy Create free account
hub / github.com/di-sukharev/opencommit / fetchMistralModels

Function fetchMistralModels

src/utils/modelCache.ts:132–151  ·  view source on GitHub ↗
(apiKey: string)

Source from the content-addressed store, hash-verified

130}
131
132export async function fetchMistralModels(apiKey: string): Promise<string[]> {
133 try {
134 const response = await fetch('https://api.mistral.ai/v1/models', {
135 headers: {
136 Authorization: `Bearer ${apiKey}`
137 }
138 });
139
140 if (!response.ok) {
141 return MODEL_LIST.mistral;
142 }
143
144 const data = await response.json();
145 const models = data.data?.map((m: { id: string }) => m.id).sort();
146
147 return models && models.length > 0 ? models : MODEL_LIST.mistral;
148 } catch {
149 return MODEL_LIST.mistral;
150 }
151}
152
153export async function fetchGroqModels(apiKey: string): Promise<string[]> {
154 try {

Callers 1

fetchModelsForProviderFunction · 0.70

Calls 2

jsonMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected