Skip to content
Primary navigation

ChatKit

ModelsExpand Collapse
type ChatKitWorkflow struct{…}

Workflow metadata and state returned for the session.

ID string

Identifier of the workflow backing the session.

StateVariables map[string, ChatKitWorkflowStateVariableUnion]

State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided.

One of the following:
string
bool
float64
Tracing ChatKitWorkflowTracing

Tracing settings applied to the workflow.

Enabled bool

Indicates whether tracing is enabled.

Version string

Specific workflow version used for the session. Defaults to null when using the latest deployment.

ChatKitSessions

Cancel chat session
client.Beta.ChatKit.Sessions.Cancel(ctx, sessionID) (*ChatSession, error)
POST/chatkit/sessions/{session_id}/cancel
Create ChatKit session
client.Beta.ChatKit.Sessions.New(ctx, body) (*ChatSession, error)
POST/chatkit/sessions

ChatKitThreads

List ChatKit thread items
client.Beta.ChatKit.Threads.ListItems(ctx, threadID, query) (*ConversationCursorPage[ChatKitThreadItemListDataUnion], error)
GET/chatkit/threads/{thread_id}/items
Retrieve ChatKit thread
client.Beta.ChatKit.Threads.Get(ctx, threadID) (*ChatKitThread, error)
GET/chatkit/threads/{thread_id}
Delete ChatKit thread
client.Beta.ChatKit.Threads.Delete(ctx, threadID) (*BetaChatKitThreadDeleteResponse, error)
DELETE/chatkit/threads/{thread_id}
List ChatKit threads
client.Beta.ChatKit.Threads.List(ctx, query) (*ConversationCursorPage[ChatKitThread], error)
GET/chatkit/threads
ModelsExpand Collapse
type ChatSession struct{…}

Represents a ChatKit session and its resolved configuration.

ID string

Identifier for the ChatKit session.

ChatKitConfiguration ChatSessionChatKitConfiguration

Resolved ChatKit feature configuration for the session.

ClientSecret string

Ephemeral client secret that authenticates session requests.

ExpiresAt int64

Unix timestamp (in seconds) for when the session expires.

MaxRequestsPer1Minute int64

Convenience copy of the per-minute request limit.

Object ChatKitSession

Type discriminator that is always chatkit.session.

Resolved rate limit values.

Current lifecycle state of the session.

User string

User identifier associated with the session.

Workflow metadata for the session.

type ChatSessionAutomaticThreadTitling struct{…}

Automatic thread title preferences for the session.

Enabled bool

Whether automatic thread titling is enabled.

type ChatSessionChatKitConfiguration struct{…}

ChatKit configuration for the session.

AutomaticThreadTitling ChatSessionAutomaticThreadTitling

Automatic thread titling preferences.

Upload settings for the session.

History retention configuration.

type ChatSessionChatKitConfigurationParamResp struct{…}

Optional per-session configuration settings for ChatKit behavior.

AutomaticThreadTitling ChatSessionChatKitConfigurationParamAutomaticThreadTitlingRespoptional

Configuration for automatic thread titling. When omitted, automatic thread titling is enabled by default.

Enabled booloptional

Enable automatic thread title generation. Defaults to true.

FileUpload ChatSessionChatKitConfigurationParamFileUploadRespoptional

Configuration for upload enablement and limits. When omitted, uploads are disabled by default (max_files 10, max_file_size 512 MB).

Enabled booloptional

Enable uploads for this session. Defaults to false.

MaxFileSize int64optional

Maximum size in megabytes for each uploaded file. Defaults to 512 MB, which is the maximum allowable size.

maximum512
minimum1
MaxFiles int64optional

Maximum number of files that can be uploaded to the session. Defaults to 10.

minimum1
History ChatSessionChatKitConfigurationParamHistoryRespoptional

Configuration for chat history retention. When omitted, history is enabled by default with no limit on recent_threads (null).

