Introduction

What Chai AI SDK is and how it's organized.

Chai AI SDK (chai-ai) is a provider-agnostic TypeScript SDK for building AI agents. Core agent logic — tool calling, streaming, sessions, structured output, handoffs, guardrails, tracing — lives in the chai-ai package and is independent of any single model provider. Wire-format translation for each provider lives in a separate adapter package:

  • chai-ai — core Agent, tool(), generateText(), and shared types
  • @chai-ai/openai — OpenAI adapter (openai(...))
  • @chai-ai/google — Google Gemini adapter (google(...))
  • @chai-ai/anthropic — Anthropic Claude adapter (anthropic(...))

Why provider-agnostic?

An Agent is constructed with a model from whichever provider package you import, and the same Agent code — tools, instructions, guardrails, handoffs — runs unchanged across OpenAI, Google, or Anthropic. Swapping providers is a one-line change to the model passed in.

Where to go next

  • Installation — add the packages to your project
  • Quickstart — generate your first response
  • Guides — Agents, Streaming, Sessions, Structured Output, Handoffs, Guardrails, Tracing, Reliability
  • API Reference — package-level API surface

On this page