Skip to content

This is a sample project using OpenAI API to create short post for social media

AlexPham-HIVO/test-open-ai-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

OpenAI API Sample

1. Overview

This is a sample project that uses OpenAI API to generate content. The content is generated by GPT-4o-mini model, max_tokens is 500, temperature is 0.7. The content is written in Vietnamese. The content is a short post for social media.

2.Setup

2.1. Backend

  • Step 1: Add OpenAI API Key:
    • Create OpenAI API Key at OpenAI API
    • Create .env file in backend folder and add your OpenAI API Key as OPENAI_API_KEY
  • Step 2: Install dependencies: npm install
  • Step 3: Run server: npm start

Then you can see the server running at http://localhost:5000 (or the port that you have set in .env file).

2.2. Frontend

  • Step 1: Install dependencies: npm install
  • Step 2: Run server: npm run dev

Then you can see the frontend running at http://localhost:5173.

3. Demo

image

About

This is a sample project using OpenAI API to create short post for social media

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published