Enabled booloptional

Enables chat users to access previous ChatKit threads. Defaults to true.

RecentThreads int64optional

Number of recent ChatKit threads users have access to. Defaults to unlimited when unset.

minimum1
type ChatSessionExpiresAfterParamResp struct{…}

Controls when the session expires relative to an anchor timestamp.

Anchor CreatedAt

Base timestamp used to calculate expiration. Currently fixed to created_at.

Seconds int64

Number of seconds after the anchor when the session expires.

maximum600
minimum1
type ChatSessionFileUpload struct{…}

Upload permissions and limits applied to the session.

Enabled bool

Indicates if uploads are enabled for the session.

MaxFileSize int64

Maximum upload size in megabytes.

MaxFiles int64

Maximum number of uploads allowed during the session.

type ChatSessionHistory struct{…}

History retention preferences returned for the session.

Enabled bool

Indicates if chat history is persisted for the session.

RecentThreads int64

Number of prior threads surfaced in history views. Defaults to null when all history is retained.

type ChatSessionRateLimits struct{…}

Active per-minute request limit for the session.

MaxRequestsPer1Minute int64

Maximum allowed requests per one-minute window.

type ChatSessionRateLimitsParamResp struct{…}

Controls request rate limits for the session.

MaxRequestsPer1Minute int64optional

Maximum number of requests allowed per minute for the session. Defaults to 10.

minimum1
type ChatSessionStatus string
One of the following:
const ChatSessionStatusActive ChatSessionStatus = "active"
const ChatSessionStatusExpired ChatSessionStatus = "expired"
const ChatSessionStatusCancelled ChatSessionStatus = "cancelled"
type ChatSessionWorkflowParamResp struct{…}

Workflow reference and overrides applied to the chat session.

ID string

Identifier for the workflow invoked by the session.

StateVariables map[string, ChatSessionWorkflowParamStateVariableUnionResp]optional

State variables forwarded to the workflow. Keys may be up to 64 characters, values must be primitive types, and the map defaults to an empty object.

One of the following:
string
bool
float64
Tracing ChatSessionWorkflowParamTracingRespoptional

Optional tracing overrides for the workflow invocation. When omitted, tracing is enabled by default.

Enabled booloptional

Whether tracing is enabled during the session. Defaults to true.

Version stringoptional

Specific workflow version to run. Defaults to the latest deployed version.

type ChatKitAttachment struct{…}

Attachment metadata included on thread items.

ID string

Identifier for the attachment.

MimeType string

MIME type of the attachment.

Name string

Original display name for the attachment.

PreviewURL string

Preview URL for rendering the attachment inline.

Type ChatKitAttachmentType

Attachment discriminator.

One of the following:
const ChatKitAttachmentTypeImage ChatKitAttachmentType = "image"
const ChatKitAttachmentTypeFile ChatKitAttachmentType = "file"
type ChatKitResponseOutputText struct{…}

Assistant response text accompanied by optional annotations.

Annotations []ChatKitResponseOutputTextAnnotationUnion

Ordered list of annotations attached to the response text.

One of the following:
type ChatKitResponseOutputTextAnnotationFile struct{…}

Annotation that references an uploaded file.

Source ChatKitResponseOutputTextAnnotationFileSource

File attachment referenced by the annotation.

Filename string

Filename referenced by the annotation.

Type File

Type discriminator that is always file.

Type File

Type discriminator that is always file for this annotation.

type ChatKitResponseOutputTextAnnotationURL struct{…}

Annotation that references a URL.

Source ChatKitResponseOutputTextAnnotationURLSource

URL referenced by the annotation.

Type URL

Type discriminator that is always url.

URL string

URL referenced by the annotation.

Type URL

Type discriminator that is always url for this annotation.

Text string

Assistant generated text.

Type OutputText

Type discriminator that is always output_text.

type ChatKitThread struct{…}

