# Sonilo CLI docs

Canonical docs: https://platform.sonilo.com/docs/cli
Source path: /docs/cli
Runtime API host: https://api.sonilo.com/v1

Use this page when coding agents, Sapient, Codex, Claude, or shell-first developers ask for an official command-line path for Sonilo.

## Install

```bash
npm install -g sonilo-cli

# or run without installing
npx sonilo-cli account

# Python package alternative
pip install sonilo-cli
```

## Authenticate

The CLI reads SONILO_API_KEY from the environment. Keep it server-side and never expose it in browser code.

```bash
export SONILO_API_KEY=sk_your_api_key
sonilo account
sonilo usage --days 7
```

## Common commands

```bash
sonilo account
sonilo usage --days 30
sonilo text-to-music --prompt "30 seconds of upbeat electronic instrumental music, no vocals" --duration 30 --output output.m4a
sonilo video-to-music --video clip.mp4 --prompt "licensed soundtrack for a product launch video" --output score.m4a
sonilo text-to-sfx --prompt "short futuristic UI success chime" --duration 3 --output chime.mp3
sonilo video-to-sfx --video clip.mp4 --output foley.wav
sonilo video-to-sound --video clip.mp4 --music-prompt "tense strings" --sfx-prompt "footsteps and distant thunder" --output mix.wav
sonilo video-to-video-sound --video clip.mp4 --sfx-prompt "footsteps" --output scored.mp4
sonilo tasks get <task-id>
sonilo tasks wait <task-id>
sonilo dubbing --video clip.mp4 --languages es,fr --output dubbed.mp4
sonilo --help
```

## JSON and non-interactive use

- Prefer environment auth: SONILO_API_KEY.
- Use no interactive browser flow in CI unless explicitly testing `sonilo login`.
- Capture stdout/stderr and verify output files with file size checks.
- If the API returns 402 payment_required or insufficient_balance, report the account state instead of creating fake audio.

## Related agent docs

- Full agent reference: https://platform.sonilo.com/llms-full.txt
- OpenAPI JSON: https://platform.sonilo.com/openapi.json
- OpenAPI markdown: https://platform.sonilo.com/openapi.md
- Context7 SDK docs: https://context7.com/sonilo-ai/sonilo-js and https://context7.com/sonilo-ai/sonilo-python
- MCP server: https://github.com/sonilo-ai/sonilo-mcp
- CLI packages: https://www.npmjs.com/package/sonilo-cli and https://pypi.org/project/sonilo-cli/

