Skip to content
Hayonix

SDKs and CLI

Command-line tool

Install the hayonix command, sign in, script it with --json and -q, set up shell completion, and read its exit codes.

hayonix covers the everyday work (pods, serverless endpoints and jobs, dedicated endpoints, files, fine-tunes, batches, models, chat, secrets, SSH keys, balance and usage) with readable output, and reaches every other API operation through hayonix api. Run hayonix --help, or --help after any command, for its arguments and flags.

Install

It needs Node.js 24 or later.

npm
npm install -g hayonix-cli

Sign in

login reads a project API key (from a hidden prompt, or from stdin with --with-key-stdin), checks it with the API and stores it with the base URL in your config directory, readable only by you. whoami shows the org, project and permissions in use.

CLI
echo "$KEY" | hayonix login --with-key-stdin # or `platform login` for a hidden prompt
hayonix whoami

The key is taken from --api-key, else API_KEY, else the stored login; the API URL from --base-url, else API_BASE_URL, else the stored one. Inference commands use INFERENCE_BASE_URL when it is set. hayonix logout removes the stored key.

Output for people and for scripts

By default commands print tables and summaries. Two global flags, accepted anywhere on the line, change that:

  • --json prints the API's JSON response on stdout, and errors as the JSON error envelope on stderr;
  • -q (--quiet) prints only IDs, one per line, which is what you capture in a variable.
CLI
hayonix secrets list               # a table for people
hayonix secrets list --json | jq . # the API's JSON, for scripts
hayonix balance
CLI
SECRET_ID=$(echo "example" | hayonix secrets create --name CLI_DEMO --value-stdin -q) # only the ID
hayonix secrets delete "$SECRET_ID" -y

Destructive commands ask for confirmation at a terminal; pass -y in scripts. Commands that start long work take --wait (or --follow), limited by --wait-timeout.

Any operation: hayonix api

hayonix api calls any operation in the API reference by its SDK name (pods.list) or operation ID (listPods). Path parameters are arguments; other inputs are --param name=value (name:=json for a JSON value, name=@path for a file) or a whole --body. Every reference page shows its api call.

CLI
hayonix api secrets.list --param limit=5 # any operation, by SDK name or operation ID
hayonix api getBalance --json | jq -r .available

Exit codes

CodeMeaning
0Success
1The API returned an error, or the command failed
2Usage error: unknown command or flag, a missing or malformed value
3Not signed in, or the API key was refused or lacks permission
4Not found
5Gave up waiting (--wait, --follow, serverless run)
6The awaited work did not succeed (a job, fine-tune, batch, pod or file)
130Interrupted
CLI
if platform pods show pod_00000000000000000000000000 2>/dev/null; then
  echo "found"
else
  echo "exit code $?" # 4: not found
fi

Shell completion

hayonix completion bash, zsh or fish prints a completion script for commands and flags. Load it from your shell's startup file.

CLI
hayonix completion bash > /dev/null # load it with: source <(hayonix completion bash)

Other global flags

--timeout sets the per-request timeout (30s), --debug logs each request line to stderr (never the key), and --no-color (or the NO_COLOR environment variable) turns colour off.