Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions docs/src/content/docs/extensions/ai-sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import aiSdkSetupExample from '../../../../../examples/docs/extensions/ai-sdk-se
quickly.
</Aside>

Out of the box the Agents SDK works with OpenAI models through the Responses API or Chat
Completions API. However, if you would like to use another model, the [Vercel's AI SDK](https://sdk.vercel.ai/) offers a range
of supported models that can be brought into the Agents SDK through this adapter.
Out of the box the Agents SDK works with OpenAI models through the Responses API or Chat Completions API. However, if you would like to use another model, the [Vercel's AI SDK](https://sdk.vercel.ai/) offers a range of supported models that can be brought into the Agents SDK through this adapter.

## Setup

Expand All @@ -30,7 +28,7 @@ of supported models that can be brought into the Agents SDK through this adapter
2. Choose your desired model package from the [Vercel's AI SDK](https://sdk.vercel.ai/docs/models/overview) and install it:

```bash
npm install @ai-sdk/openai@"^1.0.0"
npm install @ai-sdk/openai
```

3. Import the adapter and model to connect to your agent:
Expand All @@ -49,8 +47,11 @@ of supported models that can be brought into the Agents SDK through this adapter
</Steps>

<Aside type="caution">
Vercel's AI SDK has recently migrated to v2, however openai agent extensions is not yet compatible with v2.
Therefore v1 versions of Vercel's AI SDK has to be installed.
We currently support ai-sdk's model provider v2 modules, which are compatible
with Vercel AI SDK v5. If you have a specific reason to continue using the v1
model providers, you can copy the module from
[examples/ai-sdk-v1](https://github.com/openai/openai-agents-js/tree/main/examples/ai-sdk-v1)
and include it in your project.
</Aside>

## Example
Expand All @@ -59,9 +60,7 @@ of supported models that can be brought into the Agents SDK through this adapter

## Passing provider metadata

If you need to send provider-specific options with a message, pass them through
`providerMetadata`. The values are forwarded directly to the underlying AI SDK
model. For example, the following `providerData` in the Agents SDK
If you need to send provider-specific options with a message, pass them through `providerMetadata`. The values are forwarded directly to the underlying AI SDK model. For example, the following `providerData` in the Agents SDK

```ts
providerData: {
Expand Down