AI agents and scripts

vibetoken is designed to be driven by programs. This page is the contract: what goes where, what the output looks like, and how to retry without paying twice.

Give your agent the CLI

Paste this into your agent's instructions, such as AGENTS.md or CLAUDE.md:

## Generating media with vibetoken

Use the `vibetoken` CLI to generate images, video, 3D models, and speech.

- Always pass `--json -q`. Results are JSON on stdout; errors are JSON on stderr.
- Find a model with `vibetoken models list --modality <image|video|audio|3d> --json`,
  then read its options with `vibetoken models schema <model> --json`.
- Pass model options as `-P field=value`. Preview a paid request with `--dry-run`.
- Generate a UUID and pass it as `--client-request-id` on every `create`. If the command
  fails with exit code 9 (network) or 5 (rate limited), rerun it with the same id; it is
  never charged twice.
- For video and 3D, use `--no-wait`, then `vibetoken <kind> wait <id> --json -q`.
  Exit code 8 means the task is still running: run `wait` again.
- Add `--dir <path>` to download results; the JSON then lists local paths in `downloaded`.
- Run `vibetoken commands --json` for every command and flag.

The full English docs are also available as one file at https://vt-cli.lutaonan.com/llms.txt.

Output

Stream Without --json With --json
stdout Results as text Results as one JSON value
stderr Progress and errors Progress and {"error": {...}}

Add -q to silence progress. Set VIBETOKEN_OUTPUT=json to make JSON the default.

A finished generation, with --dir:

{
  "id": "88f86396-34fa-4641-9b25-3905f452ec1a",
  "object": "image.generation",
  "status": "success",
  "model": "bytedance/seedream-5.0-flash",
  "data": [{ "url": "https://…/0.jpg", "output_format": "jpeg", "size": "1024x1024" }],
  "usage": { "cost": 0.084 },
  "downloaded": ["out/88f86396-34fa-4641-9b25-3905f452ec1a-0.jpg"]
}

status is pending, success, or failed. downloaded appears only when files were saved.

An error:

{"error": {"exit_code": 4, "status": 404, "message": "HTTP 404: Generation not found (request_id …)", "request_id": "…"}}

status and request_id are present when the API returned the error.

Exit codes

Code Meaning What to do
0 Success
1 Other error Read the message
2 Invalid arguments or parameters Fix the command; check models schema
3 Missing or invalid API key See Authentication
4 Not found Check the id or model
5 Rate limited Wait, then retry with the same --client-request-id
6 Insufficient balance or credit limit Top up; retrying won't help
7 Generation failed Not charged; change the prompt or options
8 Timed out waiting The task is still running; run wait <id>
9 Network error Retry with the same --client-request-id
130 Interrupted The task is still running; run wait <id>

Retry without paying twice

Every create and audio speech sends an idempotency key. Reusing the key returns the original task instead of starting a new one, so a retry is never charged twice.

Choose the key yourself so you still have it if the connection drops before you get a task id:

key=$(uuidgen)
vibetoken video create -m bytedance/seedance-2-t2v "a cat" --client-request-id "$key" --no-wait --json -q

To recover the task later:

vibetoken video find "$key" --json

If find exits with code 4, the request never arrived; run create again with the same key.

Discover commands

vibetoken commands --json               # every command, flag, and example
vibetoken models schema <model> --json  # the options a model accepts
vibetoken <command> --help              # one command, as text

For an endpoint without a dedicated command, vibetoken api <path> sends an authenticated request and prints the response.