API
Connecting to ai-keys
ai-keys is compatible with the OpenAI API and the Anthropic API. In your client you only change the base URL and the key — your code and libraries stay the same.
Quick start
- Account and balance. Sign up and top up your balance with crypto. Keys can’t be issued while the balance is zero.
- Key. In the dashboard, open Keys and issue a key. It starts with aik_sk_ and is shown only once.
- Client. Set the API base URL and key in your client, then pick a model by its ID from the table below.
Base URL and key
| OpenAI-compatible clients | https://ai-keys.online/v1 |
|---|---|
| Anthropic SDK and Claude Code | https://ai-keys.online |
| Auth header | Authorization: Bearer aik_sk_… or x-api-key: aik_sk_… |
| Endpoints | POST /v1/chat/completions POST /v1/messages GET /v1/models |
Keep the key on your server or in an environment variable; never put it in code your users can see.
Examples
curl https://ai-keys.online/v1/chat/completions \
-H "Authorization: Bearer $AI_KEYS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet",
"messages": [{"role": "user", "content": "Hello!"}]
}'from openai import OpenAI
client = OpenAI(
base_url="https://ai-keys.online/v1",
api_key="aik_sk_...",
)
reply = client.chat.completions.create(
model="gpt",
messages=[{"role": "user", "content": "Hello!"}],
)
print(reply.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://ai-keys.online/v1",
apiKey: process.env.AI_KEYS_API_KEY,
});
const reply = await client.chat.completions.create({
model: "gemini-pro",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(reply.choices[0].message.content);import anthropic
client = anthropic.Anthropic(
base_url="https://ai-keys.online",
api_key="aik_sk_...",
)
message = client.messages.create(
model="claude-opus",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello!"}],
)
print(message.content[0].text)Clients
Claude Code
Set these environment variables before launching:
export ANTHROPIC_BASE_URL="https://ai-keys.online"
export ANTHROPIC_AUTH_TOKEN="aik_sk_..."
export ANTHROPIC_MODEL="claude-sonnet"
claudeCursor, Cherry Studio, LibreChat, Open WebUI
In settings, add a provider of type “OpenAI-compatible” / “Custom OpenAI”:
| Base URL | https://ai-keys.online/v1 |
|---|---|
| API key | aik_sk_… |
| Model | claude-sonnet, gpt, gemini-pro … |
Models
Pass the ID from the first column in the model field. Prices are per 1M tokens and are charged to your balance.
| ID | Model | Context | Input | Output |
|---|---|---|---|---|
claude-sonnet |
Claude Sonnet Anthropic · Writing, code and document analysis |
200k | $3.0 | $15 |
claude-opus |
Claude Opus Anthropic · Hard problems and long reasoning |
200k | $15 | $75 |
gpt |
GPT OpenAI · All-round model for products |
128k | $5.0 | $15 |
gpt-mini |
GPT mini OpenAI · Short answers and drafts |
128k | $0.40 | $1.6 |
gemini-pro |
Gemini Pro Google · Long context and mixed input |
1M | $2.5 | $10 |
gemini-flash |
Gemini Flash Google · High throughput and classification |
1M | $0.30 | $1.2 |
grok |
Grok xAI · Code, agents and tools |
128k | $3.0 | $15 |
deepseek |
DeepSeek DeepSeek · Reasoning and math |
128k | $0.50 | $2.0 |
llama |
Llama Meta · Open model for your own use cases |
128k | $0.20 | $0.20 |
curl https://ai-keys.online/v1/modelsErrors
| HTTP | code | Meaning |
|---|---|---|
| 401 | missing_key | No key in the request headers. |
| 401 | invalid_key | Key not found or revoked. |
| 402 | balance_zero | Zero balance — top up your account. |
| 404 | unknown_endpoint | Wrong path. Check the base URL. |