- Notifications
You must be signed in to change notification settings - Fork0
vinodnextcoder/openai-nodejs
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This repository provides examples of using the OpenAI API with Node.js. It demonstrates how to use three different API endpoints: createEmbedding, createCompletion, and createChatCompletion. Each endpoint serves a specific purpose and has its own usage pattern.
Before running the examples, make sure you have the following:
Node.js installed on your machine.OpenAI API key. You can obtain one from the OpenAI website.InstallationClone this repository:https://github.com/vinodnextcoder/openai-nodejs
Open the config.js file.
Replace the YOUR_OPENAI_API_KEY sssdsdplaceholder with your actual OpenAI API key.
UsageThe repository includes examples for three different API endpoints: createEmbedding, createCompletion, and createChatCompletion. Here's how you can use each of them:curlcurl --location 'http://localhost:3000/createEmbedding'
--header 'Content-Type: application/json'
--data '{"text":"chat"}'
curl --location 'http://localhost:3000/chatCompletion'
--header 'Content-Type: application/json'
--data '{"text":"i am going to pune university"}'
curl --location 'http://localhost:3000/createCompletion'
--header 'Content-Type: application/json'
--data '{"text":"Write a tagline for an ice cream shop."}'
About
openai nodejs example
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Uh oh!
There was an error while loading.Please reload this page.