CLI commands

Every command, every flag, every exit code.

nib login

Starts a device-code sign-in. Prints a short code, opens the browser, and polls until approval. Stores a bearer token at ~/.config/nib/config.json with mode 0600.

FlagEffect
--no-openPrint the URL instead of opening a browser. Use over SSH.
--api-url <url>Override the gateway for this login only.

nib logout

Removes the local config file. The token stays valid server-side until it expires; revoke it explicitly at sknib.com/keys if you suspect a leak.

nib status

Prints plan, credits used and remaining, weekly and daily caps, reset date, concurrency, RPM, and model count.

FlagEffect
--jsonPrint the raw entitlement payload. Stable for scripts.

Exit code 3 when the token is missing or expired, 4 when credits are exhausted.

nib models

Lists every model id routable on your plan, with its tier.

FlagEffect
--jsonPrint the OpenAI-compatible model list.

nib init

Writes a nib provider block into an OpenCode config and sets the default model. Idempotent: refuses to overwrite an existing Nib block unless --force is passed.

FlagEffect
--model <id>Set the default model. Must be in your plan.
--projectWrite opencode.json in the current directory.
--forceReplace an existing Nib provider block.

nib run [args...]

Launches the upstream OpenCode binary with NIB_API_KEY set from your stored token. All arguments are forwarded unchanged.

nib run "refactor the payment module"
nib run --model nib-frontier "why does this test hang?"
FlagEffect
--dry-runPrint the command that would run.

nib key print

Prints the API key for use in other tools. Intended for export NIB_API_KEY=$(nib key print). Exit code 3 if not signed in.

nib whoami

Prints the current plan name. Useful in scripts that gate on subscription tier.

Exit codes

CodeMeaningUsual fix
0Success—
1Unexpected errorRead the message
2Bad request or network failureCheck connectivity and NIB_API_URL
3Not authenticatednib login
4Credits exhaustedTop up or upgrade
5Rate limitedWait for retry-after
6Gateway errorRetry; check the status page
64Usage errornib --help
127Upstream binary not foundInstall opencode-ai

Scripting

All commands are safe to run non-interactively. nib status --json and nib models --json never prompt, and nib login only opens a browser when a display is available. In CI, skip login entirely and set NIB_API_KEY.

if nib whoami | grep -q Starter; then
  echo "on the starter plan"
fi

nib status --json | jq '.usage.credits_used'