CLI

CLI setup

Install the riffads CLI, sign in with an API key, run it in CI.

Read as Markdown

CLI: not distributed yet

Everything on this page is built and works against the live API. The package itself is not published yet, so the install command below will not resolve until it is. The REST API and the MCP server are open today.

Install riffads, point it at the API host, give it a key. Three minutes.

You need

  • Node 20.10.0 or newer.
  • An API key (sk_live_...). Owners and admins create keys at app.riffads.com/api-keys. Tick Generate if the key should start jobs.
  • A server, build box or your own machine. Never a browser: the key is a secret.

Install

Terminal
npm install -g riffads

# or run it without installing
npx riffads@latest --version

Set the host

Terminal
export RIFFADS_BASE_URL="https://app.riffads.com"

Always set the host

The CLI defaults to https://riffads.com, which does not serve the API. Set RIFFADS_BASE_URL, pass --base-url https://app.riffads.com, or let riffads login --base-url ... save it. Wrong host: ... did not answer as a RiffAds API endpoint. Check --base-url.

Sign in

Terminal
riffads login --base-url https://app.riffads.com

It asks for the key in a hidden prompt, checks it, then saves it. Or pipe the key in:

Terminal
pass show riffads/ci | riffads login --base-url https://app.riffads.com

login takes the key from, in order:

  1. --api-key <key> (lands in shell history, avoid it)
  2. RIFFADS_API_KEY
  3. stdin, when it is not a terminal
  4. A hidden prompt, only on a terminal (so CI never hangs)

A refused key exits 3 and writes nothing. A read-only key saves fine, then generate fails with insufficient_scope.

~/.riffads/config.json
{
  "api_key": "sk_live_xxxxxxxxxxxx",
  "base_url": "https://app.riffads.com"
}

Directory mode 0700, file mode 0600.

Check what it will use

Terminal
riffads whoami
stdout
host    https://app.riffads.com (from file)
key     ****a91f (from file)
credits 4,200 credits

Every command picks the key and host from, in order:

OrderSourceSet with
1Flag--api-key <key>, --base-url <url>
2EnvironmentRIFFADS_API_KEY, RIFFADS_BASE_URL
3Saved login~/.riffads/config.json

The environment beats your saved login

If RIFFADS_API_KEY is set, it wins over the key you just saved. Wrong workspace? whoami shows (from env). Unset the variable.

Empty or whitespace values count as not set.

Environment variables

VariableEffectDefault
RIFFADS_API_KEYThe key. Beats the saved login.none
RIFFADS_BASE_URLThe host. Set it to https://app.riffads.com.https://riffads.com
RIFFADS_CONFIG_HOMEFolder for config.json.~/.riffads
NO_COLORNon-empty: no colour, no spinner.unset
FORCE_COLORAnything but 0: colour and spinner on. Beats NO_COLOR and CI.unset
CIAnything but empty, 0 or false: no spinner.unset

CI

Skip login. Set two variables from your secret store and check them first.

CI
export RIFFADS_API_KEY="$RIFFADS_KEY"
export RIFFADS_BASE_URL="https://app.riffads.com"

riffads whoami   # free, exits 3 if the key or workspace is wrong

Exit codes, JSON output and a full CI script: commands.

Sign out and rotate

Terminal
riffads logout
  • Deletes the local file only. The key still works. Always exits 0.
  • Revoke keys at app.riffads.com/api-keys. Work already running finishes.
  • Rotate: create a new key, riffads login, riffads whoami, revoke the old key.

When sign-in fails

Errors print on stderr as error: <message> (<code>).

MessageMeaningExit
No RiffAds API key.No flag, env var or saved login.3
This RiffAds API key is not valid.Malformed or unknown key.3
This RiffAds API key has been revoked.Create a new key.3
This RiffAds API key was not given the Generate scope, which this endpoint needs.Read-only key. Create one with Generate.3
The workspace this RiffAds API key belongs to is no longer available.Workspace is gone.3
This RiffAds API key is sending requests too quickly.Rate limited. Wait and retry.5
... did not answer as a RiffAds API endpoint. Check --base-url.Wrong host.2
"..." is not a valid base URL.Host does not parse.2
"..." is not an http or https URL.Wrong scheme.2

A workspace without a plan that includes the API gets required_plan, exit 3. Every code: errors.

On this page