Skip to content

Choose packages ​

Install only the packages that you use. Every package takes a model as its first argument, so you can mix them freely.

PackageProvides
@xsai/textgenerateText, streamText, loop, collect, and tool.
@xsai/text-responsesresponses(), an adapter for OpenAI Responses.
@xsai/text-chatchat(), an adapter for Chat Completions.
@xsai/text-messagesmessages(), an adapter for Anthropic Messages.
@xsai/audioSpeech generation and transcription.
@xsai/decideTyped answers to yes-or-no, choice, and score questions.
@xsai/embedText embeddings.
@xsai/imageImage generation.
@xsai/modelModel lists from a service.
@xsai/sharedHTTP options, sendRequest, and error types. The other packages depend on it.
xsschemaSchema conversion and validation. It is a separate package.
xsaiOne package that re-exports everything above except xsschema.

One dependency ​

Use xsai when you prefer a single import path. It exports the same functions as the individual packages.

sh
pnpm add xsai
ts
import { 
generateText
,
responses
} from 'xsai'
const
model
=
responses
({
apiKey
:
process
.
env
.
OPENAI_API_KEY
,
baseURL
: 'https://api.openai.com/v1/',
model
: 'gpt-6-luna',
}) const {
text
} = await
generateText
(
model
, {
input
: 'Say hello.' })
console
.
log
(
text
)

Contributors

Changelog