Skip to content

Turnspan API Reference

What you'll find here:

  • Core server API: chatkit.server – ChatKitServer and related helpers for receiving messages, streaming responses, and wiring up tools and widgets.
  • Actions: chatkit.actions – Action and ActionConfig for widget callbacks.
  • FastAPI adapter: chatkit.fastapi – HTTP request handling and disconnect cleanup for the optional fastapi extra.
  • Protocol: chatkit.protocol – JSON request parsing and encoding for transport adapters.
  • Turns: chatkit.turns – typed triggers, request context, and response outcomes.
  • Store integration: chatkit.store – separate interfaces for threads and items, attachment metadata, and attachment file operations.
  • Store checks: chatkit.store_checks – contract checks for app-owned thread stores.
  • Agents: chatkit.agents streams provider output. chatkit.agent_input converts saved history into model input.
  • Data models: chatkit.models defines threads, items, and attachments.
  • Requests and events: chatkit.requests describes browser operations. chatkit.events defines streamed updates.
  • Errors: chatkit.errors – structured error types your ChatKit integration can raise so ChatKit can emit consistent ErrorEvents to the client.
  • Widgets: chatkit.widgets provides typed builders. chatkit.widget_models owns the JSON tree, chatkit.widget_stream streams updates, and chatkit.templates loads .widget files with the templates extra.
  • Icons. chatkit.icons defines the icon names accepted by widgets and progress events.