Documentation
Developer documentation
ShareAI keys work against an OpenAI- and Anthropic-compatible gateway. Point your existing SDK at your gateway base URL, use your ShareAI key as the bearer token, and your code works unchanged.
Introduction
The gateway mirrors the OpenAI Chat Completions interface. Requests are authenticated with your key, served by an available account on the network, and billed per token in USDC from your balance.
https://shareai.online/v1Your account's live base URL and keys are shown on the API page.
Authentication
Pass your key as a bearer token. Create and manage keys on the API page.
Authorization: Bearer sk-shareai-…List models
GET /models returns the models available to your key.
curl https://shareai.online/v1/modelsChat completions
POST /chat/completions accepts the standard OpenAI request body.
curl https://shareai.online/v1/chat/completions \
-H "Authorization: Bearer $SHAREAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-4-8",
"messages": [{"role": "user", "content": "Hello from ShareAI"}]
}'from openai import OpenAI
client = OpenAI(
base_url="https://shareai.online/v1",
api_key="$SHAREAI_API_KEY",
)
resp = client.chat.completions.create(
model="claude-opus-4-8",
messages=[{"role": "user", "content": "Hello from ShareAI"}],
)
print(resp.choices[0].message.content)Example response
{
"id": "chatcmpl-…",
"object": "chat.completion",
"model": "claude-opus-4-8",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "Hi! …" },
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 9, "completion_tokens": 12, "total_tokens": 21 }
}Errors
The gateway returns OpenAI-style error bodies with a code. Typical cases:
| Status | Code | Meaning |
|---|---|---|
| 401 | missing_api_key | No Bearer token was supplied. |
| 401 | invalid_api_key | The API key is unknown or disabled. |
| 403 | model_not_allowed | The key isn't permitted to use the requested model group. |
| 402 | insufficient_balance | Not enough USDC balance to cover the request. |
| 429 | rate_limited | Too many requests — slow down and retry. |
Billing
Successful requests debit your USDC balance per token. Top up your balance with crypto on the Account page; the dashboard reflects your live balance and usage.