A simple Express.js server that acts as a proxy for OpenAI API requests.
This server provides an API endpoint that forwards requests to OpenAI's GPT-4o model. It handles authentication and error handling, making it easier to integrate OpenAI's capabilities into your applications.
- Express.js server setup with CORS support
- OpenAI API integration with GPT-4o model
- Environment variable configuration via dotenv
- Basic error handling and request validation
- Clone the repository
- Install dependencies:
npm install express dotenv cors openai - Create a
.envfile in the root directory with your OpenAI API key:OPENAI_API_KEY=your_api_key_here - Start the server:
node server.js
- Clone the repository
- Install dependencies:
npm install express dotenv cors openai - Create a
.envfile in the root directory with your OpenAI API key:OPENAI_API_KEY=your_api_key_here - Start the server:
node server.js