Skip to content

openai.chatkit.sessions.create should be added to this npm package #1673

@vivek-codepalette

Description

@vivek-codepalette

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions