> ## 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.

# Youka CLI

> Tạo karaoke, tùy chỉnh phong cách và xuất video MP4 từ dòng lệnh

Youka CLI bao bọc public API để bạn có thể tạo karaoke từ một bài hát, tùy chỉnh lời và phong cách video, và xuất ra MP4 hoàn chỉnh từ terminal hoặc từ một agent.

## Cài đặt

<CodeGroup>
  ```bash npm theme={null}
  npm install -g @youka/cli
  ```

  ```bash pnpm theme={null}
  pnpm add -g @youka/cli
  ```

  ```bash yarn theme={null}
  yarn global add @youka/cli
  ```
</CodeGroup>

Xác minh cài đặt:

```bash theme={null}
youka --version
youka --help
```

## Thiết lập xác thực

<Steps>
  <Step title="Lấy API key">
    Truy cập [online.youka.io/account](https://online.youka.io/account), mở
    **API keys**, rồi sao chép một key mới.
  </Step>

  <Step title="Lưu key">
    Lưu bền vững key vào `~/.youka/config.json`:

    ```bash theme={null}
    youka login YOUR_API_KEY
    ```

    Hoặc export nó dưới dạng biến môi trường:

    ```bash theme={null}
    export YOUKA_API_KEY=YOUR_API_KEY
    ```
  </Step>
</Steps>

## Tạo karaoke từ một tệp

Dùng tệp audio hoặc video cục bộ làm nguồn:

```bash theme={null}
youka project create ./song.mp3 --download --output ./karaoke.mp4 --wait --json
```

Lệnh này sẽ tải lên nguồn, tạo dự án karaoke, render một bản xuất, và tải video MP4 hoàn chỉnh về.

## Tạo karaoke từ một URL

Truyền một URL nguồn HTTP hoặc HTTPS thay vì đường dẫn tệp:

```bash theme={null}
youka project create "https://example.com/song.mp4" --download --output ./karaoke.mp4 --wait --json
```

Với các URL video được host, Youka dùng `yt-dlp` để tải xuống từ URL. Bạn có thể cài các phụ thuộc tải URL trước lần import URL đầu tiên:

```bash theme={null}
youka deps ensure --for url
```

## Tham khảo

<Columns cols={2}>
  <Card title="Account" icon="key" href="/vi/cli/account">
    Đăng nhập, đăng xuất và kiểm tra trạng thái xác thực.
  </Card>

  <Card title="Credits" icon="coins" href="/vi/cli/credits">
    Kiểm tra số dư hiện tại và các gói credit sắp hết hạn.
  </Card>

  <Card title="Billing" icon="credit-card" href="/vi/cli/billing">
    Hiển thị giá và tạo URL thanh toán hoặc URL cổng quản lý.
  </Card>

  <Card title="Projects" icon="folder" href="/vi/cli/projects">
    Tạo, kiểm tra, chờ và cập nhật các dự án.
  </Card>

  <Card title="Exports" icon="file-video" href="/vi/cli/exports">
    Render các artifact export trên cloud hoặc local và tải chúng xuống.
  </Card>

  <Card title="Presets" icon="palette" href="/vi/cli/presets">
    Quản lý các cấu hình render có thể tái sử dụng.
  </Card>

  <Card title="Media" icon="image" href="/vi/cli/media">
    Tải lên và quản lý media có thể tái sử dụng.
  </Card>

  <Card title="Tasks" icon="list-check" href="/vi/cli/tasks">
    Kiểm tra trạng thái tác vụ mức thấp khi cần.
  </Card>

  <Card title="Dependencies" icon="box" href="/vi/cli/deps">
    Kiểm tra và cài đặt các phụ thuộc cho import URL và render local.
  </Card>

  <Card title="Global options" icon="gear" href="/vi/cli/global-options">
    Các cờ có sẵn trên mọi lệnh.
  </Card>
</Columns>

## Sẵn sàng cho agent theo mặc định

Mọi lệnh đều hỗ trợ chế độ máy có thể đọc được, trả về một JSON envelope duy nhất với cấu trúc ổn định. Dùng các cờ này để điều khiển CLI từ agent hoặc script:

| Flag                      | Mục đích                                                                          |
| ------------------------- | --------------------------------------------------------------------------------- |
| `--json`                  | In đúng một JSON envelope ra stdout. Tiến trình và log sẽ bị ẩn.                  |
| `--body <file\|->`        | Hợp nhất payload JSON từ một tệp hoặc stdin. Cờ CLI sẽ ghi đè các trường trùng.   |
| `--wait`                  | Poll các job async (project create, exports) cho đến khi đạt trạng thái kết thúc. |
| `--idempotency-key <key>` | Truyền idempotency key cho mọi thao tác ghi.                                      |
| `--quiet`                 | Ẩn output tiến trình không phải JSON khi dùng với `--wait`.                       |
| `--api <url>`             | Ghi đè base URL của public API.                                                   |

Cấu trúc JSON envelope:

```json theme={null}
{
  "ok": true,
  "data": {
    /* command result */
  }
}
```

Khi thất bại:

```json theme={null}
{
  "ok": false,
  "error": {
    "code": "INVALID_INPUT",
    "message": "Human-readable description",
    "details": {
      /* optional */
    }
  }
}
```

Xem [Global options](/vi/cli/global-options) để biết danh sách đầy đủ.

## Xuất trên cloud vs local

`export create` mặc định chạy trên cloud. Truyền `--local` để render trên máy của bạn bằng toolchain Remotion đi kèm. Render local cần các phụ thuộc render:

```bash theme={null}
youka deps ensure --for render
```

Xem [Exports](/vi/cli/exports) để biết quy trình đầy đủ.

## Tiếp theo là gì

* [Account](/vi/cli/account) - lưu API key của bạn
* [Projects](/vi/cli/projects) - tạo và xử lý dự án
* [Exports](/vi/cli/exports) - render video karaoke hoàn chỉnh
* [AI agents](/vi/agents) - điều khiển CLI từ một quy trình tự động hóa
