openai-chatkit-backend-python

Build a self-hosted Python ChatKit backend connecting to the Agents SDK.

1|Updated Feb 8, 2026
One-click install
npx skills add https://github.com/Mehakanis/Q4_todo_app --skill openai-chatkit-backend-python-mehakanis
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: openai-chatkit-backend-python
Source: https://github.com/Mehakanis/Q4_todo_app/tree/main/.claude/skills/openai-chatkit-backend-python
Command: npx skills add https://github.com/Mehakanis/Q4_todo_app --skill openai-chatkit-backend-python-mehakanis

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Design and implement a self-hosted Python backend for ChatKit that connects a UI to the OpenAI Agents SDK, enabling full control over hosting, auth, streaming, and widget/tool integration.

Core Features & Use Cases

  • Self-hosted ChatKit backend in Python with FastAPI (or similar) integration.
  • Unified model factory via create_model() to switch between OpenAI and Gemini providers.
  • Streaming responses and widgets via Runner.run_streamed() and stream_agent_response(), with tool and client-tool support.
  • Widget rendering and client-tool orchestration using the ChatKit widgets API.
  • Secure authentication, domain allowlists, and pluggable Store/FileStore contracts for persistence.

Quick Start

Set up a minimal FastAPI backend exposing /chatkit/api, authenticate requests, wire up create_model(), and stream ChatKit events using the Agents SDK.

Frequently Asked Questions about openai-chatkit-backend-python

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a self-hosted Python backend for ChatKit?

Build a self-hosted ChatKit backend using FastAPI or Django to connect your UI to the OpenAI Agents SDK. This provides full control over hosting, authentication, streaming, and tool integration while running on your own infrastructure.

How does streaming work with the Agents SDK and ChatKit?

Streaming with the Agents SDK uses Runner.run_streamed() and stream_agent_response() helpers to stream ChatKit events. This enables production-grade real-time output of agent responses and widget rendering directly to the client UI.

Can I use FastAPI with the OpenAI Agents SDK for ChatKit?

Yes, FastAPI integrates directly with the ChatKit backend to expose /chatkit/api endpoints. You can also use Django or similar Python frameworks to authenticate requests and wire up the model factory for agent responses.

How do I switch between OpenAI and Gemini models in a Python backend?

Switch between OpenAI and Gemini providers using the unified create_model() factory. This single model factory enforces consistent provider switching within your self-hosted ChatKit backend without changing core application logic.

What security features does a self-hosted ChatKit backend support?

A self-hosted ChatKit backend supports secure authentication and domain allowlists to control access. It also implements pluggable Store and FileStore contracts for secure data persistence and file management operations.

What is the best way to render widgets from agent outputs in ChatKit?

Render widgets by using the ChatKit widgets API for client-tool orchestration alongside the Agents SDK. This approach coordinates tool and client-tool support to dynamically display interactive components during streamed responses.