Represents a ChatKit thread and its current status.

ID string

Identifier of the thread.

CreatedAt int64

Unix timestamp (in seconds) for when the thread was created.

Object ChatKitThread

Type discriminator that is always chatkit.thread.

Status ChatKitThreadStatusUnion

Current status for the thread. Defaults to active for newly created threads.

One of the following:
type ChatKitThreadStatusActive struct{…}

Indicates that a thread is active.

Type Active

Status discriminator that is always active.

type ChatKitThreadStatusLocked struct{…}

Indicates that a thread is locked and cannot accept new input.

Reason string

Reason that the thread was locked. Defaults to null when no reason is recorded.

Type Locked

Status discriminator that is always locked.

type ChatKitThreadStatusClosed struct{…}

Indicates that a thread has been closed.

Reason string

Reason that the thread was closed. Defaults to null when no reason is recorded.

Type Closed

Status discriminator that is always closed.

Title string

Optional human-readable title for the thread. Defaults to null when no title has been generated.

User string

Free-form string that identifies your end user who owns the thread.

type ChatKitThreadAssistantMessageItem struct{…}

Assistant-authored message within a thread.

ID string

Identifier of the thread item.

Ordered assistant response segments.

Annotations []ChatKitResponseOutputTextAnnotationUnion

Ordered list of annotations attached to the response text.

One of the following:
type ChatKitResponseOutputTextAnnotationFile struct{…}

Annotation that references an uploaded file.

Source ChatKitResponseOutputTextAnnotationFileSource

File attachment referenced by the annotation.

Filename string

Filename referenced by the annotation.

Type File

Type discriminator that is always file.

Type File

Type discriminator that is always file for this annotation.

type ChatKitResponseOutputTextAnnotationURL struct{…}

Annotation that references a URL.

Source ChatKitResponseOutputTextAnnotationURLSource

URL referenced by the annotation.

Type URL

Type discriminator that is always url.

URL string

URL referenced by the annotation.

Type URL

Type discriminator that is always url for this annotation.

Text string

Assistant generated text.

Type OutputText

Type discriminator that is always output_text.

CreatedAt int64

Unix timestamp (in seconds) for when the item was created.

Object ChatKitThreadItem

Type discriminator that is always chatkit.thread_item.

ThreadID string

Identifier of the parent thread.

Type ChatKitAssistantMessage

Type discriminator that is always chatkit.assistant_message.

type ChatKitThreadItemList struct{…}

A paginated list of thread items rendered for the ChatKit API.

Data []ChatKitThreadItemListDataUnion

A list of items

One of the following:
type ChatKitThreadUserMessageItem struct{…}

User-authored messages within a thread.

ID string

Identifier of the thread item.

Attachments []ChatKitAttachment

Attachments associated with the user message. Defaults to an empty list.

ID string

Identifier for the attachment.

MimeType string

MIME type of the attachment.

Name string

Original display name for the attachment.

PreviewURL string

Preview URL for rendering the attachment inline.

Type ChatKitAttachmentType

Attachment discriminator.

One of the following:
const ChatKitAttachmentTypeImage ChatKitAttachmentType = "image"
const ChatKitAttachmentTypeFile ChatKitAttachmentType = "file"
Content []ChatKitThreadUserMessageItemContentUnion

Ordered content elements supplied by the user.

One of the following:
type ChatKitThreadUserMessageItemContentInputText struct{…}

Text block that a user contributed to the thread.

Text string

Plain-text content supplied by the user.

Type InputText

Type discriminator that is always input_text.

type ChatKitThreadUserMessageItemContentQuotedText struct{…}

Quoted snippet that the user referenced in their message.

Text string

Quoted text content.

Type QuotedText

Type discriminator that is always quoted_text.

CreatedAt int64

Unix timestamp (in seconds) for when the item was created.

InferenceOptions ChatKitThreadUserMessageItemInferenceOptions

