> ## Documentation Index
> Fetch the complete documentation index at: https://docs.youka.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Node.js SDK

> 使用官方 TypeScript SDK 从 Node.js 和 Bun 自动化 Youka

`@youka/sdk` 是 Youka API 的官方 TypeScript SDK。使用它可以从音频或视频创建卡拉 OK，自定义歌词与样式，导出 MP4 视频，并将 Youka 工作流构建到 Node.js 或 Bun 应用中。

## 安装

<CodeGroup>
  ```bash npm theme={null}
  npm install @youka/sdk
  ```

  ```bash pnpm theme={null}
  pnpm add @youka/sdk
  ```

  ```bash yarn theme={null}
  yarn add @youka/sdk
  ```

  ```bash bun theme={null}
  bun add @youka/sdk
  ```
</CodeGroup>

## 要求

* Node.js 20 或更高版本，或 Bun 1.1+
* 在 `YOUKA_API_KEY` 中配置 Youka API key（在 [online.youka.io/account](https://online.youka.io/account) 的 **API keys** 下创建）

## 快速示例

```ts theme={null}
import { YoukaClient } from "@youka/zh/sdk";

const client = new YoukaClient({
  apiKey: process.env.YOUKA_API_KEY!,
});

const operation = await client.projects.create({
  source: { type: "path", path: "./song.mp3" },
  lyricsSource: { type: "transcribe" },
});

const { project } = await client.projects.wait(operation);
console.log(project.id, project.title);
```

## 参考

<Columns cols={2}>
  <Card title="Quickstart" icon="rocket" href="/zh/sdk/quickstart">
    端到端示例：创建、等待、导出、下载。
  </Card>

  <Card title="Authentication" icon="key" href="/zh/sdk/authentication">
    配置 `YoukaClient` 并安全地处理 API keys。
  </Card>

  <Card title="Account, credits, and billing" icon="credit-card" href="/zh/sdk/account-billing">
    身份、余额、定价、结账与账单门户辅助工具。
  </Card>

  <Card title="Projects" icon="folder" href="/zh/sdk/projects">
    上传、创建、列表与删除。
  </Card>

  <Card title="Stems" icon="waveform-lines" href="/zh/sdk/stems">
    触发声部分离任务。
  </Card>

  <Card title="Lyrics sync" icon="closed-captioning" href="/zh/sdk/lyrics-sync">
    重新运行歌词同步。
  </Card>

  <Card title="Exports" icon="file-video" href="/zh/sdk/exports">
    云端与本地导出工作流。
  </Card>

  <Card title="Tasks" icon="list-check" href="/zh/sdk/tasks">
    查看任务并等待完成。
  </Card>

  <Card title="Presets" icon="palette" href="/zh/sdk/presets">
    可复用的渲染配置。
  </Card>

  <Card title="Media" icon="image" href="/zh/sdk/media">
    上传背景、Logo 和片头。
  </Card>

  <Card title="Project settings" icon="sliders" href="/zh/sdk/project-settings">
    项目级渲染设置。
  </Card>

  <Card title="Errors" icon="triangle-exclamation" href="/zh/sdk/errors">
    `YoukaRequestError` 和 `YoukaTaskError`。
  </Card>
</Columns>

## 下一步

* [Quickstart](/zh/sdk/quickstart) — 通往成品卡拉 OK 的最短路径
* [API reference](/zh/api) — 所有端点，由 OpenAPI 自动生成
* [AI agents](/zh/agents) — 面向代理作者的操作规则
