openapi: 3.0.0 info: title: OpenAI Assistants Chatkit API description: The Assistants API allows you to build AI assistants within your own applications. An Assistant has instructions and can leverage models, tools, and knowledge to respond to user queries. The Assistants API currently supports three types of tools - Code Interpreter, Retrieval, and Function calling. In the future, we plan to release more OpenAI-built tools, and allow you to provide your own tools on our platform. version: 2.0.0 termsOfService: https://openai.com/policies/terms-of-use contact: name: OpenAI Support url: https://help.openai.com/ license: name: MIT url: https://github.com/openai/openai-openapi/blob/master/LICENSE servers: - url: https://api.openai.com/v1 security: - ApiKeyAuth: [] tags: - name: Chatkit paths: /chatkit/sessions/{session_id}/cancel: post: summary: 'Cancel an active ChatKit session and return its most recent metadata. Cancelling prevents new requests from using the issued client secret.' operationId: CancelChatSessionMethod parameters: - name: session_id in: path description: Unique identifier for the ChatKit session to cancel. required: true schema: example: cksess_123 type: string responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/ChatSessionResource' x-oaiMeta: name: Cancel chat session group: chatkit beta: true path: cancel-session new requests from using the issued client secret. examples: request: curl: "curl -X POST \\\n https://api.openai.com/v1/chatkit/sessions/cksess_123/cancel \\\n -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n" javascript: 'import OpenAI from ''openai''; const client = new OpenAI(); const chatSession = await client.beta.chatkit.sessions.cancel(''cksess_123''); console.log(chatSession.id); ' python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nchat_session = client.beta.chatkit.sessions.cancel(\n \"cksess_123\",\n)\nprint(chat_session.id)" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tchatSession, err := client.Beta.ChatKit.Sessions.Cancel(context.TODO(), \"cksess_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", chatSession.ID)\n}\n" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") chat_session = openai.beta.chatkit.sessions.cancel("cksess_123") puts(chat_session)' java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.sessions.SessionCancelParams;\nimport com.openai.models.beta.chatkit.threads.ChatSession;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n ChatSession chatSession = client.beta().chatkit().sessions().cancel(\"cksess_123\");\n }\n}" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst chatSession = await client.beta.chatkit.sessions.cancel('cksess_123');\n\nconsole.log(chatSession.id);" response: "{\n \"id\": \"cksess_123\",\n \"object\": \"chatkit.session\",\n \"workflow\": {\n \"id\": \"workflow_alpha\",\n \"version\": \"1\"\n },\n \"scope\": {\n \"customer_id\": \"cust_456\"\n },\n \"max_requests_per_1_minute\": 30,\n \"ttl_seconds\": 900,\n \"status\": \"cancelled\",\n \"cancelled_at\": 1712345678\n}\n" tags: - Chatkit /chatkit/sessions: post: summary: Create a ChatKit session. operationId: CreateChatSessionMethod parameters: [] requestBody: content: application/json: schema: $ref: '#/components/schemas/CreateChatSessionBody' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/ChatSessionResource' x-oaiMeta: name: Create ChatKit session group: chatkit beta: true path: sessions/create object. examples: request: curl: "curl https://api.openai.com/v1/chatkit/sessions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n -d '{\n \"workflow\": {\n \"id\": \"workflow_alpha\",\n \"version\": \"2024-10-01\"\n },\n \"scope\": {\n \"project\": \"alpha\",\n \"environment\": \"staging\"\n },\n \"expires_after\": 1800,\n \"max_requests_per_1_minute\": 60,\n \"max_requests_per_session\": 500\n }'\n" javascript: 'import OpenAI from ''openai''; const client = new OpenAI(); const chatSession = await client.beta.chatkit.sessions.create({ user: ''user'', workflow: { id: ''id'' } }); console.log(chatSession.id); ' python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nchat_session = client.beta.chatkit.sessions.create(\n user=\"x\",\n workflow={\n \"id\": \"id\"\n },\n)\nprint(chat_session.id)" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tchatSession, err := client.Beta.ChatKit.Sessions.New(context.TODO(), openai.BetaChatKitSessionNewParams{\n\t\tUser: \"x\",\n\t\tWorkflow: openai.ChatSessionWorkflowParam{\n\t\t\tID: \"id\",\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", chatSession.ID)\n}\n" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") chat_session = openai.beta.chatkit.sessions.create(user: "x", workflow: {id: "id"}) puts(chat_session)' java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.sessions.SessionCreateParams;\nimport com.openai.models.beta.chatkit.threads.ChatSession;\nimport com.openai.models.beta.chatkit.threads.ChatSessionWorkflowParam;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n SessionCreateParams params = SessionCreateParams.builder()\n .user(\"x\")\n .workflow(ChatSessionWorkflowParam.builder()\n .id(\"id\")\n .build())\n .build();\n ChatSession chatSession = client.beta().chatkit().sessions().create(params);\n }\n}" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst chatSession = await client.beta.chatkit.sessions.create({\n user: 'x',\n workflow: { id: 'id' },\n});\n\nconsole.log(chatSession.id);" response: "{\n \"client_secret\": \"chatkit_token_123\",\n \"expires_at\": 1735689600,\n \"workflow\": {\n \"id\": \"workflow_alpha\",\n \"version\": \"2024-10-01\"\n },\n \"scope\": {\n \"project\": \"alpha\",\n \"environment\": \"staging\"\n },\n \"max_requests_per_1_minute\": 60,\n \"max_requests_per_session\": 500,\n \"status\": \"active\"\n}\n" tags: - Chatkit /chatkit/threads/{thread_id}/items: get: summary: List items that belong to a ChatKit thread. operationId: ListThreadItemsMethod parameters: - name: thread_id in: path description: Identifier of the ChatKit thread whose items are requested. required: true schema: example: cthr_123 type: string - name: limit in: query description: Maximum number of thread items to return. Defaults to 20. required: false schema: type: integer minimum: 0 maximum: 100 - name: order in: query description: Sort order for results by creation time. Defaults to `desc`. required: false schema: $ref: '#/components/schemas/OrderEnum' - name: after in: query description: List items created after this thread item ID. Defaults to null for the first page. required: false schema: description: List items created after this thread item ID. Defaults to null for the first page. type: string - name: before in: query description: List items created before this thread item ID. Defaults to null for the newest results. required: false schema: description: List items created before this thread item ID. Defaults to null for the newest results. type: string responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/ThreadItemListResource' x-oaiMeta: name: List ChatKit thread items group: chatkit beta: true path: threads/list-items for the specified thread. examples: request: curl: "curl \"https://api.openai.com/v1/chatkit/threads/cthr_abc123/items?limit=3\" \\\n -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n" javascript: "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\n// Automatically fetches more pages as needed.\nfor await (const thread of client.beta.chatkit.threads.listItems('cthr_123')) {\n console.log(thread);\n}\n" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\npage = client.beta.chatkit.threads.list_items(\n thread_id=\"cthr_123\",\n)\npage = page.data[0]\nprint(page)" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.ChatKit.Threads.ListItems(\n\t\tcontext.TODO(),\n\t\t\"cthr_123\",\n\t\topenai.BetaChatKitThreadListItemsParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") page = openai.beta.chatkit.threads.list_items("cthr_123") puts(page)' java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.threads.ThreadListItemsPage;\nimport com.openai.models.beta.chatkit.threads.ThreadListItemsParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n ThreadListItemsPage page = client.beta().chatkit().threads().listItems(\"cthr_123\");\n }\n}" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\n// Automatically fetches more pages as needed.\nfor await (const thread of client.beta.chatkit.threads.listItems('cthr_123')) {\n console.log(thread);\n}" response: "{\n \"data\": [\n {\n \"id\": \"cthi_user_001\",\n \"object\": \"chatkit.thread_item\",\n \"type\": \"user_message\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"I need help debugging an onboarding issue.\"\n }\n ],\n \"attachments\": []\n },\n {\n \"id\": \"cthi_assistant_002\",\n \"object\": \"chatkit.thread_item\",\n \"type\": \"assistant_message\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"Let's start by confirming the workflow version you deployed.\"\n }\n ]\n }\n ],\n \"has_more\": false,\n \"object\": \"list\"\n}\n" tags: - Chatkit /chatkit/threads/{thread_id}: get: summary: Retrieve a ChatKit thread by its identifier. operationId: GetThreadMethod parameters: - name: thread_id in: path description: Identifier of the ChatKit thread to retrieve. required: true schema: example: cthr_123 type: string responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/ThreadResource' x-oaiMeta: name: Retrieve ChatKit thread group: chatkit beta: true path: threads/retrieve examples: request: curl: "curl https://api.openai.com/v1/chatkit/threads/cthr_abc123 \\\n -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n" javascript: 'import OpenAI from ''openai''; const client = new OpenAI(); const chatkitThread = await client.beta.chatkit.threads.retrieve(''cthr_123''); console.log(chatkitThread.id); ' python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nchatkit_thread = client.beta.chatkit.threads.retrieve(\n \"cthr_123\",\n)\nprint(chatkit_thread.id)" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tchatkitThread, err := client.Beta.ChatKit.Threads.Get(context.TODO(), \"cthr_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", chatkitThread.ID)\n}\n" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") chatkit_thread = openai.beta.chatkit.threads.retrieve("cthr_123") puts(chatkit_thread)' java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.threads.ChatKitThread;\nimport com.openai.models.beta.chatkit.threads.ThreadRetrieveParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n ChatKitThread chatkitThread = client.beta().chatkit().threads().retrieve(\"cthr_123\");\n }\n}" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst chatkitThread = await client.beta.chatkit.threads.retrieve('cthr_123');\n\nconsole.log(chatkitThread.id);" response: "{\n \"id\": \"cthr_abc123\",\n \"object\": \"chatkit.thread\",\n \"title\": \"Customer escalation\",\n \"items\": {\n \"data\": [\n {\n \"id\": \"cthi_user_001\",\n \"object\": \"chatkit.thread_item\",\n \"type\": \"user_message\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"I need help debugging an onboarding issue.\"\n }\n ],\n \"attachments\": []\n },\n {\n \"id\": \"cthi_assistant_002\",\n \"object\": \"chatkit.thread_item\",\n \"type\": \"assistant_message\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"Let's start by confirming the workflow version you deployed.\"\n }\n ]\n }\n ],\n \"has_more\": false\n }\n}\n" tags: - Chatkit delete: summary: Delete a ChatKit thread along with its items and stored attachments. operationId: DeleteThreadMethod parameters: - name: thread_id in: path description: Identifier of the ChatKit thread to delete. required: true schema: example: cthr_123 type: string responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/DeletedThreadResource' x-oaiMeta: beta: true examples: response: '' request: javascript: 'import OpenAI from ''openai''; const client = new OpenAI(); const thread = await client.beta.chat_kit.threads.delete(''cthr_123''); console.log(thread.id); ' python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nthread = client.beta.chatkit.threads.delete(\n \"cthr_123\",\n)\nprint(thread.id)" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthread, err := client.Beta.ChatKit.Threads.Delete(context.TODO(), \"cthr_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") thread = openai.beta.chatkit.threads.delete("cthr_123") puts(thread)' java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.threads.ThreadDeleteParams;\nimport com.openai.models.beta.chatkit.threads.ThreadDeleteResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n ThreadDeleteResponse thread = client.beta().chatkit().threads().delete(\"cthr_123\");\n }\n}" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst thread = await client.beta.chatkit.threads.delete('cthr_123');\n\nconsole.log(thread.id);" name: Delete ChatKit thread group: chatkit path: threads/delete tags: - Chatkit /chatkit/threads: get: summary: List ChatKit threads with optional pagination and user filters. operationId: ListThreadsMethod parameters: - name: limit in: query description: Maximum number of thread items to return. Defaults to 20. required: false schema: type: integer minimum: 0 maximum: 100 - name: order in: query description: Sort order for results by creation time. Defaults to `desc`. required: false schema: $ref: '#/components/schemas/OrderEnum' - name: after in: query description: List items created after this thread item ID. Defaults to null for the first page. required: false schema: description: List items created after this thread item ID. Defaults to null for the first page. type: string - name: before in: query description: List items created before this thread item ID. Defaults to null for the newest results. required: false schema: description: List items created before this thread item ID. Defaults to null for the newest results. type: string - name: user in: query description: Filter threads that belong to this user identifier. Defaults to null to return all users. required: false schema: description: Filter threads that belong to this user identifier. Defaults to null to return all users. type: string minLength: 1 maxLength: 512 responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/ThreadListResource' x-oaiMeta: name: List ChatKit threads group: chatkit beta: true path: list-threads scope. examples: request: curl: "curl \"https://api.openai.com/v1/chatkit/threads?limit=2&order=desc\" \\\n -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n" javascript: "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\n// Automatically fetches more pages as needed.\nfor await (const chatkitThread of client.beta.chatkit.threads.list()) {\n console.log(chatkitThread.id);\n}\n" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\npage = client.beta.chatkit.threads.list()\npage = page.data[0]\nprint(page.id)" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.ChatKit.Threads.List(context.TODO(), openai.BetaChatKitThreadListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") page = openai.beta.chatkit.threads.list puts(page)' java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.threads.ThreadListPage;\nimport com.openai.models.beta.chatkit.threads.ThreadListParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n ThreadListPage page = client.beta().chatkit().threads().list();\n }\n}" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\n// Automatically fetches more pages as needed.\nfor await (const chatkitThread of client.beta.chatkit.threads.list()) {\n console.log(chatkitThread.id);\n}" response: "{\n \"data\": [\n {\n \"id\": \"cthr_abc123\",\n \"object\": \"chatkit.thread\",\n \"title\": \"Customer escalation\"\n },\n {\n \"id\": \"cthr_def456\",\n \"object\": \"chatkit.thread\",\n \"title\": \"Demo feedback\"\n }\n ],\n \"has_more\": false,\n \"object\": \"list\"\n}\n" tags: - Chatkit components: schemas: UserMessageItem: properties: id: type: string description: Identifier of the thread item. object: type: string enum: - chatkit.thread_item description: Type discriminator that is always `chatkit.thread_item`. default: chatkit.thread_item x-stainless-const: true created_at: type: integer format: unixtime description: Unix timestamp (in seconds) for when the item was created. thread_id: type: string description: Identifier of the parent thread. type: type: string enum: - chatkit.user_message default: chatkit.user_message x-stainless-const: true content: items: oneOf: - $ref: '#/components/schemas/UserMessageInputText' - $ref: '#/components/schemas/UserMessageQuotedText' description: Content blocks that comprise a user message. discriminator: propertyName: type type: array description: Ordered content elements supplied by the user. attachments: items: $ref: '#/components/schemas/Attachment' type: array description: Attachments associated with the user message. Defaults to an empty list. inference_options: anyOf: - $ref: '#/components/schemas/InferenceOptions' description: Inference overrides applied to the message. Defaults to null when unset. - type: 'null' type: object required: - id - object - created_at - thread_id - type - content - attachments - inference_options title: User Message Item description: User-authored messages within a thread. ChatkitWorkflowTracing: properties: enabled: type: boolean description: Indicates whether tracing is enabled. type: object required: - enabled title: Tracing Configuration description: Controls diagnostic tracing during the session. ThreadListResource: properties: object: type: string enum: - list description: The type of object returned, must be `list`. default: list x-stainless-const: true data: items: $ref: '#/components/schemas/ThreadResource' type: array description: A list of items first_id: anyOf: - type: string description: The ID of the first item in the list. - type: 'null' last_id: anyOf: - type: string description: The ID of the last item in the list. - type: 'null' has_more: type: boolean description: Whether there are more items available. type: object required: - object - data - first_id - last_id - has_more title: Threads description: A paginated list of ChatKit threads. ChatSessionFileUpload: properties: enabled: type: boolean description: Indicates if uploads are enabled for the session. max_file_size: anyOf: - type: integer description: Maximum upload size in megabytes. - type: 'null' max_files: anyOf: - type: integer description: Maximum number of uploads allowed during the session. - type: 'null' type: object required: - enabled - max_file_size - max_files title: File upload settings description: Upload permissions and limits applied to the session. WorkflowParam: properties: id: type: string description: Identifier for the workflow invoked by the session. version: type: string description: Specific workflow version to run. Defaults to the latest deployed version. state_variables: additionalProperties: oneOf: - type: string maxLength: 10485760 - type: integer - type: boolean - type: number type: object maxProperties: 64 description: 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. x-oaiTypeLabel: map tracing: $ref: '#/components/schemas/WorkflowTracingParam' description: Optional tracing overrides for the workflow invocation. When omitted, tracing is enabled by default. type: object required: - id title: Workflow settings description: Workflow reference and overrides applied to the chat session. ClientToolCallStatus: type: string enum: - in_progress - completed UrlAnnotation: properties: type: type: string enum: - url description: Type discriminator that is always `url` for this annotation. default: url x-stainless-const: true source: $ref: '#/components/schemas/UrlAnnotationSource' description: URL referenced by the annotation. type: object required: - type - source title: URL annotation description: Annotation that references a URL. ThreadResource: properties: id: type: string description: Identifier of the thread. object: type: string enum: - chatkit.thread description: Type discriminator that is always `chatkit.thread`. default: chatkit.thread x-stainless-const: true created_at: type: integer format: unixtime description: Unix timestamp (in seconds) for when the thread was created. title: anyOf: - type: string description: Optional human-readable title for the thread. Defaults to null when no title has been generated. - type: 'null' status: oneOf: - $ref: '#/components/schemas/ActiveStatus' - $ref: '#/components/schemas/LockedStatus' - $ref: '#/components/schemas/ClosedStatus' description: Current status for the thread. Defaults to `active` for newly created threads. discriminator: propertyName: type user: type: string description: Free-form string that identifies your end user who owns the thread. type: object required: - id - object - created_at - title - status - user title: The thread object description: Represents a ChatKit thread and its current status. example: id: cthr_def456 object: chatkit.thread created_at: 1712345600 title: Demo feedback status: type: active user: user_456 AssistantMessageItem: properties: id: type: string description: Identifier of the thread item. object: type: string enum: - chatkit.thread_item description: Type discriminator that is always `chatkit.thread_item`. default: chatkit.thread_item x-stainless-const: true created_at: type: integer format: unixtime description: Unix timestamp (in seconds) for when the item was created. thread_id: type: string description: Identifier of the parent thread. type: type: string enum: - chatkit.assistant_message description: Type discriminator that is always `chatkit.assistant_message`. default: chatkit.assistant_message x-stainless-const: true content: items: $ref: '#/components/schemas/ResponseOutputText' type: array description: Ordered assistant response segments. type: object required: - id - object - created_at - thread_id - type - content title: Assistant message description: Assistant-authored message within a thread. DeletedThreadResource: properties: id: type: string description: Identifier of the deleted thread. object: type: string enum: - chatkit.thread.deleted description: Type discriminator that is always `chatkit.thread.deleted`. default: chatkit.thread.deleted x-stainless-const: true deleted: type: boolean description: Indicates that the thread has been deleted. type: object required: - id - object - deleted title: Deleted thread description: Confirmation payload returned after deleting a thread. ToolChoice: properties: id: type: string description: Identifier of the requested tool. type: object required: - id title: Tool choice description: Tool selection that the assistant should honor when executing the item. ChatSessionRateLimits: properties: max_requests_per_1_minute: type: integer description: Maximum allowed requests per one-minute window. type: object required: - max_requests_per_1_minute title: Rate limits description: Active per-minute request limit for the session. UserMessageInputText: properties: type: type: string enum: - input_text description: Type discriminator that is always `input_text`. default: input_text x-stainless-const: true text: type: string description: Plain-text content supplied by the user. type: object required: - type - text title: User message input description: Text block that a user contributed to the thread. ChatkitConfigurationParam: properties: automatic_thread_titling: $ref: '#/components/schemas/AutomaticThreadTitlingParam' description: Configuration for automatic thread titling. When omitted, automatic thread titling is enabled by default. file_upload: $ref: '#/components/schemas/FileUploadParam' description: Configuration for upload enablement and limits. When omitted, uploads are disabled by default (max_files 10, max_file_size 512 MB). history: $ref: '#/components/schemas/HistoryParam' description: Configuration for chat history retention. When omitted, history is enabled by default with no limit on recent_threads (null). type: object required: [] title: ChatKit configuration overrides description: Optional per-session configuration settings for ChatKit behavior. RateLimitsParam: properties: max_requests_per_1_minute: type: integer minimum: 1 description: Maximum number of requests allowed per minute for the session. Defaults to 10. type: object required: [] title: Rate limit overrides description: Controls request rate limits for the session. ChatSessionStatus: type: string enum: - active - expired - cancelled UrlAnnotationSource: properties: type: type: string enum: - url description: Type discriminator that is always `url`. default: url x-stainless-const: true url: type: string format: uri description: URL referenced by the annotation. type: object required: - type - url title: URL annotation source description: URL backing an annotation entry. TaskItem: properties: id: type: string description: Identifier of the thread item. object: type: string enum: - chatkit.thread_item description: Type discriminator that is always `chatkit.thread_item`. default: chatkit.thread_item x-stainless-const: true created_at: type: integer format: unixtime description: Unix timestamp (in seconds) for when the item was created. thread_id: type: string description: Identifier of the parent thread. type: type: string enum: - chatkit.task description: Type discriminator that is always `chatkit.task`. default: chatkit.task x-stainless-const: true task_type: $ref: '#/components/schemas/TaskType' description: Subtype for the task. heading: anyOf: - type: string description: Optional heading for the task. Defaults to null when not provided. - type: 'null' summary: anyOf: - type: string description: Optional summary that describes the task. Defaults to null when omitted. - type: 'null' type: object required: - id - object - created_at - thread_id - type - task_type - heading - summary title: Task item description: Task emitted by the workflow to show progress and status updates. CreateChatSessionBody: properties: workflow: $ref: '#/components/schemas/WorkflowParam' description: Workflow that powers the session. user: type: string minLength: 1 description: A free-form string that identifies your end user; ensures this Session can access other objects that have the same `user` scope. expires_after: $ref: '#/components/schemas/ExpiresAfterParam' description: Optional override for session expiration timing in seconds from creation. Defaults to 10 minutes. rate_limits: $ref: '#/components/schemas/RateLimitsParam' description: Optional override for per-minute request limits. When omitted, defaults to 10. chatkit_configuration: $ref: '#/components/schemas/ChatkitConfigurationParam' description: Optional overrides for ChatKit runtime configuration features type: object required: - workflow - user title: Create chat session request description: Parameters for provisioning a new ChatKit session. ChatkitWorkflow: properties: id: type: string description: Identifier of the workflow backing the session. version: anyOf: - type: string description: Specific workflow version used for the session. Defaults to null when using the latest deployment. - type: 'null' state_variables: anyOf: - additionalProperties: oneOf: - type: string - type: integer - type: boolean - type: number type: object description: State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided. x-oaiTypeLabel: map - type: 'null' tracing: $ref: '#/components/schemas/ChatkitWorkflowTracing' description: Tracing settings applied to the workflow. type: object required: - id - version - state_variables - tracing title: Workflow description: Workflow metadata and state returned for the session. FileAnnotationSource: properties: type: type: string enum: - file description: Type discriminator that is always `file`. default: file x-stainless-const: true filename: type: string description: Filename referenced by the annotation. type: object required: - type - filename title: File annotation source description: Attachment source referenced by an annotation. TaskGroupTask: properties: type: $ref: '#/components/schemas/TaskType' description: Subtype for the grouped task. heading: anyOf: - type: string description: Optional heading for the grouped task. Defaults to null when not provided. - type: 'null' summary: anyOf: - type: string description: Optional summary that describes the grouped task. Defaults to null when omitted. - type: 'null' type: object required: - type - heading - summary title: Task group task description: Task entry that appears within a TaskGroup. ClientToolCallItem: properties: id: type: string description: Identifier of the thread item. object: type: string enum: - chatkit.thread_item description: Type discriminator that is always `chatkit.thread_item`. default: chatkit.thread_item x-stainless-const: true created_at: type: integer format: unixtime description: Unix timestamp (in seconds) for when the item was created. thread_id: type: string description: Identifier of the parent thread. type: type: string enum: - chatkit.client_tool_call description: Type discriminator that is always `chatkit.client_tool_call`. default: chatkit.client_tool_call x-stainless-const: true status: $ref: '#/components/schemas/ClientToolCallStatus' description: Execution status for the tool call. call_id: type: string description: Identifier for the client tool call. name: type: string description: Tool name that was invoked. arguments: type: string description: JSON-encoded arguments that were sent to the tool. output: anyOf: - type: string description: JSON-encoded output captured from the tool. Defaults to null while execution is in progress. - type: 'null' type: object required: - id - object - created_at - thread_id - type - status - call_id - name - arguments - output title: Client tool call description: Record of a client side tool invocation initiated by the assistant. Attachment: properties: type: $ref: '#/components/schemas/AttachmentType' description: Attachment discriminator. id: type: string description: Identifier for the attachment. name: type: string description: Original display name for the attachment. mime_type: type: string description: MIME type of the attachment. preview_url: anyOf: - type: string format: uri description: Preview URL for rendering the attachment inline. - type: 'null' type: object required: - type - id - name - mime_type - preview_url title: Attachment description: Attachment metadata included on thread items. TaskType: type: string enum: - custom - thought InferenceOptions: properties: tool_choice: anyOf: - $ref: '#/components/schemas/ToolChoice' description: Preferred tool to invoke. Defaults to null when ChatKit should auto-select. - type: 'null' model: anyOf: - type: string description: Model name that generated the response. Defaults to null when using the session default. - type: 'null' type: object required: - tool_choice - model title: Inference options description: Model and tool overrides applied when generating the assistant response. UserMessageQuotedText: properties: type: type: string enum: - quoted_text description: Type discriminator that is always `quoted_text`. default: quoted_text x-stainless-const: true text: type: string description: Quoted text content. type: object required: - type - text title: User message quoted text description: Quoted snippet that the user referenced in their message. TaskGroupItem: properties: id: type: string description: Identifier of the thread item. object: type: string enum: - chatkit.thread_item description: Type discriminator that is always `chatkit.thread_item`. default: chatkit.thread_item x-stainless-const: true created_at: type: integer format: unixtime description: Unix timestamp (in seconds) for when the item was created. thread_id: type: string description: Identifier of the parent thread. type: type: string enum: - chatkit.task_group description: Type discriminator that is always `chatkit.task_group`. default: chatkit.task_group x-stainless-const: true tasks: items: $ref: '#/components/schemas/TaskGroupTask' type: array description: Tasks included in the group. type: object required: - id - object - created_at - thread_id - type - tasks title: Task group description: Collection of workflow tasks grouped together in the thread. ThreadItemListResource: properties: object: type: string enum: - list description: The type of object returned, must be `list`. default: list x-stainless-const: true data: items: $ref: '#/components/schemas/ThreadItem' type: array description: A list of items first_id: anyOf: - type: string description: The ID of the first item in the list. - type: 'null' last_id: anyOf: - type: string description: The ID of the last item in the list. - type: 'null' has_more: type: boolean description: Whether there are more items available. type: object required: - object - data - first_id - last_id - has_more title: Thread Items description: A paginated list of thread items rendered for the ChatKit API. ClosedStatus: properties: type: type: string enum: - closed description: Status discriminator that is always `closed`. default: closed x-stainless-const: true reason: anyOf: - type: string description: Reason that the thread was closed. Defaults to null when no reason is recorded. - type: 'null' type: object required: - type - reason title: Closed thread status description: Indicates that a thread has been closed. ChatSessionResource: properties: id: type: string description: Identifier for the ChatKit session. object: type: string enum: - chatkit.session description: Type discriminator that is always `chatkit.session`. default: chatkit.session x-stainless-const: true expires_at: type: integer format: unixtime description: Unix timestamp (in seconds) for when the session expires. client_secret: type: string description: Ephemeral client secret that authenticates session requests. workflow: $ref: '#/components/schemas/ChatkitWorkflow' description: Workflow metadata for the session. user: type: string description: User identifier associated with the session. rate_limits: $ref: '#/components/schemas/ChatSessionRateLimits' description: Resolved rate limit values. max_requests_per_1_minute: type: integer description: Convenience copy of the per-minute request limit. status: $ref: '#/components/schemas/ChatSessionStatus' description: Current lifecycle state of the session. chatkit_configuration: $ref: '#/components/schemas/ChatSessionChatkitConfiguration' description: Resolved ChatKit feature configuration for the session. type: object required: - id - object - expires_at - client_secret - workflow - user - rate_limits - max_requests_per_1_minute - status - chatkit_configuration title: The chat session object description: Represents a ChatKit session and its resolved configuration. example: id: cksess_123 object: chatkit.session client_secret: ek_token_123 expires_at: 1712349876 workflow: id: workflow_alpha version: 2024-10-01 00:00:00+00:00 user: user_789 rate_limits: max_requests_per_1_minute: 60 max_requests_per_1_minute: 60 status: cancelled chatkit_configuration: automatic_thread_titling: enabled: true file_upload: enabled: true max_file_size: 16 max_files: 20 history: enabled: true recent_threads: 10 ExpiresAfterParam: properties: anchor: type: string enum: - created_at description: Base timestamp used to calculate expiration. Currently fixed to `created_at`. default: created_at x-stainless-const: true seconds: type: integer maximum: 600 minimum: 1 format: int64 description: Number of seconds after the anchor when the session expires. type: object required: - anchor - seconds title: Expiration overrides description: Controls when the session expires relative to an anchor timestamp. HistoryParam: properties: enabled: type: boolean description: Enables chat users to access previous ChatKit threads. Defaults to true. recent_threads: type: integer minimum: 1 description: Number of recent ChatKit threads users have access to. Defaults to unlimited when unset. type: object required: [] title: Chat history configuration description: Controls how much historical context is retained for the session. LockedStatus: properties: type: type: string enum: - locked description: Status discriminator that is always `locked`. default: locked x-stainless-const: true reason: anyOf: - type: string description: Reason that the thread was locked. Defaults to null when no reason is recorded. - type: 'null' type: object required: - type - reason title: Locked thread status description: Indicates that a thread is locked and cannot accept new input. ThreadItem: oneOf: - $ref: '#/components/schemas/UserMessageItem' - $ref: '#/components/schemas/AssistantMessageItem' - $ref: '#/components/schemas/WidgetMessageItem' - $ref: '#/components/schemas/ClientToolCallItem' - $ref: '#/components/schemas/TaskItem' - $ref: '#/components/schemas/TaskGroupItem' title: The thread item discriminator: propertyName: type FileUploadParam: properties: enabled: type: boolean description: Enable uploads for this session. Defaults to false. max_file_size: type: integer maximum: 512 minimum: 1 description: Maximum size in megabytes for each uploaded file. Defaults to 512 MB, which is the maximum allowable size. max_files: type: integer minimum: 1 description: Maximum number of files that can be uploaded to the session. Defaults to 10. type: object required: [] title: File upload configuration description: Controls whether users can upload files. ActiveStatus: properties: type: type: string enum: - active description: Status discriminator that is always `active`. default: active x-stainless-const: true type: object required: - type title: Active thread status description: Indicates that a thread is active. FileAnnotation: properties: type: type: string enum: - file description: Type discriminator that is always `file` for this annotation. default: file x-stainless-const: true source: $ref: '#/components/schemas/FileAnnotationSource' description: File attachment referenced by the annotation. type: object required: - type - source title: File annotation description: Annotation that references an uploaded file. OrderEnum: type: string enum: - asc - desc WorkflowTracingParam: properties: enabled: type: boolean description: Whether tracing is enabled during the session. Defaults to true. type: object required: [] title: Tracing Configuration description: Controls diagnostic tracing during the session. AttachmentType: type: string enum: - image - file ChatSessionHistory: properties: enabled: type: boolean description: Indicates if chat history is persisted for the session. recent_threads: anyOf: - type: integer description: Number of prior threads surfaced in history views. Defaults to null when all history is retained. - type: 'null' type: object required: - enabled - recent_threads title: History settings description: History retention preferences returned for the session. ResponseOutputText: properties: type: type: string enum: - output_text description: Type discriminator that is always `output_text`. default: output_text x-stainless-const: true text: type: string description: Assistant generated text. annotations: items: oneOf: - $ref: '#/components/schemas/FileAnnotation' - $ref: '#/components/schemas/UrlAnnotation' description: Annotation object describing a cited source. discriminator: propertyName: type type: array description: Ordered list of annotations attached to the response text. type: object required: - type - text - annotations title: Assistant message content description: Assistant response text accompanied by optional annotations. ChatSessionAutomaticThreadTitling: properties: enabled: type: boolean description: Whether automatic thread titling is enabled. type: object required: - enabled title: Automatic thread titling description: Automatic thread title preferences for the session. ChatSessionChatkitConfiguration: properties: automatic_thread_titling: $ref: '#/components/schemas/ChatSessionAutomaticThreadTitling' description: Automatic thread titling preferences. file_upload: $ref: '#/components/schemas/ChatSessionFileUpload' description: Upload settings for the session. history: $ref: '#/components/schemas/ChatSessionHistory' description: History retention configuration. type: object required: - automatic_thread_titling - file_upload - history title: ChatKit configuration description: ChatKit configuration for the session. AutomaticThreadTitlingParam: properties: enabled: type: boolean description: Enable automatic thread title generation. Defaults to true. type: object required: [] title: Automatic thread titling configuration description: Controls whether ChatKit automatically generates thread titles. WidgetMessageItem: properties: id: type: string description: Identifier of the thread item. object: type: string enum: - chatkit.thread_item description: Type discriminator that is always `chatkit.thread_item`. default: chatkit.thread_item x-stainless-const: true created_at: type: integer format: unixtime description: Unix timestamp (in seconds) for when the item was created. thread_id: type: string description: Identifier of the parent thread. type: type: string enum: - chatkit.widget description: Type discriminator that is always `chatkit.widget`. default: chatkit.widget x-stainless-const: true widget: type: string description: Serialized widget payload rendered in the UI. type: object required: - id - object - created_at - thread_id - type - widget title: Widget message description: Thread item that renders a widget payload. securitySchemes: ApiKeyAuth: type: http scheme: bearer x-oaiMeta: groups: - id: audio title: Audio description: 'Learn how to turn audio into text or text into audio. Related guide: [Speech to text](/docs/guides/speech-to-text) ' sections: - type: endpoint key: createSpeech path: createSpeech - type: endpoint key: createTranscription path: createTranscription - type: endpoint key: createTranslation path: createTranslation - id: chat title: Chat description: 'Given a list of messages comprising a conversation, the model will return a response. Related guide: [Chat Completions](/docs/guides/text-generation) ' sections: - type: endpoint key: createChatCompletion path: create - type: object key: CreateChatCompletionResponse path: object - type: object key: CreateChatCompletionStreamResponse path: streaming - id: embeddings title: Embeddings description: 'Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms. Related guide: [Embeddings](/docs/guides/embeddings) ' sections: - type: endpoint key: createEmbedding path: create - type: object key: Embedding path: object - id: fine-tuning title: Fine-tuning description: 'Manage fine-tuning jobs to tailor a model to your specific training data. Related guide: [Fine-tune models](/docs/guides/fine-tuning) ' sections: - type: endpoint key: createFineTuningJob path: create - type: endpoint key: listPaginatedFineTuningJobs path: list - type: endpoint key: listFineTuningEvents path: list-events - type: endpoint key: retrieveFineTuningJob path: retrieve - type: endpoint key: cancelFineTuningJob path: cancel - type: object key: FineTuningJob path: object - type: object key: FineTuningJobEvent path: event-object - id: files title: Files description: 'Files are used to upload documents that can be used with features like [Assistants](/docs/api-reference/assistants) and [Fine-tuning](/docs/api-reference/fine-tuning). ' sections: - type: endpoint key: createFile path: create - type: endpoint key: listFiles path: list - type: endpoint key: retrieveFile path: retrieve - type: endpoint key: deleteFile path: delete - type: endpoint key: downloadFile path: retrieve-contents - type: object key: OpenAIFile path: object - id: images title: Images description: 'Given a prompt and/or an input image, the model will generate a new image. Related guide: [Image generation](/docs/guides/images) ' sections: - type: endpoint key: createImage path: create - type: endpoint key: createImageEdit path: createEdit - type: endpoint key: createImageVariation path: createVariation - type: object key: Image path: object - id: models title: Models description: 'List and describe the various models available in the API. You can refer to the [Models](/docs/models) documentation to understand what models are available and the differences between them. ' sections: - type: endpoint key: listModels path: list - type: endpoint key: retrieveModel path: retrieve - type: endpoint key: deleteModel path: delete - type: object key: Model path: object - id: moderations title: Moderations description: 'Given a input text, outputs if the model classifies it as violating OpenAI''s content policy. Related guide: [Moderations](/docs/guides/moderation) ' sections: - type: endpoint key: createModeration path: create - type: object key: CreateModerationResponse path: object - id: assistants title: Assistants beta: true description: 'Build assistants that can call models and use tools to perform tasks. [Get started with the Assistants API](/docs/assistants) ' sections: - type: endpoint key: createAssistant path: createAssistant - type: endpoint key: createAssistantFile path: createAssistantFile - type: endpoint key: listAssistants path: listAssistants - type: endpoint key: listAssistantFiles path: listAssistantFiles - type: endpoint key: getAssistant path: getAssistant - type: endpoint key: getAssistantFile path: getAssistantFile - type: endpoint key: modifyAssistant path: modifyAssistant - type: endpoint key: deleteAssistant path: deleteAssistant - type: endpoint key: deleteAssistantFile path: deleteAssistantFile - type: object key: AssistantObject path: object - type: object key: AssistantFileObject path: file-object - id: threads title: Threads beta: true description: 'Create threads that assistants can interact with. Related guide: [Assistants](/docs/assistants/overview) ' sections: - type: endpoint key: createThread path: createThread - type: endpoint key: getThread path: getThread - type: endpoint key: modifyThread path: modifyThread - type: endpoint key: deleteThread path: deleteThread - type: object key: ThreadObject path: object - id: messages title: Messages beta: true description: 'Create messages within threads Related guide: [Assistants](/docs/assistants/overview) ' sections: - type: endpoint key: createMessage path: createMessage - type: endpoint key: listMessages path: listMessages - type: endpoint key: listMessageFiles path: listMessageFiles - type: endpoint key: getMessage path: getMessage - type: endpoint key: getMessageFile path: getMessageFile - type: endpoint key: modifyMessage path: modifyMessage - type: object key: MessageObject path: object - type: object key: MessageFileObject path: file-object - id: runs title: Runs beta: true description: 'Represents an execution run on a thread. Related guide: [Assistants](/docs/assistants/overview) ' sections: - type: endpoint key: createRun path: createRun - type: endpoint key: createThreadAndRun path: createThreadAndRun - type: endpoint key: listRuns path: listRuns - type: endpoint key: listRunSteps path: listRunSteps - type: endpoint key: getRun path: getRun - type: endpoint key: getRunStep path: getRunStep - type: endpoint key: modifyRun path: modifyRun - type: endpoint key: submitToolOuputsToRun path: submitToolOutputs - type: endpoint key: cancelRun path: cancelRun - type: object key: RunObject path: object - type: object key: RunStepObject path: step-object - id: completions title: Completions legacy: true description: 'Given a prompt, the model will return one or more predicted completions along with the probabilities of alternative tokens at each position. Most developer should use our [Chat Completions API](/docs/guides/text-generation/text-generation-models) to leverage our best and newest models. Most models that support the legacy Completions endpoint [will be shut off on January 4th, 2024](/docs/deprecations/2023-07-06-gpt-and-embeddings). ' sections: - type: endpoint key: createCompletion path: create - type: object key: CreateCompletionResponse path: object