Inference overrides applied to the message. Defaults to null when unset.

Model string

Model name that generated the response. Defaults to null when using the session default.

ToolChoice ChatKitThreadUserMessageItemInferenceOptionsToolChoice

Preferred tool to invoke. Defaults to null when ChatKit should auto-select.

ID string

Identifier of the requested tool.

Object ChatKitThreadItem

Type discriminator that is always chatkit.thread_item.

ThreadID string

Identifier of the parent thread.

Type ChatKitUserMessage
type ChatKitThreadAssistantMessageItem struct{…}

Assistant-authored message within a thread.

ID string

Identifier of the thread item.

Ordered assistant response segments.

Annotations []ChatKitResponseOutputTextAnnotationUnion

Ordered list of annotations attached to the response text.

One of the following:
type ChatKitResponseOutputTextAnnotationFile struct{…}

Annotation that references an uploaded file.

Source ChatKitResponseOutputTextAnnotationFileSource

File attachment referenced by the annotation.

Filename string

Filename referenced by the annotation.

Type File

Type discriminator that is always file.

Type File

Type discriminator that is always file for this annotation.

type ChatKitResponseOutputTextAnnotationURL struct{…}

Annotation that references a URL.

Source ChatKitResponseOutputTextAnnotationURLSource

URL referenced by the annotation.

Type URL

Type discriminator that is always url.

URL string

URL referenced by the annotation.

Type URL

Type discriminator that is always url for this annotation.

Text string

Assistant generated text.

Type OutputText

Type discriminator that is always output_text.

CreatedAt int64

Unix timestamp (in seconds) for when the item was created.

Object ChatKitThreadItem

Type discriminator that is always chatkit.thread_item.

ThreadID string

Identifier of the parent thread.

Type ChatKitAssistantMessage

Type discriminator that is always chatkit.assistant_message.

type ChatKitWidgetItem struct{…}

Thread item that renders a widget payload.

ID string

Identifier of the thread item.

CreatedAt int64

Unix timestamp (in seconds) for when the item was created.

Object ChatKitThreadItem

Type discriminator that is always chatkit.thread_item.

ThreadID string

Identifier of the parent thread.

Type ChatKitWidget

Type discriminator that is always chatkit.widget.

Widget string

Serialized widget payload rendered in the UI.

type ChatKitThreadItemListDataChatKitClientToolCall struct{…}

Record of a client side tool invocation initiated by the assistant.

ID string

Identifier of the thread item.

Arguments string

JSON-encoded arguments that were sent to the tool.

CallID string

Identifier for the client tool call.

CreatedAt int64

Unix timestamp (in seconds) for when the item was created.

Name string

Tool name that was invoked.

Object ChatKitThreadItem

Type discriminator that is always chatkit.thread_item.

Output string

JSON-encoded output captured from the tool. Defaults to null while execution is in progress.

Status string

Execution status for the tool call.

One of the following:
const ChatKitThreadItemListDataChatKitClientToolCallStatusInProgress ChatKitThreadItemListDataChatKitClientToolCallStatus = "in_progress"
const ChatKitThreadItemListDataChatKitClientToolCallStatusCompleted ChatKitThreadItemListDataChatKitClientToolCallStatus = "completed"
ThreadID string

Identifier of the parent thread.

Type ChatKitClientToolCall

Type discriminator that is always chatkit.client_tool_call.

type ChatKitThreadItemListDataChatKitTask struct{…}

Task emitted by the workflow to show progress and status updates.

ID string

Identifier of the thread item.

CreatedAt int64

Unix timestamp (in seconds) for when the item was created.

Heading string

Optional heading for the task. Defaults to null when not provided.

Object ChatKitThreadItem

Type discriminator that is always chatkit.thread_item.

Summary string

Optional summary that describes the task. Defaults to null when omitted.

TaskType string

Subtype for the task.

