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:
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: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
- Keep using npx (recommended, nothing to install)
- Install globally once
- Use an environment variable
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
Nothing happens on screen when I paste the key. Did it paste?
Nothing happens on screen when I paste the key. Did it paste?
The input is hidden; just press Enter after pasting. To double-check, run
npx apiyi@latest auth show, which prints the saved key masked.I ran npm i -g apiyi and still get command not found
I ran npm i -g apiyi and still get command not found
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.Where is the key stored, and how do I remove it?
Where is the key stored, and how do I remove it?
In
~/.config/apiyi/config.json, with file mode 0600 so only your user can read it. Remove it with npx apiyi@latest auth clear.It says my Node version is too old
It says my Node version is too old
The CLI needs Node 18.17 or later. Run
node -v to check, and upgrade Node if it is older.Checking my balance also says no_key or permission denied
Checking my balance also says no_key or permission denied
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?Related Docs
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