API reference

Endpoints, auth, and errors.

Public base URL: https://serveras.click/v1. Inference uses API keys. Dashboard pages use a customer session instead.

Authentication

Authorization: Bearer asai_sk_...

Keys are shown once at creation and can be revealed later from the dashboard. Max 3 active keys per account; they share one credit balance.

Endpoints

MethodPathAuthDescription
POST/v1/chat/completionsAPI keyOpenAI Chat Completions. Streaming and non-streaming.
POST/v1/responsesAPI keyResponses compatibility for Codex CLI with asai/gpt-* models. See Codex setup.
POST/v1/messagesAPI keyAnthropic Messages compatibility for Claude Code. Streaming and non-streaming.
GET/v1/modelsPublicList customer model aliases and rates.
GET/v1/balanceAPI keyRead available credits for the key's account.

POST /v1/chat/completions

OpenAI-compatible. Send a messages array. max_tokens is capped per model (customer max output 16,384). stream defaults to false.

POST /v1/chat/completions
Content-Type: application/json
Authorization: Bearer asai_sk_...

{
  "model": "asai/gpt-6-sol",
  "messages": [
    {"role": "system", "content": "You are helpful."},
    {"role": "user", "content": "What is 2+2?"}
  ],
  "max_tokens": 100,
  "stream": false
}
{
  "object": "chat.completion",
  "model": "asai/gpt-6-sol",
  "choices": [{
    "index": 0,
    "message": {"role": "assistant", "content": "2 + 2 = 4."},
    "finish_reason": "stop"
  }],
  "usage": {"prompt_tokens": 23, "completion_tokens": 8, "total_tokens": 31}
}

POST /v1/responses

Codex CLI compatibility is available for asai/gpt-6-sol over HTTP SSE. Use the tested provider configuration and current support limits under Codex setup. This endpoint is not advertised as full OpenAI Responses API parity.

GET /v1/balance

For server-side use only. Never expose an API key in browser JavaScript or a URL. Multiple keys on the same account share one balance. Available credits can change with expiring lots and concurrent reservations. This reads the asAi customer wallet, not upstream provider credits.

curl -H 'Authorization: Bearer YOUR_ASAI_API_KEY' https://serveras.click/v1/balance
{"available_credits": 5000}

Balance reads are limited to 30 per key per minute; excessive reads return HTTP 429 with a Retry-After header.

GET /v1/models

No authentication required. Returns aliases only — never upstream provider names.

GET https://serveras.click/v1/models
{
  "object": "list",
  "data": [
    {
      "id": "asai/gpt-6-sol",
      "object": "model",
      "owned_by": "aSaI",
      "context_length": 1050000,
      "max_output": 16384,
      "rates": {"input": "10", "output": "50", "cache": "2.5"}
    }
  ]
}

Error codes

Inference errors use a structured error object. Failures before output delivery are not charged. Partial streamed output may settle.

StatusCodeMeaning
401invalid_api_keyMissing, malformed, or unknown API key.
402insufficient_creditsNot enough available credits to reserve the request.
403key_expiredThis API key has expired.
403account_disabledThe customer account is disabled.
403email_not_verifiedVerify your email before running inference.
404model_not_foundUnknown model alias.
429rate_limit_exceededAccount hit 20 RPM.
429concurrency_limit_exceededAccount hit 7 concurrent requests.
503model_disabledThat alias is temporarily disabled.
503gateway_pausedInference is paused by a safety control.
503upstream_unavailableThe gateway cannot reach inference right now.
503accounting_unavailableReservation/settlement is unavailable.
{
  "error": {
    "code": "insufficient_credits",
    "message": "Insufficient credits",
    "type": "asai_error"
  }
}