Create a ChatKit session
ChatSession beta().chatkit().sessions().create(SessionCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/chatkit/sessions
Create a ChatKit session
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.beta.chatkit.sessions.SessionCreateParams;
import com.openai.models.beta.chatkit.threads.ChatSession;
import com.openai.models.beta.chatkit.threads.ChatSessionWorkflowParam;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
SessionCreateParams params = SessionCreateParams.builder()
.user("user_123")
.workflow(ChatSessionWorkflowParam.builder()
.id("workflow_alpha")
.build())
.build();
ChatSession chatSession = client.beta().chatkit().sessions().create(params);
}
}
{
"id": "cksess_123",
"object": "chatkit.session",
"client_secret": "ek_example_00eyJleHBpcmVzX2F0IjogMTczNTY4OTYwMH0=",
"expires_at": 1735689600,
"workflow": {
"id": "workflow_alpha",
"version": null,
"state_variables": null,
"tracing": {
"enabled": true
}
},
"user": "user_123",
"rate_limits": {
"max_requests_per_1_minute": 10
},
"max_requests_per_1_minute": 10,
"status": "active",
"chatkit_configuration": {
"automatic_thread_titling": {
"enabled": true
},
"file_upload": {
"enabled": false,
"max_file_size": 512,
"max_files": 10
},
"history": {
"enabled": true,
"recent_threads": null
}
}
}
Returns Examples
{
"id": "cksess_123",
"object": "chatkit.session",
"client_secret": "ek_example_00eyJleHBpcmVzX2F0IjogMTczNTY4OTYwMH0=",
"expires_at": 1735689600,
"workflow": {
"id": "workflow_alpha",
"version": null,
"state_variables": null,
"tracing": {
"enabled": true
}
},
"user": "user_123",
"rate_limits": {
"max_requests_per_1_minute": 10
},
"max_requests_per_1_minute": 10,
"status": "active",
"chatkit_configuration": {
"automatic_thread_titling": {
"enabled": true
},
"file_upload": {
"enabled": false,
"max_file_size": 512,
"max_files": 10
},
"history": {
"enabled": true,
"recent_threads": null
}
}
}