aio errors: no key, 401, 402, the waiting time and Node.js 18

All in One AIThe aio Command·· 10 views· 3 min read

When something fails, aio shows the error in the terminal language, with the code, the HTTP status and the request id. The key never appears in the messages. Here are the most common errors and what to do about each.

The errors and what to do

Situation What to do
There is no API key. Run aio auth login or set the AIO_API_KEY variable.
The API rejected the key (401). Check the key in the API Center: it may be revoked or belong to another account.
The key does not have ai:read or ai:write (403). Create a key with both permissions.
There are not enough credits (402). Buy credits in All in One AI or choose a cheaper model.
The model does not exist (404). Look up the id with aio models --search.
You went over the requests per minute limit (429). Wait a little and run the command again.
The generation did not finish within the waiting time. Check it later with aio status <id> --download.
aio needs Node.js 18 or later. Update Node.js and run the command again.

No key, 401 and 403

aio auth status shows the key in use, hidden, where it comes from, the mode and the balance. Start there. If the key comes from the AIO_API_KEY variable, that is the one that counts, even if you ran aio auth login with another: the variable takes priority. An old variable forgotten in ~/.bashrc is a common cause of 401.

With 403, the key is right but it lacks a permission. Create a key with ai:read and ai:write in the API Center and log in again.

402: not enough credits

aio balance shows your credits and, with a Coding Plan, the points left. In chat, the reservation counts the input and the maximum output asked for: a lower --max-tokens or a cheaper model may be enough. If not, buy credits in All in One AI.

The waiting time

aio generate waits, by default, 300 seconds for images and voice and 900 for videos. If the generation does not finish in time, it is not lost: check it with aio status <id> --download. To wait longer, use --timeout. Do not mix it up with AIO_TIMEOUT, which is the time for each API request (120 seconds, by default).

Node.js 18

aio needs Node.js 18 or later. See your version with node --version. If it is older, install the LTS version from the official Node.js site and run the command again.

The exit code helps too: 1 is an error like the ones in the table, 2 is a command written wrong. In that case, aio help <command> shows the right options.

If the error does not go away, open a support ticket with the message aio showed. The request id in it lets us find the request at once.

Want to use AI in the terminal without surprises? See All in One AI.

See All in One AI

SEE ALSO

Using aio on a server or in scripts: AIO_API_KEY, --json and the exit codes

What a chat request costs through the API: the reservation, max_tokens and the final adjustment

AI credits: how to buy them, the volume tiers and what each request uses

Creating an API key: name, mode, permissions, validity, IP list and spending limit

All in One AI

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from 396,00 MT/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.