AI Chat Bot with Vue.js and GPT-4: Build Smarter Apps
Plans from $25/month

This lesson is for members. Join us?

Subscribe now to get instant access to this course, plus a full library of Vue.js courses tailored to the plan you choose.

Your First Request to OpenAI API

In this lesson, we perform the necessary “Hello world” step of any new technology by making our first request to the Open AI Chat API.

If you’re using the VS Code Rest client, here’s the setup for the request if you’d like to quickly copy paste.

POST https://api.openai.com/v1/chat/completions
Content-Type: application/json
Authorization: Bearer {{$dotenv NUXT_OPENAI_API_KEY}}

{
  "model": "gpt-3.5-turbo",
  "messages": [{"role": "user", "content": "Say this is a test!"}],
  "temperature": 0,
  "n": 1
}

Links