top of page
bottom of page
// server.js import express from "express"; import cors from "cors"; import { OpenAI } from "openai"; const app = express(); app.use(cors()); app.use(express.json()); const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY }); app.post("/api/chat", async (req, res) => { const user = req.body?.message || ""; const resp = await client.responses.create({ model: "gpt-4.1-mini", input: [{ role: "system", content: "Be a concise helper for rehearsalroom.online." }, { role: "user", content: user }] }); res.json({ reply: resp.output_text }); }); app.listen(3000, () => console.log("http://localhost:3000"));