Vercel and OpenAI Integration

Integrate your Vercel project with OpenAI's powerful suite of models.

Vercel integrates with OpenAI to enable developers to build fast, scalable, and secure AI applications.

You can integrate with any OpenAI model using the AI SDK, including the following OpenAI models:

  • GPT-4o: Understand and generate natural language or code
  • GPT-4.5: Latest language model with enhanced emotional intelligence
  • o3-mini: Reasoning model specialized in code generation and complex tasks
  • DALL·E 3: Generate and edit images from natural language
  • Embeddings: Convert term into vectors

To help you get started, we have built a variety of AI templates integrating OpenAI with Vercel.

Before you begin, ensure you have an OpenAI account. Once registered:

  1. Log into your OpenAI Dashboard and view API keys.

  2. Click on Create new secret key. Copy the generated API key securely.

    Always keep your API keys confidential. Do not expose them in client-side code. Use Vercel Environment Variables for safe storage and do not commit these values to git.

  3. Finally, add the OPENAI_API_KEY environment variable in your project:

    .env.local
    OPENAI_API_KEY='sk-...3Yu5'

Integrating OpenAI into your Vercel project is seamless with the AI SDK.

Install the AI SDK in your project with your favorite package manager:

pnpm i ai

You can use the SDK to build AI applications with React (Next.js), Vue (Nuxt), Svelte (SvelteKit), and Node.js.

The AI SDK also has full support for OpenAI Functions (tool calling).

Learn more about using tools with the AI SDK.

Last updated on March 4, 2025