Skip to main content

OpenAI

Where

  • api/src/libraries/openai
  • api/src/modules/ai
  • client/src/domain/ai

Activation

Set your OpenAI key in your api/.env file

OPENAI_API_KEY=YOUR_API_KEY

Usage

Use the AiApi service in your front-end.

import { AiApi } from '@/domain/ai'

const response = await AiApi.chat('What is the capital of France?')

const imageUrl = await AiApi.generateImage('A beautiful green marble wallpaper')

Model Configuration

Adjust the AI model used by modifying the configuration in the api/src/libraries/openai/internal/openai.ts file

enum OpenaiModel {
DEFAULT = 'gpt-3.5-turbo-16k',
}

Read More

Learn more on the official OpenAI documentation