MCPcopy Create free account
hub / github.com/apache/maka / fetchProviderModels

Function fetchProviderModels

packages/runtime/src/model-fetcher.ts:119–139  ·  view source on GitHub ↗
(
  connection: LlmConnection,
  apiKey: string,
  options: ConnectionEffectFetchOptions = {},
)

Source from the content-addressed store, hash-verified

117>;
118
119export async function fetchProviderModels(
120 connection: LlmConnection,
121 apiKey: string,
122 options: ConnectionEffectFetchOptions = {},
123): Promise<ModelInfo[]> {
124 try {
125 return normalizeDiscoveredModels(
126 await fetchProviderModelsStrict(connection, apiKey, options.fetch),
127 );
128 } catch (error) {
129 // Preserve status-bearing discovery errors so the sync layer can classify
130 // auth/protocol/network failures; only wrap unknown errors for display.
131 if (
132 error instanceof OpenAiCodexDiscoveryError ||
133 error instanceof ProviderModelDiscoveryHttpError
134 ) {
135 throw error;
136 }
137 throw new Error(generalizedErrorMessage(error, 'Failed to fetch provider models'));
138 }
139}
140
141export async function runConnectionModelDiscoveryEffect(
142 connection: ConnectionEffectConnection,

Callers 10

runCloudflareDiscoveryFunction · 0.85
runGitHubCopilotWireFunction · 0.85
runFireworksDiscoveryFunction · 0.85
runCohereDiscoveryFunction · 0.85
runGeneratedDiscoveryFunction · 0.85

Calls 3

generalizedErrorMessageFunction · 0.90

Tested by 8

runCloudflareDiscoveryFunction · 0.68
runGitHubCopilotWireFunction · 0.68
runFireworksDiscoveryFunction · 0.68
runCohereDiscoveryFunction · 0.68
runGeneratedDiscoveryFunction · 0.68