Skip to content

Function: resolveProviderEndpoint()

Makaio Framework


Makaio Framework / ai-adapters-core/config / resolveProviderEndpoint

resolveProviderEndpoint(bus, providerConfigId, protocol): Promise<ProviderEndpoint>

Defined in: ../../../adapters/core/src/config/resolve-provider-endpoint.ts:45

Resolve { baseUrl, apiKey } for a given provider config and wire protocol without requiring an agent context.

Intended for infrastructure-layer consumers (e.g., adapter-voice-bridge, cloud STT/TTS providers) that need to make HTTP calls to cloud providers but are not part of an agent turn.

Delegates the common lookup chain (config → definition → endpoint → credentials) to resolveProviderResolution and applies strict validation on the result: both baseUrl and apiKey must be present or an error is thrown.

Resolution order for the endpoint URL:

  1. ProviderConfig.endpointOverrides[protocol] (user-customised URL)
  2. ProviderDefinition.endpoints[protocol] (default from provider package)

Credentials are resolved from the config’s stored credential refs via the bus.

IMakaioBus

Makaio bus instance used to query storage and resolve credential refs

string

UUID of the ProviderConfig entity to resolve

"anthropic" | "openai"

Wire protocol to select the correct endpoint URL

Promise<ProviderEndpoint>

Resolved { baseUrl, apiKey } for the provider

Error when the ProviderConfig or its ProviderDefinition is not found, or when baseUrl or apiKey cannot be resolved from any source