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.

Base URLhttps://shareai.online/v1

Authentication

Pass your key as a bearer token. Create and manage keys on the API page.

http
Authorization: Bearer sk-shareai-…

List models

GET /v1/models returns the models available to the network.

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

Chat completions

POST /v1/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": "gpt-5.4-mini",
    "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="gpt-5.4-mini",
    messages=[{"role": "user", "content": "Hello from ShareAI"}],
)
print(resp.choices[0].message.content)

Example response

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

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.
402insufficient_balanceNot enough USDC balance to cover the request.
503no_provider_availableNo online provider can serve this model right now.
503provider_upstream_not_configuredThe 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.