API keys and base URL
MarkdownWhere to get a key, which URL to configure in each SDK, and how to send the key.
Full guide
API key
Create the key in the Dashboard at ailoot.ai after signing up. It has the format sk-…. You can create several keys: one for your work computer, one for your server, and one for each application. This makes it easier to revoke one without affecting the others.
You can set a total spending limit, expiry, IP allowlists and blocklists, and spending limits for 5-hour, 1-day, and 7-day windows. If a restriction is triggered, you receive a clear error: api_key_quota_exhausted (total limit exhausted), usage_limit_reached (the key’s spending window is exhausted; wait for the window to reset or increase the limit), api_key_expired or permission_denied (for example, the request came from an IP that is not allowed).
API base URL
The main rule: OpenAI-compatible clients use a URL with /v1; Anthropic and Gemini use one without it.
| Client | Base URL | Request destination |
|---|---|---|
| OpenAI SDK and compatible clients | https://api.ailoot.ai/v1 | /v1/chat/completions, /v1/responses, /v1/embeddings |
| Anthropic SDK, Claude Code | https://api.ailoot.ai | /v1/messages |
| Google GenAI SDK, Gemini CLI | https://api.ailoot.ai | /v1beta/models/{model}:generateContent |
| The client requires a full URL | https://api.ailoot.ai/v1/chat/completions | as specified |
How to send the key
Ailoot accepts the key in any of these three headers; whichever your SDK sends will work:
| Header | Clients that use it |
|---|---|
Authorization: Bearer sk-… | OpenAI SDK, most clients |
x-api-key: sk-… | Anthropic SDK, Claude Code with ANTHROPIC_API_KEY |
x-goog-api-key: sk-… | Google GenAI SDK, Gemini CLI |
On paths /v1/… a key in the URL (?key= or ?api_key=) is not accepted: the request receives 400 with the code invalid_request and a message stating that the key was sent in the URL. This keeps the key out of logs and browser history. If you have already used the key in a URL, it is best to create a new one.
On Gemini paths /v1beta/… for compatibility with Google, the API accepts ?key= with the lowest priority, after headers. ?api_key= is also rejected with 400 on these paths. It is still more reliable to send the key in the header x-goog-api-key.
Environment variables
You can create one variable and use it in the settings of different applications:
# ~/.zshrc or ~/.bashrc
export AILOOT_API_KEY="sk-..."
# for applications that read the standard names
export OPENAI_BASE_URL="https://api.ailoot.ai/v1"
export OPENAI_API_KEY="$AILOOT_API_KEY"
export ANTHROPIC_BASE_URL="https://api.ailoot.ai"
export ANTHROPIC_AUTH_TOKEN="$AILOOT_API_KEY"setx AILOOT_API_KEY "sk-..."
# for applications that read the standard names
setx OPENAI_BASE_URL "https://api.ailoot.ai/v1"
setx OPENAI_API_KEY "sk-..."
setx ANTHROPIC_BASE_URL "https://api.ailoot.ai"
setx ANTHROPIC_AUTH_TOKEN "sk-..."
# restart the terminal so the variables take effectCheck your key
The least expensive way to check a key is to request the model list: it is free.
curl -s https://api.ailoot.ai/v1/models \
-H "Authorization: Bearer $AILOOT_API_KEY"