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

# CLI

> crl — generate and publish from your terminal, your CI, and your coding agent.

```bash theme={null}
npm install -g @creatorline/cli
crl auth login          # paste a key from Settings → API
```

Zero runtime dependencies, Node 20+. Grammar is always `crl <command> <subcommand>`.

## The three-line version

```bash theme={null}
crl accounts use Eda
crl gen create text-to-photo --prompt "matcha latte flatlay" --wait --output-dir ./out
crl posts create --asset <asset-id> --caption "morning ritual ☕️" --publish now
```

## Commands

| Command    | Subcommands                                                     |
| ---------- | --------------------------------------------------------------- |
| `auth`     | `login`, `logout`, `whoami`                                     |
| `models`   | `list [tool]`, `get <model-id>`                                 |
| `accounts` | `list`, `use <id\|name>`, `current`, `clear`                    |
| `gen`      | `create <tool>`, `cost <tool>`, `get <id>`, `wait <id>`, `list` |
| `posts`    | `create`, `publish <id>`, `list`, `get <id>`                    |
| `assets`   | `list`, `get <id>`                                              |
| `upload`   | `crl upload <file>`                                             |
| `credits`  | —                                                               |
| `mcp`      | `config`, `install`                                             |

`generate` aliases `gen`, `creators` aliases `accounts`, `clips` aliases `posts`.

## Global flags

| Flag                                | Default |                                                     |
| ----------------------------------- | ------- | --------------------------------------------------- |
| `--json`                            |         | machine-readable output, and nothing else on stdout |
| `--wait`                            |         | block until the generation finishes                 |
| `--wait-timeout`                    | `10m`   | give up waiting — the run continues server-side     |
| `--wait-interval`                   | `3s`    | poll interval                                       |
| `--output-dir`                      |         | download results to disk                            |
| `--api-key`, `--api-url`            |         | override the stored credentials                     |
| `--no-color`, `--help`, `--version` |         |                                                     |

<Note>
  **Both spellings of every flag work.** `--aspect-ratio` and `--aspect_ratio` are the
  same flag. Model parameters are snake\_case and CLI convention is kebab-case; guessing
  wrong should not be a failure mode.
</Note>

## The model's flags are the model's schema

`crl gen create` fetches the model's schema first, then interprets the remaining flags
against it. The CLI hardcodes no model parameters, so a new model works the day it ships:

```bash theme={null}
crl models get bytedance-seedance-2-0-reference-to-video-fast
crl gen create ugc-video --prompt "unboxing" --image ./face.png --duration 5 --wait
```

A wrong flag tells you the fix:

```
error Unknown flag --durations for model bytedance-seedance-2-0-reference-to-video-fast.
  inputs:     --characters --location --objects --audio_urls
  parameters: --ugc_style --aspect_ratio --duration --resolution --generate_audio
  Run `crl models get bytedance-seedance-2-0-reference-to-video-fast` for values and defaults.
```

## Media flags take a path or an id

`--image ./face.png` uploads the file and uses it. `--image <asset-id>` reuses an existing
asset. `--image https://…` passes the URL through. No separate upload step — though
`crl upload <file>` exists when you want to pin an id.

Prompts can come from stdin:

```bash theme={null}
echo "a cinematic city at dusk" | crl gen create text-to-photo --wait
```

## Pick a creator once

```bash theme={null}
crl accounts list
crl accounts use Eda        # persisted, like the studio's creator switcher
crl accounts current
```

Every later `gen create` and `posts create` runs as that creator. `--account-id` overrides
it for one command.

## Scripting and agents

Results go to **stdout**, progress and errors to **stderr**, so pipes stay clean:

```bash theme={null}
crl gen list --json | jq -r '.data[] | select(.status=="succeeded") | .output[0].url'
```

With `--wait`, `crl gen create` prints the media URL. Without it, the generation id.

Parallel fan-out is just shell job control — `--wait` blocks per process:

```bash theme={null}
for tool in text-to-photo ugc-video; do
  crl gen create "$tool" --prompt "$PROMPT" --wait --output-dir "./out/$tool" &
done
wait
```

Exit codes: `0` success · `1` usage or runtime error · `2` not authenticated · `3` out of
credits.

## Configuration

Precedence: flags → environment → config file.

|                                     |                                                     |
| ----------------------------------- | --------------------------------------------------- |
| `CREATORLINE_API_KEY`               | the key                                             |
| `CREATORLINE_API_URL`               | the API base (default `https://api.creatorline.io`) |
| `~/.config/creatorline/config.json` | written by `crl auth login`, mode `0600`            |

CI wants the environment variable — there is no interactive login there.

```bash theme={null}
CREATORLINE_API_KEY=$CI_SECRET crl gen create text-to-photo --prompt "…" --wait --json
```


## Related topics

- [Publishing](/publishing.md)
- [Creatorline API](/index.md)
- [Generating media](/generations.md)
