Skip to main content
Every call to https://api.abstract.inc/v1 carries an API key as a Bearer token:
GET /v1/models needs the key too.

Get a key

The abstract CLI signs you in and saves a key on your machine.
abstract login prints a link and a code. Open the link in a browser and confirm the code. The CLI then creates a key on your account and saves it in ~/.config/abstract/credentials.json, readable by you alone. On a machine that is already signed in, abstract login keeps the existing key. The account needs a payment method or credit before the CLI can create a key. Set one up at abstract.inc/start?setup=billing.

Use the key

abstract token prints the saved key and nothing else. Pass it inside a command as $(abstract token):
For a program, set the key in that program’s environment only:
The program reads ABSTRACT_API_KEY and sends it as the Bearer token.
abstract token prints a secret. Never print or echo the key, commit it, or paste it into a log or a chat. Treat anything that prints abstract token output as a secret.

Check the key

abstract status shows the saved key’s non-secret prefix and calls GET /v1/models with it.

Handle 401

The API answers HTTP 401 when the key is missing, wrong, or revoked. Do not retry a 401 with the same key.

Revoke a key

See the CLI reference for every command.