# @ai-sdk/openai

Latest version **4.0.66** (published 2026-09-11) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @ai-sdk/openai
pnpm add @ai-sdk/openai
yarn add @ai-sdk/openai
bun add @ai-sdk/openai
```

## Health

**Score 80/100 (A)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score; popular repo.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.0.66 |
| Published | 2026-09-11 |
| First published | 2024-04-12 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22 |
| Dependencies | 2 |
| Unpacked size | 3 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 26708 |
| Maintainers | vercel-release-bot, matheuss, matt.straka |
| Keywords | ai |

## Links

- npm: https://www.npmjs.com/package/@ai-sdk/openai
- Repository: https://github.com/vercel/ai
- Homepage: https://ai-sdk.dev/docs
- Issues: https://github.com/vercel/ai/issues
- npm.io page: https://npm.io/package/@ai-sdk/openai

## Dependencies (2)

- [@ai-sdk/provider](https://npm.io/package/@ai-sdk/provider.md) 4.0.14
- [@ai-sdk/provider-utils](https://npm.io/package/@ai-sdk/provider-utils.md) 5.0.40

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 4.0.66 (latest) — 2026-09-11
- 3.0.112 (ai-v6) — 2026-09-09
- 2.0.127 (ai-v5) — 2026-09-09
- 0.0.0-f1630544-20260811180950 (snapshot) — 2026-08-11
- 4.0.0-beta.77 (beta) — 2026-06-23
- 4.0.0-canary.73 (canary) — 2026-06-12
- 2.0.0-alpha.15 (alpha) — 2025-06-18
- 4.0.65 — 2026-09-09
- 4.0.64 — 2026-09-09
- 4.0.63 — 2026-09-09
- 2.0.126 — 2026-09-09
- 3.0.111 — 2026-09-09
- 3.0.110 — 2026-09-08
- 4.0.62 — 2026-09-08
- 4.0.61 — 2026-09-08
- … 691 more at https://npm.io/package/@ai-sdk/openai/versions

## README

# AI SDK - OpenAI Provider

The **[OpenAI provider](https://ai-sdk.dev/providers/ai-sdk-providers/openai)** for the [AI SDK](https://ai-sdk.dev/docs)
contains language model support for the OpenAI chat and completion APIs and embedding model support for the OpenAI embeddings API.

> **Deploying to Vercel?** With Vercel's AI Gateway you can access OpenAI (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).

## Setup

The OpenAI provider is available in the `@ai-sdk/openai` module. You can install it with

```bash
npm i @ai-sdk/openai
```

## Skill for Coding Agents

If you use coding agents such as Claude Code or Cursor, we highly recommend adding the AI SDK skill to your repository:

```shell
npx skills add vercel/ai
```

## Provider Instance

You can import the default provider instance `openai` from `@ai-sdk/openai`:

```ts
import { openai } from '@ai-sdk/openai';
```

## Example

```ts
import { openai } from '@ai-sdk/openai';
import { generateText } from 'ai';

const { text } = await generateText({
  model: openai('gpt-5-mini'),
  prompt: 'Write a vegetarian lasagna recipe for 4 people.',
});
```

## Documentation

Please check out the **[OpenAI provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/openai)** for more information.

---
_Source: https://npm.io/package/@ai-sdk/openai · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
