OpenAI Chatkit API

The Chatkit API from OpenAI — 5 operation(s) for chatkit.

Documentation

📖
Documentation
https://platform.openai.com/docs/assistants/overview
📖
Documentation
https://platform.openai.com/docs/api-reference/assistants
📖
Documentation
https://platform.openai.com/docs/guides/text-to-speech
📖
Documentation
https://platform.openai.com/docs/api-reference/audio
📖
Documentation
https://platform.openai.com/docs/guides/speech-to-text
📖
Documentation
https://developers.openai.com/api/docs/guides/audio/
📖
Documentation
https://developers.openai.com/api/docs/guides/voice-agents/
📖
Documentation
https://platform.openai.com/docs/api-reference/chat
📖
Documentation
https://platform.openai.com/docs/guides/embeddings
📖
Documentation
https://platform.openai.com/docs/api-reference/embeddings
📖
Documentation
https://platform.openai.com/docs/api-reference/files
📖
Documentation
https://platform.openai.com/docs/guides/fine-tuning
📖
Documentation
https://platform.openai.com/docs/api-reference/fine-tuning
📖
Documentation
https://platform.openai.com/docs/guides/images
📖
Documentation
https://platform.openai.com/docs/api-reference/images
📖
Documentation
https://platform.openai.com/docs/guides/image-generation
📖
Documentation
https://platform.openai.com/docs/guides/images-vision
📖
Documentation
https://platform.openai.com/docs/models
📖
Documentation
https://platform.openai.com/docs/api-reference/models
📖
Documentation
https://platform.openai.com/docs/assistants/how-it-works/managing-threads-and-messages
📖
Documentation
https://platform.openai.com/docs/api-reference/threads
📖
Documentation
https://platform.openai.com/docs/api-reference/completions

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

openai-chatkit-api-openapi.yml Raw ↑
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

# --- truncated at 32 KB (65 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/openai/refs/heads/main/openapi/openai-chatkit-api-openapi.yml