Skip to main content
POST
/
ai_chats
JavaScript
import Whop from '@whop/sdk';

const client = new Whop({
  apiKey: process.env['WHOP_API_KEY'], // This is the default and can be omitted
});

const aiChat = await client.aiChats.create();

console.log(aiChat.id);
{
  "id": "aich_xxxxxxxxxxxxx",
  "title": "<string>",
  "message_count": 42,
  "blended_token_usage": "123.45",
  "created_at": "2023-12-01T05:00:00.401Z",
  "updated_at": "2023-12-01T05:00:00.401Z",
  "last_message_at": "2023-12-01T05:00:00.401Z",
  "user": {
    "id": "user_xxxxxxxxxxxxx"
  }
}

Authorizations

Authorization
string
header
required

The app API key from an app from the /dashboard/developer page

Body

application/json

Parameters for CreateAiChat

title
string | null

The title of the AI chat

Response

A successful response

An AI chat conversation belonging to a user

id
string
required

The unique identifier for the AI chat

Example:

"aich_xxxxxxxxxxxxx"

title
string | null
required

The title of the AI chat

message_count
integer
required

The number of messages in the chat

Example:

42

blended_token_usage
string
required

The total number of tokens used in the chat

Example:

"123.45"

created_at
string<date-time>
required

When the AI chat was created

Example:

"2023-12-01T05:00:00.401Z"

updated_at
string<date-time>
required

When the AI chat was last updated

Example:

"2023-12-01T05:00:00.401Z"

last_message_at
string<date-time> | null
required

When the last message was sent

Example:

"2023-12-01T05:00:00.401Z"

user
object
required

The user who owns the AI chat