Skip to main content

Short Answer

npx apiyi@latest downloads the CLI, runs it once and leaves nothing behind, so no apiyi command is added to your machine. Every following command needs the full npx apiyi@latest … prefix, for example to save your key:
If you want to type plain apiyi from now on, install it globally once: npm i -g apiyi.

Symptom

The first self-check says there is no key, and the command from the hint fails:
On Windows the wording differs (for example “the term apiyi is not recognized as the name of a cmdlet”), but the cause is the same.

Cause

npx runs the CLI from npm’s temporary cache and does not add apiyi to your PATH. In version 0.2.1 and earlier, the hint used the short form apiyi auth set-key, so copying it led straight to this error. From 0.2.2 on, the CLI detects when it runs through npx and prints the full form npx apiyi@latest auth set-key in its hints; --help explains this as well.

Fix

Prefix every command with npx apiyi@latest. You always get the latest version and nothing stays on your machine:

First-Time Setup, Step by Step

1

Copy a key

Open the token page and copy a token starting with sk-; create one first if you have none.
2

Save the key

Run npx apiyi@latest auth set-key. When you see API key (input hidden):, paste the key and press Enter. Nothing appears on screen while you type or paste. This is intentional, so nobody can read the key over your shoulder. Saved apiKey to ~/.config/apiyi/config.json (mode 0600) means it worked.
3

Check again

Run npx apiyi@latest check. A status of ok means the key is valid and the node is reachable.
4

Send your first message

Run npx apiyi@latest chat "Hello" -m gpt-5.4-mini. Seeing a reply and the token usage means everything works.

Common Questions

The input is hidden; just press Enter after pasting. To double-check, run npx apiyi@latest auth show, which prints the saved key masked.
npm’s global directory is not on your PATH. Run npm prefix -g to find it, add its bin subdirectory to PATH (in ~/.zshrc), then open a new terminal. If you manage Node with nvm, switching Node versions also means installing globally again under the new version.
In ~/.config/apiyi/config.json, with file mode 0600 so only your user can read it. Remove it with npx apiyi@latest auth clear.
The CLI needs Node 18.17 or later. Run node -v to check, and upgrade Node if it is older.
A regular sk- key cannot read the balance. Balance needs a personal access token (starting with nap_): npx apiyi@latest auth set-key --access-token. See What Is a Personal Access Token?

AI Developer Kit · CLI

All commands, key lookup order and exit codes

What If My API Key Is Invalid?

Read this when check returns invalid_key