Interface: ModelReference
@providerprotocol/ai / @providerprotocol/ai / ModelReference
Interface: ModelReference<TOptions>
Section titled “Interface: ModelReference<TOptions>”Defined in: src/types/provider.ts:221
A reference to a model, created by a provider factory.
Model references are lightweight objects that identify a model and its provider, used as input to the llm() function.
Example
Section titled “Example”const model = openai('gpt-4');console.log(model.modelId); // 'gpt-4'console.log(model.provider.name); // 'openai'Type Parameters
Section titled “Type Parameters”TOptions
Section titled “TOptions”TOptions = unknown
Provider-specific options type
Properties
Section titled “Properties”modelId
Section titled “modelId”
readonlymodelId:string
Defined in: src/types/provider.ts:223
The model identifier (e.g., ‘gpt-4’, ‘claude-3-opus’)
options?
Section titled “options?”
readonlyoptionaloptions:TOptions
Defined in: src/types/provider.ts:244
The original options passed when creating this model reference.
Used by providers with multiple LLM handlers (e.g., OpenAI with responses/completions APIs) to resolve the correct handler at request time, avoiding race conditions from shared state.
provider
Section titled “provider”
readonlyprovider:Provider<TOptions>
Defined in: src/types/provider.ts:226
The provider that created this reference
providerConfig?
Section titled “providerConfig?”
readonlyoptionalproviderConfig:Partial<ProviderConfig>
Defined in: src/types/provider.ts:236
Optional provider-specific configuration that gets merged into request config.
This allows providers to store options set at model reference creation time
(e.g., anthropic('model', { betas: [...] })) that should be applied to all requests.
The llm() factory will merge these into the request config, with explicit config
values taking precedence.