docs
Overview

API keys and base URL

Markdown

Where 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.

ClientBase URLRequest destination
OpenAI SDK and compatible clientshttps://api.ailoot.ai/v1/v1/chat/completions, /v1/responses, /v1/embeddings
Anthropic SDK, Claude Codehttps://api.ailoot.ai/v1/messages
Google GenAI SDK, Gemini CLIhttps://api.ailoot.ai/v1beta/models/{model}:generateContent
The client requires a full URLhttps://api.ailoot.ai/v1/chat/completionsas specified

How to send the key

Ailoot accepts the key in any of these three headers; whichever your SDK sends will work:

HeaderClients 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"

Check 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"
Still have questions? Send your Request ID and a description — we'll help you troubleshoot.Contact support