Skip to content

discoverModels

discoverModels(providerId, options?): Promise<ModelInfo[]>

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

Discover the models for a single provider.

  • kind: 'none' → returns the curated buildModelList(descriptor).
  • kind: 'openai' | 'anthropic' → fetches the models endpoint with a short timeout, parses data[].id, applies the chat-only filter, and overlays the ⭐ preferred flags via buildModelList(descriptor, liveIds).
  • kind: 'google' → fetches the native ListModels endpoint, parses models[].name keeping only generateContent-capable entries and stripping the models/ prefix, then overlays the ⭐ preferred flags likewise.

Best-effort: any error / non-2xx / malformed / empty payload falls back to the curated list. This function NEVER throws — a bad key must degrade to the curated catalog, not break first-run config.

Cloud providers are only probed live when an API key is present; without a key the curated catalog is returned directly. Ollama (no key, local daemon) is always probed.

ProviderId

ModelDiscoveryOptions

Promise<ModelInfo[]>