-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
Confirm this is a feature request for the Node library and not the underlying OpenAI API.
- This is a feature request for the Node library
Describe the feature or improvement you're requesting
OpenAI's chatkit-js example (https://github.com/openai/chatkit-js) shows Python backend. While that works, having .chatkit.session.create directly in Typescript ensures we can use Next.js end-end for creating ChatKit expereinces.
Below code should work when the ChatKit is implemented to the OpenAI's Node.js package. Would kindly request the team to implement this change so we don't need to install, use and deploy Python backends.
import { NextRequest } from "next/server";
import OpenAI from "openai";
export async function POST(req: NextRequest) {
const client = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
});
const response = await client.chatkit.sessions.create({
})
return Response.json({ client_secret: response.client_secret });
}
```Scr
### Additional context
_No response_
Metadata
Metadata
Assignees
Labels
No labels