One of the following:
const ChatKitThreadItemListDataChatKitTaskTaskTypeCustom ChatKitThreadItemListDataChatKitTaskTaskType = "custom"
const ChatKitThreadItemListDataChatKitTaskTaskTypeThought ChatKitThreadItemListDataChatKitTaskTaskType = "thought"
ThreadID string

Identifier of the parent thread.

Type ChatKitTask

Type discriminator that is always chatkit.task.

type ChatKitThreadItemListDataChatKitTaskGroup struct{…}

Collection of workflow tasks grouped together in the thread.

ID string

Identifier of the thread item.

CreatedAt int64

Unix timestamp (in seconds) for when the item was created.

Object ChatKitThreadItem

Type discriminator that is always chatkit.thread_item.

Tasks []ChatKitThreadItemListDataChatKitTaskGroupTask

Tasks included in the group.

Heading string

Optional heading for the grouped task. Defaults to null when not provided.

Summary string

Optional summary that describes the grouped task. Defaults to null when omitted.

Type string

Subtype for the grouped task.

One of the following:
const ChatKitThreadItemListDataChatKitTaskGroupTaskTypeCustom ChatKitThreadItemListDataChatKitTaskGroupTaskType = "custom"
const ChatKitThreadItemListDataChatKitTaskGroupTaskTypeThought ChatKitThreadItemListDataChatKitTaskGroupTaskType = "thought"
ThreadID string

Identifier of the parent thread.

Type ChatKitTaskGroup

Type discriminator that is always chatkit.task_group.

FirstID string

The ID of the first item in the list.

HasMore bool

Whether there are more items available.

LastID string

The ID of the last item in the list.

Object List

The type of object returned, must be list.

type ChatKitThreadUserMessageItem struct{…}

User-authored messages within a thread.

ID string

Identifier of the thread item.

Attachments []ChatKitAttachment

Attachments associated with the user message. Defaults to an empty list.

ID string

Identifier for the attachment.

MimeType string

MIME type of the attachment.

Name string

Original display name for the attachment.

PreviewURL string

Preview URL for rendering the attachment inline.

Type ChatKitAttachmentType

Attachment discriminator.

One of the following:
const ChatKitAttachmentTypeImage ChatKitAttachmentType = "image"
const ChatKitAttachmentTypeFile ChatKitAttachmentType = "file"
Content []ChatKitThreadUserMessageItemContentUnion

Ordered content elements supplied by the user.

One of the following:
type ChatKitThreadUserMessageItemContentInputText struct{…}

Text block that a user contributed to the thread.

Text string

Plain-text content supplied by the user.

Type InputText

Type discriminator that is always input_text.

type ChatKitThreadUserMessageItemContentQuotedText struct{…}

Quoted snippet that the user referenced in their message.

Text string

Quoted text content.

Type QuotedText

Type discriminator that is always quoted_text.

CreatedAt int64

Unix timestamp (in seconds) for when the item was created.

InferenceOptions ChatKitThreadUserMessageItemInferenceOptions

Inference overrides applied to the message. Defaults to null when unset.

Model string

Model name that generated the response. Defaults to null when using the session default.

ToolChoice ChatKitThreadUserMessageItemInferenceOptionsToolChoice

Preferred tool to invoke. Defaults to null when ChatKit should auto-select.

ID string

Identifier of the requested tool.

Object ChatKitThreadItem

Type discriminator that is always chatkit.thread_item.

ThreadID string

Identifier of the parent thread.

Type ChatKitUserMessage
type ChatKitWidgetItem struct{…}

Thread item that renders a widget payload.

ID string

Identifier of the thread item.

CreatedAt int64

Unix timestamp (in seconds) for when the item was created.

Object ChatKitThreadItem

Type discriminator that is always chatkit.thread_item.

ThreadID string

Identifier of the parent thread.

Type ChatKitWidget

Type discriminator that is always chatkit.widget.

Widget string

Serialized widget payload rendered in the UI.