Skip to content

aisdk

function aisdk(model): AiSdkModel

Wraps a model from the AI SDK that adheres to the LanguageModelV1 spec to be used used as a model in the OpenAI Agents SDK to use other models.

While you can use this with the OpenAI models, it is recommended to use the default OpenAI model provider instead.

If tracing is enabled, the model will send generation spans to your traces processor.

import { aisdk } from '@openai/agents-extensions';
import { openai } from '@ai-sdk/openai';
const model = aisdk(openai('gpt-4o'));
const agent = new Agent({
name: 'My Agent',
model
});
Parameter Type Description

model

LanguageModelV1

The Vercel AI SDK model to wrap.

AiSdkModel

The wrapped model.