Documentation
Developer documentation
ShareAI exposes an OpenAI-compatible API. Point your existing SDK at the ShareAI base URL, use your ShareAI key as the bearer token, and your code works unchanged.
Introduction
The API mirrors the OpenAI Chat Completions interface. Requests are authenticated with an API key, routed to an available provider on the network, and billed per token in USDC.
https://shareai.online/v1Authentication
Pass your key as a bearer token. Create and manage keys on the API page.
Authorization: Bearer sk-shareai-…List models
GET /v1/models returns the models available to the network.
curl https://shareai.online/v1/modelsChat completions
POST /v1/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": "gpt-5.4-mini",
"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="gpt-5.4-mini",
messages=[{"role": "user", "content": "Hello from ShareAI"}],
)
print(resp.choices[0].message.content)Example response
{
"id": "chatcmpl-…",
"object": "chat.completion",
"model": "gpt-5.4-mini",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "Hi! …" },
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 9, "completion_tokens": 12, "total_tokens": 21 }
}Errors
Errors use OpenAI-style bodies with a stable code.
| 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. |
| 402 | insufficient_balance | Not enough USDC balance to cover the request. |
| 503 | no_provider_available | No online provider can serve this model right now. |
| 503 | provider_upstream_not_configured | The deployment has no upstream provider configured yet. |
Billing
Successful requests debit your USDC balance per token at the model's published rate. Revenue splits 90% to the serving provider and 10% to the platform. Top up your balance on the Account page.