Agent skill

Xsai SDK

by yusixian in yusixian/moe-copy-ai

xsAI SDK v0.4.x API reference - extra-small AI SDK with OpenAI-compatible API

AGPL-3.0Auto-check passedData & Analytics

Install Xsai SDK

skills CLI
$ npx skills add yusixian/moe-copy-ai --skill xsai-sdk -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install yusixian/moe-copy-ai xsai-sdk --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/yusixian/moe-copy-ai.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/xsai .claude/skills/xsai-sdk && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
xsai-sdk
GitHub stars
145
Token cost
~1.1k tokens
SKILL.md length
134 words
Files
49 (incl. references)
Skills in repo
1
Repo updated
First seen
Licence
AGPL-3.0

At a glance

xsAI SDK v0.4.x API reference - extra-small AI SDK with OpenAI-compatible API

  • Data & Analytics work in your project
  • SKILL.md covers Core APIs, Breaking Changes from…, Utils and Reference Documentation
  • Reaches api.openai.com

What it does

Xsai SDK is an agent skill from yusixian/moe-copy-ai. xsAI SDK v0.4.x API reference - extra-small AI SDK with OpenAI-compatible API

Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 50 other files, including reference files (for example `references/docs/Chat.md`, `references/docs/Composio.md` and `references/docs/Embeddings.md`).

It sits in Data & Analytics. It works with Vercel AI SDK, OpenAI, React and Tailwind CSS. The licence is AGPL-3.0.

When your agent uses it

  • Data & Analytics work in your project

Example prompts

  • “/xsai-sdk”

What it can do on your machine

Read from SKILL.md and the folder at commit 3d2834d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • api.openai.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Xsai SDK loads about 1.1k tokens when it runs, and up to ~44k if it reads all its reference files. Until then it costs about 22 tokens; SKILL.md has 134 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~22
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~44k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from yusixian/moe-copy-ai at commit 3d2834d, republished under its AGPL-3.0 licence (© yusixian). 134 words, ~1,138 tokens.

