Skip to content
Discussion options

You must be logged in to vote

I suggest you go through the docs to get a better understanding, but the process is quite simple. Here is the link to the documentation: Vercel AI Docs.

Here’s a basic outline of the steps:

  1. Install the Vercel AI SDK
npm install @ai-sdk/openai
  1. Import the predefined provider instance
import { openai } from '@ai-sdk/openai';

If you want to customize it (optional), you can create your own instance:

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

const openai = createOpenAI({
  // Custom settings, e.g.
  headers: {
    'header-name': 'header-value',
  },
});
  1. Create an endpoint to generate responses

Import the generateText function:

import { generateText } from 'ai';

Use it like this:

const 

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gr2m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants