MCPcopy
hub / github.com/openai/chatkit-js

github.com/openai/chatkit-js @main sqlite

repository ↗ · DeepWiki ↗
26 symbols 59 edges 13 files 11 documented · 42%
README

ChatKit is a batteries-included framework for building high-quality, AI-powered chat experiences. It’s designed for developers who want to add advanced conversational intelligence to their apps fast—with minimal setup and no reinventing the wheel. ChatKit delivers a complete, production-ready chat interface out of the box.

Key features include:

  • Deep UI customization so that ChatKit feels like a first-class part of your app
  • Built-in response streaming for interactive, natural conversations
  • Tool and workflow integration for visualizing agentic actions and chain-of-thought reasoning
  • Rich interactive widgets rendered directly inside the chat
  • Attachment handling with support for file and image uploads
  • Thread and message management for organizing complex conversations
  • Source annotations and entity tagging for transparency and references

Simply drop the ChatKit component into your app, configure a few options, and you're good to go.

What makes ChatKit different?

ChatKit is a framework-agnostic, drop-in chat solution. You don’t need to build custom UIs, manage low-level chat state, or patch together various features yourself. Just add the ChatKit component, give it a client token, and customize the chat experience as needed, no extra work needed.

Quickstart

  1. Generate a client token on your server.

```python from fastapi import FastAPI from pydantic import BaseModel from openai import OpenAI import os

app = FastAPI() openai = OpenAI(api_key=os.environ["OPENAI_API_KEY"])

@app.post("/api/chatkit/session") def create_chatkit_session(): session = openai.chatkit.sessions.create({ # ... }) return { client_secret: session.client_secret } ```

  1. Install the React bindings

bash npm install @openai/chatkit-react

  1. Add the ChatKit JS script to your page

```html

```

  1. Render ChatKit

```tsx import { ChatKit, useChatKit } from '@openai/chatkit-react';

export function MyChat() { const { control } = useChatKit({ api: { async getClientSecret(existing) { if (existing) { // implement session refresh }

       const res = await fetch('/api/chatkit/session', {
         method: 'POST',
         headers: {
           'Content-Type': 'application/json',
         },
       });
       const { client_secret } = await res.json();
       return client_secret;
     },
   },
 });

 return <ChatKit control={control} className="h-[600px] w-[320px]" />;

} ```

See working examples

  • Starter app - Clone a repo to start with a fully working template
  • Samples - See working examples of ChatKit and get inspired

License

This project is licensed under the Apache License 2.0.

Extension points exported contracts — how you extend this code

ChatKitProps (Interface)
(no doc)
packages/chatkit-react/src/ChatKit.tsx
HTMLElementTagNameMap (Interface)
(no doc)
packages/chatkit/types/dom-augment.d.ts
IntrinsicElements (Interface)
(no doc)
packages/chatkit-react/src/ChatKit.tsx
IntrinsicElements (Interface)
(no doc)
packages/chatkit/types/dom-augment.d.ts
OpenAIChatKit (Interface)
(no doc)
packages/chatkit/types/index.d.ts

Core symbols most depended-on inside this repo

deepEqualIgnoringFns
called by 36
packages/chatkit-react/src/useStableOptions.ts
withLatestFunctionWrappers
called by 6
packages/chatkit-react/src/useStableOptions.ts
isPlainObjectOrArray
called by 2
packages/chatkit-react/src/useStableOptions.ts
setOptions
called by 2
packages/chatkit/types/index.d.ts
getByPath
called by 1
packages/chatkit-react/src/useStableOptions.ts
wrap
called by 1
packages/chatkit-react/src/useStableOptions.ts
visit
called by 1
packages/chatkit-react/src/useStableOptions.ts
useStableOptions
called by 1
packages/chatkit-react/src/useStableOptions.ts

Shape

Method 11
Function 10
Interface 5

Languages

TypeScript100%

Modules by API surface

packages/chatkit/types/index.d.ts12 symbols
packages/chatkit-react/src/useStableOptions.ts7 symbols
packages/chatkit/types/dom-augment.d.ts2 symbols
packages/chatkit-react/src/useStableOptions.test.ts2 symbols
packages/chatkit-react/src/ChatKit.tsx2 symbols
packages/chatkit-react/src/useChatKit.ts1 symbols

Dependencies from manifests, versioned

@astrojs/starlight0.35.2 · 1×
@astrojs/starlight-tailwind4.0.1 · 1×
@changesets/cli2.27.10 · 1×
@eslint/js9.35.0 · 1×
@openai/chatkitworkspace:* · 1×
@tailwindcss/vite4.0.17 · 1×
@types/react18.3.0 · 1×
@typescript-eslint/eslint-plugin8.44.0 · 1×
@typescript-eslint/parser8.44.0 · 1×
astro5.13.7 · 1×
eslint9.35.0 · 1×
eslint-config-prettier10.1.8 · 1×

For agents

$ claude mcp add chatkit-js \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact