Server Nusa
Documentation

How to connect

Our gateway is compatible with OpenAI and Anthropic SDKs. Just swap the base_url and use an API key from the dashboard.

Base URL
https://ai.servernusa.com

OpenAI SDK — Python

python
from openai import OpenAI

client = OpenAI(
    base_url="https://ai.servernusa.com/v1",
    api_key="sk-...",  # API key from dashboard
)

resp = client.chat.completions.create(
    model="nusa/mimo-v2.5",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)

OpenAI SDK — Node.js

javascript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://ai.servernusa.com/v1",
  apiKey: "sk-...", // API key from dashboard
});

const resp = await client.chat.completions.create({
  model: "nusa/mimo-v2.5",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.choices[0].message.content);

Anthropic SDK — Python

python
from anthropic import Anthropic

client = Anthropic(
    base_url="https://ai.servernusa.com",
    api_key="sk-...",  # API key from dashboard
)

msg = client.messages.create(
    model="nusa/mimo-v2.5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
)
print(msg.content[0].text)

cURL (streaming)

bash
curl https://ai.servernusa.com/v1/chat/completions \
  -H "Authorization: Bearer sk-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nusa/mimo-v2.5",
    "messages": [{"role": "user", "content": "Hello!"}],
    "stream": true
  }'

Errors

Gateway returns OpenAI- or Anthropic-shaped JSON errors so SDKs and agents (OpenClaw, Hermes, etc.) handle them like native provider errors. On /v1/chat/completions use the OpenAI body; on /v1/messages use the Anthropic body. Rejected preflight requests (auth, balance, context) are not charged.

HTTPcodetypeMeaningWhat to do
400context_length_exceededinvalid_request_errorInput (+ reserved output) exceeds the model context window. Rejected before upstream.Shorten history, compact/summarize the agent session, start a new session, or pick a model with a larger context. Charge is not applied.
401invalid_api_keyauthentication_errorMissing, malformed, or invalid API key.Send Authorization: Bearer <key> with a key from the dashboard.
402insufficient_quotainsufficient_quotaWallet / credit balance cannot cover the worst-case cost of this request.Top up wallet balance, then retry.
402spending_limit_reachedinsufficient_quotaThis API key hit its spending limit.Raise or clear the key spending limit, or use another key.
403permission_errorAccount suspended or inactive.Contact support / check account status.
404model_not_foundinvalid_request_errorModel id does not exist or is not available.Call GET /v1/models and use a listed public id (e.g. nusa/mimo-v2.5).
429rate_limit_exceededrate_limit_errorToo many requests for this key / account (your ServerNusa rate limit).Slow down, backoff, retry later.
502model_unavailableapi_errorThis model cannot be served right now (upstream failure). Internal details are never exposed.Try another model from the catalog, or retry shortly. Not charged.
503model_busyapi_errorThis model is temporarily busy (capacity / overload). Internal pool or account details are never exposed.Wait a moment and retry, or switch to another model. Not charged.

Context length exceeded

Agents often resend full chat history each turn. When estimated input tokens plus the reserved output budget exceed the model's context window, the gateway returns HTTP 400 with context_length_exceeded and does not call upstream. Rotating provider accounts does not increase context — start a compact/summary or a new session with a smaller history.

OpenAI-style (/v1/chat/completions)
json
{
  "error": {
    "message": "This model's maximum context length is 128000 tokens. Your request estimated ~1080298 tokens.",
    "type": "invalid_request_error",
    "param": null,
    "code": "context_length_exceeded"
  }
}
Anthropic-style (/v1/messages)
json
{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "This model's maximum context length is 128000 tokens. Your request estimated ~1080298 tokens."
  }
}

Busy / unavailable models

If capacity is full or a backend path fails, the gateway returns a clean model_busy (503) or model_unavailable (502). You will not see raw upstream account-pool or provider errors. Prefer switching model rather than retrying the same id indefinitely.

json
{
  "error": {
    "message": "This model is temporarily busy. Please try again in a moment or switch to another model.",
    "type": "api_error",
    "param": null,
    "code": "model_busy"
  }
}

See models and pricing on the models page. Billing is based on actual tokens and deducted from your wallet balance. Context / auth / quota / busy rejections before a successful completion are free.