Extra-small AI SDK for OpenAI or compatible APIs
Top 71.3% on sourcepulse
xsAI is a lightweight, runtime-agnostic SDK for interacting with OpenAI and OpenAI-compatible APIs, designed for developers prioritizing minimal bundle sizes and broad compatibility across environments like browsers, Deno, Bun, and Edge. It offers core functionalities for text generation and streaming, with extensions for tool calling and structured output.
How It Works
xsAI achieves its small footprint by acting as a thin wrapper around the Fetch API, utilizing ESM-only modules, and selectively adding dependencies only when necessary for advanced features like tool calls. This approach minimizes overhead and ensures compatibility across various JavaScript runtimes without relying on Node.js built-ins.
Quick Start & Requirements
npm install xsai
(or yarn add xsai
, pnpm install xsai
, bun install xsai
, deno install xsai
)Highlighted Details
@xsai/generate-text
package is 1.4KB gzipped.@xsai/stream-text
.Maintenance & Community
The project is part of the moeru-ai organization, which also maintains projects like airi
and arpk
. Other community projects integrating or related to xsAI are listed.
Licensing & Compatibility
Limitations & Caveats
The project is in an early stage of development and may introduce breaking changes.
18 hours ago
1 day