Skip to main content
Companies such as OpenAI and Anthropic (providers) offer access to a range of large language models (LLMs) with differing strengths and capabilities through their own APIs. Each provider typically has its own unique method for interfacing with their models, complicating the process of switching providers and increasing the risk of vendor lock-in. To solve these challenges, AI SDK Core offers a standardized approach to interacting with LLMs through a language model specification that abstracts differences between providers. This unified interface allows you to switch between providers with ease while using the same API for all providers.

Provider architecture

The AI SDK uses a layered provider architecture:

Language model specification

At the core is the LanguageModelV3 interface from @ai-sdk/provider:
This interface defines the contract that all language model providers must implement.

Provider implementation

Providers implement this interface to work with the AI SDK. For example, here’s how the OpenAI provider is structured:

Core functions

The AI SDK provides high-level functions like generateText and streamText that work with any provider:

Available providers

The AI SDK comes with a wide range of providers:

Official providers

And many more - see the full list of providers.

Community providers

The open-source community has created additional providers: And many more - see the full list of community providers.

Using models

Basic usage

Switching providers

Switching providers is as simple as changing the model import:

Model configuration

Providers can be configured with custom settings:

Model capabilities

Different models support different capabilities:
See the model capabilities table for a detailed comparison.

Model registry

For dynamic model selection, use the experimental model registry:

Provider-specific options

You can pass provider-specific options using providerOptions:
This allows you to access provider-specific features while maintaining the unified AI SDK interface.