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});
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
|
|
The Vercel AI SDK model to wrap. |
Returns
Section titled “Returns”The wrapped model.