Skip to main content
Every command supports --json. The schema is small and stable, which makes the CLI a comfortable building block for shell pipelines, automation, and LLM-driven tools.

Output schemas

mulerouter list --json

With --providers:

mulerouter params --json

mulerouter run --json

When waiting for completion:
The result key (videos, images, audios) matches the endpoint’s result_key. With --no-wait, the response includes task_id, api_path, and the full task info payload as returned by the upstream API.

mulerouter status --json

When the task succeeds, a results array appears. When it fails, an error string explains why.

Recipes

Pick a random SOTA model
Extract the first result URL
Download every generated asset
Validate a prompt without spending credits (dry-run) There is no built-in dry-run, but mulerouter params <endpoint> --json plus ajv on the parameter list lets you validate locally before submitting. Pin a model from package.json

Stdout vs stderr

  • stdout is reserved for the JSON or text result. Safe to pipe.
  • stderr carries progress lines ([12s] status: queued), warnings, and errors. Use --quiet to suppress progress lines while keeping real errors.

Exit codes

Check $? before parsing JSON — a failed call may still emit JSON, but the shape will contain an error field instead of results.

Using the CLI from an AI agent

The CLI’s combination of --json output, stable subcommand surface, and deterministic exit codes makes it a clean tool to expose to an LLM agent. A minimal tool spec:
The agent shells out mulerouter run <endpoint> <args...> --json --quiet and reads the resulting JSON. Pair with mulerouter list --json and mulerouter params <endpoint> --json so the model can discover available options without hardcoding them.