Skip to content

Interface: Provider()

@providerprotocol/ai


@providerprotocol/ai / @providerprotocol/ai / Provider

Defined in: src/types/provider.ts:449

Provider factory function with metadata and modality handlers.

The Provider interface represents a callable function that creates model references, along with metadata and modality-specific handlers.

// Using a provider
const model = openai('gpt-4', { temperature: 0.7 });
// Accessing provider metadata
console.log(openai.name); // 'openai'
console.log(openai.version); // '1.0.0'

Providers are intended to be used with llm(), embedding(), or image(). Direct handler access is not part of the public API.

TOptions = unknown

Provider-specific options passed to the factory

Provider(modelId, options?): ModelReference<TOptions>

Defined in: src/types/provider.ts:457

Creates a model reference with optional provider-specific options.

string

The model identifier

TOptions

Provider-specific options

ModelReference<TOptions>

A model reference for use with llm() or other functions

readonly name: string

Defined in: src/types/provider.ts:460

Provider name (e.g., ‘openai’, ‘anthropic’)

ProviderIdentity.name


readonly version: string

Defined in: src/types/provider.ts:463

Provider version string

ProviderIdentity.version