{"library":"openai-chatkit","title":"OpenAI ChatKit (Python SDK)","description":"OpenAI ChatKit is a Python SDK designed for building custom backend servers for OpenAI's ChatKit, enabling developers to integrate advanced AI-powered chat experiences into their applications. It is a key component of the broader OpenAI AgentKit suite, facilitating the creation of conversational AI agents with features like response streaming, tool invocation, and thread management. The library is currently at version 1.6.3 and is actively maintained, with recent updates suggesting ongoing development and integration with OpenAI's evolving agent capabilities.","language":"python","status":"active","last_verified":"Fri May 15","install":{"commands":["pip install openai-chatkit"],"cli":null},"imports":["from openai_chatkit.server import ChatKitServer","from openai.lib.chatkit import Agent","client.beta.chatkit.sessions.create(...)"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nfrom fastapi import FastAPI, Request\nfrom openai import OpenAI\nfrom openai_chatkit.server import ChatKitServer, UserMessageItem\nfrom openai.lib.chatkit import Agent\n\napp = FastAPI()\nopenai_client = OpenAI(api_key=os.environ.get('OPENAI_API_KEY', ''))\n\n# Define your AI agent\nassistant_agent = Agent(\n    model=\"gpt-4o\",\n    name=\"Assistant\",\n    instructions=\"You are a helpful assistant.\"\n)\n\n# Implement your ChatKit server\nclass MyChatKitServer(ChatKitServer):\n    def __init__(self):\n        super().__init__()\n        self.agent = assistant_agent\n\n    async def respond(\n        self, thread_id: str, input: UserMessageItem, request: Request\n    ):\n        # Example: Process user input with your agent\n        # In a real application, you would manage state and agent context here\n        response_content = f\"Echoing: {input.text}\"\n        yield {\"type\": \"text\", \"text\": response_content}\n\nchatkit_server = MyChatKitServer()\n\n@app.post(\"/api/chatkit/session\")\nasync def create_chat_session(request: Request):\n    # In a real app, authenticate the user and provide a unique user_id\n    user_id = \"user_123\"\n    # Workflow ID would come from your OpenAI Agent Builder workflow\n    workflow_id = os.environ.get('CHATKIT_WORKFLOW_ID', 'wf-YOUR_WORKFLOW_ID')\n\n    # The client secret should be generated on the server-side only\n    session = openai_client.beta.chatkit.sessions.create(\n        workflow_id=workflow_id,\n        user_id=user_id\n    )\n    return {\"client_secret\": session.client_secret}\n\n@app.post(\"/api/chatkit/respond\")\nasync def chatkit_respond(request: Request):\n    return await chatkit_server.handle_request(request)","lang":"python","description":"This quickstart demonstrates setting up a basic FastAPI backend that uses `openai-chatkit` to handle chat interactions. It includes creating a ChatKit session (which provides a client secret for frontend authentication) and a response endpoint where your defined AI agent processes user messages. Remember to replace placeholder IDs and ensure your `OPENAI_API_KEY` and `CHATKIT_WORKFLOW_ID` are set as environment variables. A frontend (e.g., using `@openai/chatkit-react`) would then connect to these endpoints.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"0.0.1","pypi_latest":"1.6.4","is_stale":true,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":7.5,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"openai-chatkit","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"88.4M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"openai-chatkit","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":10.6,"import_time_s":null,"mem_mb":null,"disk_size":"87M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"openai-chatkit","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"97.0M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"openai-chatkit","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":9.2,"import_time_s":null,"mem_mb":null,"disk_size":"96M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"openai-chatkit","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"87.2M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"openai-chatkit","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":8,"import_time_s":null,"mem_mb":null,"disk_size":"86M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"openai-chatkit","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"87.1M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"openai-chatkit","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":8,"import_time_s":null,"mem_mb":null,"disk_size":"86M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"openai-chatkit","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"17.3M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"openai-chatkit","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.7,"import_time_s":null,"mem_mb":null,"disk_size":"18M"}]}}