The CLI is a thin layer overDocumentation Index
Fetch the complete documentation index at: https://mulerouter.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
@mulerouter/core.
The same package is published independently — install it when you want to call
MuleRouter from a Node.js, Bun, or TypeScript application without shelling out.
Minimal example
Public API surface
Key functions
loadConfig(options?)
Resolves apiKey, baseUrl, site, plus default timeout (120_000 ms) and
retry budget (3). Same priority chain as the CLI:
arguments → environment variables → .env.
new APIClient(config)
A small fetch-based client with:
- Bearer-token auth via the configured API key
- Automatic JSON encoding
- Exponential-backoff retry on transient failures (5xx, network errors)
post(path, body)andget(path)returningAPIResponse
createAndPollTask({...})
Submits a POST to endpointPath and polls every interval ms (default
20 000) until the task reaches a terminal state or maxWait (default
900 000 ms) elapses. Set verbose: true to log per-poll status lines to
stderr.
pollTask({...})
Same poller, against an already-created task identified by taskPath and
taskId.
processImageParams(body)
Walks a request body, finds any image-shaped parameter, and converts local
file paths to base64 data URIs. Idempotent for URLs and data: URIs.
registry
Singleton catalog of every endpoint that has been imported. The registry is
populated as a side effect of importing @mulerouter/core (which loads
models/index.ts and every provider module). Useful methods:
| Method | Returns |
|---|---|
registry.get(modelId, action) | A single ModelEndpoint or undefined |
registry.findByModelId(modelId) | Every action registered under that model |
registry.listAll() | Everything |
registry.listForSite("mulerun") | Filtered by site |
registry.listByProvider("alibaba") | Filtered by provider |
registry.listByOutputType("video") | Filtered by output type |
registry.listByTag("SOTA") | Filtered by tag |
registry.getProviders() | Sorted unique provider names |
Status helpers
Naming convention
In code, model parameter names usesnake_case (matching the wire format).
The CLI converts to kebab-case for flags via toCliFlag(name) — useful if
you are building tooling that mirrors the CLI’s UX.
Versioning
The CLI and core packages are released in lockstep. The version string is exported asVERSION and is what the CLI prints for mulerouter --version.
