Skip to content

findMissingProviderKey

findMissingProviderKey(providerType, llmConfig): MissingProviderKeyDetails | undefined

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

Decide whether an LLM spec has no resolvable API key at all for its provider, and if so report which provider and which variable names would have supplied one.

This is the classifier the config loader uses to tell a missing secret apart from a provider that broke for some other reason, and it answers that question from the ENVIRONMENT rather than from the text of whatever error a provider SDK happened to throw. Message-sniffing would be wrong on both sides: SDK wording is not ours to depend on, and several providers word the same failure differently (some name the variable, some do not).

Returns undefined — meaning “not a missing-key failure” — when any of these hold:

  • the provider is unknown here, or authenticates outside an env-var key (vertexai via ADC, ollama locally), so there is no key to be missing;
  • the config carries an inline llm.apiKey;
  • the config names an llm.apiKeyEnvironmentVariable that IS set;
  • any variable the provider accepts is set.

The last two matter for correctness, not tidiness: classifying a provider outage as a missing key when a key was in fact present would defeat the whole distinction.

string | undefined

{ apiKey?: unknown; apiKeyEnvironmentVariable?: unknown; } | undefined

MissingProviderKeyDetails | undefined