app/api/assistants/threads/route.ts (6 lines of code) (raw):
import { openai } from "@/app/openai";
export const runtime = "nodejs";
// Create a new thread
export async function POST() {
const thread = await openai.beta.threads.create();
return Response.json({ threadId: thread.id });
}