Skip to content

getProviderCatalog

getProviderCatalog(providerId, options?): Promise<ProviderCatalog | null>

Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/providers/modelCatalog.ts:255

Get the models.dev catalog slice for one provider, cache-first.

  • Local / self-hosted (ollama, or any provider without a MODELS_DEV_PROVIDER_KEY): returns null immediately, with no network call.
  • Cloud, fresh cache (and not refresh): returns the cached slice, no network call.
  • Cloud, missing / stale cache, or refresh: fetches api.json once, slices this provider, writes the slice to the per-provider cache, and returns it.
  • Fetch fails: returns the stale cached slice if one exists (degrade, don’t blank), else null.

NEVER throws — catalog availability must never block model use.

ProviderId

CatalogOptions = {}

Promise<ProviderCatalog | null>