Docs

API reference

Connect through an OpenAI-compatible API.

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

EndpointUse
POST /v1/chat/completionsSend messages to a text model and read the reply. Supports stream.
POST /v1/embeddingsTurn text into vectors for search and matching.
GET /v1/modelsList the models the API key can call.

Chat completions: request body

FieldTypeRequired
modelstring, a model ID from Models & pricingYes
messagesarray of {"role", "content"}Yes
streambooleanNo

Errors

Branch on the HTTP status and, where present, the code in the error body's param field. The message text can change.

StatusCodeMeaningNext step
401—Missing or unknown API key.Check the Authorization header.
402out_of_balanceBalance is empty.Recharge. Do not retry automatically.
403key_cap_reachedThe 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.
503balance_unverifiableThe 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.