Base URL
https://api.getaight.ai/v1
Requests and responses follow the OpenAI API format. Official OpenAI SDKs work with the base URL and an Aight API key.
Authentication
Send the API key as a bearer token. Keys start with sk-aight-.
Authorization: Bearer $AIGHT_API_KEY
API keys are created in the console after the account is approved. A key can have an optional monthly cap, an expiry date and a list of allowed models.
Endpoints
| Endpoint | Use |
|---|---|
POST /v1/chat/completions | Send messages to a text model and read the reply. Supports stream. |
POST /v1/embeddings | Turn text into vectors for search and matching. |
GET /v1/models | List the models the API key can call. |
Chat completions: request body
| Field | Type | Required |
|---|---|---|
model | string, a model ID from Models & pricing | Yes |
messages | array of {"role", "content"} | Yes |
stream | boolean | No |
Errors
Branch on the HTTP status and, where present, the code in the error body's param field. The message text can change.
| Status | Code | Meaning | Next step |
|---|---|---|---|
| 401 | — | Missing or unknown API key. | Check the Authorization header. |
| 402 | out_of_balance | Balance is empty. | Recharge. Do not retry automatically. |
| 403 | key_cap_reached | The API key reached its monthly cap. | Edit the cap or use another key. The cap resets on the 1st of each month. |
| 403 | — | The key is frozen or expired, the model is not allowed for the key, or the account is on hold. | Read the message, or call GET /v1/models. |
| 429 | — | Too many requests for the key in one minute. | Wait for Retry-After, then retry. |
| 503 | balance_unverifiable | The balance could not be checked. The request was not run or charged. | Retry after a few seconds. |
A 402 is never a rate limit, so retry logic can tell the two apart.
Help
Send the status, the error message, the time with time zone and the model ID to hello@getaight.ai. Never include an API key or password.