Restored to '7aa09373aacdcc1083018c718e608e30b6be2b33'

Replit-Restored-To: 7aa09373aa
This commit is contained in:
sebastjanartic
2026-02-28 20:34:36 +00:00
parent a8643ecdd2
commit abd322871b
76 changed files with 213 additions and 4640 deletions
@@ -1,31 +0,0 @@
import type { Express, Request, Response } from "express";
import { openai } from "./client";
export function registerImageRoutes(app: Express): void {
app.post("/api/generate-image", async (req: Request, res: Response) => {
try {
const { prompt, size = "1024x1024" } = req.body;
if (!prompt) {
return res.status(400).json({ error: "Prompt is required" });
}
const response = await openai.images.generate({
model: "gpt-image-1",
prompt,
n: 1,
size: size as "1024x1024" | "512x512" | "256x256",
});
const imageData = response.data[0];
res.json({
url: imageData.url,
b64_json: imageData.b64_json,
});
} catch (error) {
console.error("Error generating image:", error);
res.status(500).json({ error: "Failed to generate image" });
}
});
}