proxy-oai / server.js
Fred0828's picture
Create server.js
095a061 verified
raw
history blame
449 Bytes
const express = require('express');
const proxy = require('express-http-proxy');
const app = express();
const targetUrl = 'https://api.openai.com'; // OpenAI API endpoint
app.use('/', proxy(targetUrl, {
proxyReqOptDecorator: (proxyReqOpts, srcReq) => {
// Modify the request headers if necessary
return proxyReqOpts;
},
}));
const port = 7860;
app.listen(port, () => {
console.log(`Reverse proxy server listening on port ${port}`);
});