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.

Base URLhttps://shareai.online/v1

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

http
Authorization: Bearer sk-shareai-…

List models

GET /models returns the models available to your key.

bash
curl https://shareai.online/v1/models

Chat completions

POST /chat/completions accepts the standard OpenAI request body.

curl
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"}]
  }'
python
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

json
{
  "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:

StatusCodeMeaning
401missing_api_keyNo Bearer token was supplied.
401invalid_api_keyThe API key is unknown or disabled.
403model_not_allowedThe key isn't permitted to use the requested model group.
402insufficient_balanceNot enough USDC balance to cover the request.
429rate_limitedToo 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.