Download SKILL.mdSave it as .claude/skills/xsai-sdk/SKILL.md (or your agent's skills folder). This skill also uses 48 other files; get the full folder from GitHub.
name
xsai-sdk
description
xsAI SDK v0.4.x API reference - extra-small AI SDK with OpenAI-compatible API
globs
utils/ai-service.ts, hooks/useStreamProcessor.ts, hooks/useAiSummary.ts, hooks/useAiSettings.ts

xsAI SDK v0.4.x Quick Reference

xsAI is an extra-small AI SDK with OpenAI-compatible API interface, similar to Vercel AI SDK but much smaller.

Project packages: @xsai/generate-text, @xsai/stream-text, @xsai/model

Core APIs

streamText (sync call, returns StreamTextResult)
typescript
import { streamText } from "@xsai/stream-text"

// NOTE: streamText is SYNCHRONOUS (not async) in 0.4.x
const { textStream } = streamText({
  apiKey: "...",
  baseURL: "https://api.openai.com/v1/",
  model: "gpt-4o",
  messages: [
    { role: "system", content: "You are a helpful assistant." },
    { role: "user", content: "Hello" },
  ],
  streamOptions: { includeUsage: true },
})

// textStream is a ReadableStream<string>, supports async iteration
for await (const textPart of textStream) {
  console.log(textPart)
}

Types:

typescript
interface StreamTextResult {
  textStream: ReadableStream<string>
  fullStream: ReadableStream<StreamTextEvent>
  reasoningTextStream: ReadableStream<string>
  messages: Promise<Message[]>
  steps: Promise<CompletionStep[]>
  usage: Promise<undefined | Usage>
  totalUsage: Promise<undefined | Usage>
}

interface StreamTextOptions extends ChatOptions {
  maxSteps?: number  // default: 1
  onEvent?: (event: StreamTextEvent) => Promise<unknown> | unknown
  onFinish?: (step?: CompletionStep) => Promise<unknown> | unknown
  onStepFinish?: (step: CompletionStep) => Promise<unknown> | unknown
  streamOptions?: { includeUsage?: boolean }
}

// StreamTextEvent replaces the old StreamTextChunkResult
type StreamTextEvent = /* union of stream event types */
generateText (async call)
typescript
import { generateText } from "@xsai/generate-text"

const { text, usage } = await generateText({
  apiKey: "...",
  baseURL: "https://api.openai.com/v1/",
  model: "gpt-4o",
  messages: [
    { role: "system", content: "You are a helpful assistant." },
    { role: "user", content: "Why is the sky blue?" },
  ],
})

Types:

typescript
interface GenerateTextResult {
  text?: string  // NOTE: optional in 0.4.x (was required in 0.2.x)
  usage: Usage
  finishReason: FinishReason
  messages: Message[]
  steps: CompletionStep<true>[]
  toolCalls: CompletionToolCall[]
  toolResults: CompletionToolResult[]
  reasoningText?: string
}
listModels (async call)
typescript
import { listModels } from "@xsai/model"

const models = await listModels({
  apiKey: "...",
  baseURL: "https://api.openai.com/v1/",
})
// Returns Model[] with { id, object, created, owned_by }
Shared Types
typescript
// From @xsai/shared-chat
interface ChatOptions {
  apiKey?: string
  baseURL: string
  model: string
  messages: Message[]
  // ... other OpenAI-compatible options
}

interface Usage {
  prompt_tokens: number
  completion_tokens: number
  total_tokens: number
}

type Message = SystemMessage | UserMessage | AssistantMessage | ToolMessage | DeveloperMessage

Breaking Changes from 0.2.0-beta.3

Change0.2.0-beta.30.4.x
streamText callawait streamText() (async)streamText() (sync)
StreamTextResult{ textStream, chunkStream }{ textStream, fullStream, usage: Promise, ... }
Usage retrievalIterate chunkStream chunksawait result.usage
StreamTextChunkResultExistsRemoved, replaced by StreamTextEvent
textStream typeRequired as unknown as AsyncIterable castNative ReadableStream, supports for await and pipeThrough()
generateText result .textstringstring | undefined

Utils

smoothStream (from @xsai/utils-stream)
typescript
import { smoothStream } from "@xsai/utils-stream"

const smoothed = textStream.pipeThrough(smoothStream({
  delay: 20,
  chunking: "line",
}))
toAsyncIterator (polyfill for Safari)
typescript
import { toAsyncIterator } from "@xsai/utils-stream"

// For browsers that don't support ReadableStream async iteration
const iterableStream = toAsyncIterator(textStream)

Reference Documentation

  • references/index.md - Full documentation index with all examples
  • references/docs/ - Individual package documentation (27 files with complete code examples)
  • references/type-defs/ - Deno Doc type definitions from esm.sh

© yusixian, AGPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 48 other files (references) in .claude/skills/xsai of yusixian/moe-copy-ai.

  • SKILL.md
  • references/docs/Chat.md
  • references/docs/Composio.md
  • references/docs/Embeddings.md
  • references/docs/Image.md
  • references/docs/Model-Context-Protocol.md
  • references/docs/Models.md
  • references/docs/Overview.md
  • references/docs/Providers.md
  • references/docs/Quick-Start.md
  • references/docs/Reasoning.md
  • references/docs/Speech.md
  • references/docs/Stream.md
  • references/docs/Structured-Data-1.md
  • references/docs/Structured-Data.md
  • references/docs/Telemetry.md
  • references/docs/Text-1.md
  • references/docs/Text.md
  • references/docs/Tool-Calling.md
  • … and 30 more

Open the folder on GitHubat commit 3d2834d

Compare with similar skills

Xsai SDK next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Xsai SDK compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Xsai SDK this skillyusixian/moe-copy-ai145—~1.1kAutomated safety check: PassAGPL-3.0
AI SDKvercel-labs/ai-facts16820 repos~1.2kAutomated safety check: PassNone
Design StyleCastor6/tactus3761 repos~2.1kAutomated safety check: PassApache-2.0
Genui Integrationopentiny/genui-sdk172—~1.3kAutomated safety check: PassMIT
Update Web Assetsgarfiec/Librechat-Mobile111—~1.8kAutomated safety check: NotesMIT
Dashboard BuilderQwenLM/qwen-code-examples143—~3.3kAutomated safety check: PassNone

Similar skills

  • AI SDK

    vercel-labs/ai-facts

    Official

    Answer questions about the AI SDK and help build AI-powered features.

    168 GitHub starsUsed in 20 repos~1.2k tokens
    AI & LLM EngineeringAuto-check passed
  • Design Style

    Castor6/tactus

    A skill your agent uses whenever the user asks to build, create, design, develop, improve, or style any frontend interface or visual element.

    376 GitHub starsUsed in 1 repo~2.1k tokens
    Frontend & DesignAuto-check passed
  • Genui Integration

    opentiny/genui-sdk

    genui-sdk 全方位指南:安装、配置、集成、示例。用户提到 genui-sdk、genui-sdk-server,或想构建 AI 聊天界面、动态 UI 组件、Node.js 后端 LLM 代理(OpenAI 兼容 chat/completions API)时使用。涵盖 Vue/Angular 前端(主题、物料、GenuiChat/GenuiRenderer)与 Server…

    172 GitHub stars~1.3k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Update Web Assets

    garfiec/Librechat-Mobile

    Update the third-party JavaScript vendored into the app for the artifact, diagram, and math WebViews (KaTeX, mermaid, marked, highlight.js, Tailwind, Babel, React).

    111 GitHub stars~1.8k tokensUpdated yesterday
    Frontend & DesignAuto-check: notes
  • Dashboard Builder

    QwenLM/qwen-code-examples

    Build full-stack dashboard applications using React/Next.js + shadcn/ui + Tailwind CSS + Recharts + Express with customizable data sources.

    143 GitHub stars~3.3k tokensUpdated 4 mo ago
    Data & AnalyticsAuto-check passed
  • Vercel AI SDK Expert

    sickn33/agentic-awesome-skills

    Expert in the Vercel AI SDK. An agent skill from sickn33/agentic-awesome-skills.

    47k GitHub starsUsed in 2 repos~2.2k tokens
    AI & LLM EngineeringAuto-check passed

Questions about Xsai SDK

What does Xsai SDK do?

xsAI SDK v0.4.x API reference - extra-small AI SDK with OpenAI-compatible API. Xsai SDK is an agent skill from yusixian/moe-copy-ai.

When should I use Xsai SDK?

Xsai SDK fits situations like: data & Analytics work in your project.

How do I install Xsai SDK in Claude Code?

Run `npx skills add yusixian/moe-copy-ai --skill xsai-sdk -a claude-code`. Or copy the skill folder (.claude/skills/xsai in yusixian/moe-copy-ai) into .claude/skills/xsai-sdk in your project. Claude Code loads it when a task matches its description.

How do I install Xsai SDK in Codex?

Run `npx skills add yusixian/moe-copy-ai --skill xsai-sdk -a codex`. Or copy the skill folder (.claude/skills/xsai in yusixian/moe-copy-ai) into .agents/skills/xsai-sdk in your project. Codex loads it when a task matches its description.

Can I use Xsai SDK in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add yusixian/moe-copy-ai --skill xsai-sdk -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/xsai-sdk, .gemini/skills/xsai-sdk, .github/skills/xsai-sdk and .opencode/skills/xsai-sdk in your project.

What does Xsai SDK need to run?

SKILL.md names no scripts, command-line tools or credentials: Xsai SDK is instructions for the agent only.

Does Xsai SDK access the network?

SKILL.md names 1 domain. In commands or code: api.openai.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Xsai SDK safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Xsai SDK use?

Xsai SDK is published under the AGPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Xsai SDK use?

About 1.1k tokens (SKILL.md is roughly 4.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 43k tokens, read only when the agent opens those files.

What are the alternatives to Xsai SDK?

Skills that share tags, products or a category with Xsai SDK: AI SDK (vercel-labs/ai-facts, 168 stars), Design Style (Castor6/tactus, 376 stars), Genui Integration (opentiny/genui-sdk, 172 stars) and Update Web Assets (garfiec/Librechat-Mobile, 111 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Xsai SDK?

yusixian (a GitHub user) maintains it in yusixian/moe-copy-ai, which has 145 GitHub stars. The repository was last updated on April 3, 2026.

Source: yusixian/moe-copy-ai on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.