Create ChatKit session
beta.chatkit.sessions.create(SessionCreateParams**kwargs) -> ChatSession
POST/chatkit/sessions
Create a ChatKit session.
Parameters
user: str
A free-form string that identifies your end user; ensures this Session can access other objects that have the same user scope.
minLength1
Returns
Create ChatKit session
from openai import OpenAI
client = OpenAI()
chat_session = client.beta.chatkit.sessions.create(
user="user",
workflow={
"id": "id"
},
)
print(chat_session.id)
{
"client_secret": "chatkit_token_123",
"expires_at": 1735689600,
"workflow": {
"id": "workflow_alpha",
"version": "2024-10-01"
},
"scope": {
"project": "alpha",
"environment": "staging"
},
"max_requests_per_1_minute": 60,
"max_requests_per_session": 500,
"status": "active"
}
Returns Examples
{
"client_secret": "chatkit_token_123",
"expires_at": 1735689600,
"workflow": {
"id": "workflow_alpha",
"version": "2024-10-01"
},
"scope": {
"project": "alpha",
"environment": "staging"
},
"max_requests_per_1_minute": 60,
"max_requests_per_session": 500,
"status": "active"
}