Documentation

Integrate in minutes.

NusaGate is compatible with the OpenAI API: change the baseURL, use any official SDK, and pay per token, billed in rupiah. Every example on this page runs as written.

quickstart

Your first request

Two steps: create an API key in the dashboard, then send a request to the gateway. There is no special SDK to install.

curl https://api.nusagate.com/v1/chat/completions \
  -H "Authorization: Bearer nsk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.3-flash",
    "messages": [
      { "role": "user", "content": "Hello, introduce yourself!" }
    ]
  }'

The official OpenAI SDKs (JavaScript and Python) work as is. Just point baseURL to https://api.nusagate.com/v1 and apiKey to your nsk_ key.

catalog

Available models

Use the ID in the first column as the value of the model field in the request body. Prices are per 1M tokens, prepaid in rupiah. Your code can fetch the same catalog from GET /v1/models.

Models available on NusaGate with prices per 1M tokens
Model IDInputContextInput /1MOutput /1MCache hit /1M

GPT 6.1 Sol

Available through NusaGate.

Input: Text, Image, Audio, Video1.05M tokens$0.56$3.33$0.0610% of input

GPT-6 Sol

Available through NusaGate.

Input: Text, Image, Audio, Video1.05M tokens$0.69$3.44$0.0710% of input

GPT 6 Luna

Available through NusaGate.

Input: Text, Image1.05M tokens$0.03$0.17$0.003310% of input

GLM 5.3 Flash

A 1M multimodal model for coding and agent workflows.

Input: Text, Image, Video1.05M tokens$0.06$0.17$0.006110% of input

Deepseek V4.1 Flash

1M context for coding, RAG, and high-volume processing.

Input: Text, Image1.05M tokens$0.05$0.18$0.00510% of input

GPT-5.6 Luna

A budget model for high-volume agent workflows.

Input: Text, Image, Video1.05M tokens$0.07$0.50$0.006710% of input

GPT-5.6 Terra

A balance of quality, reasoning, and cost.

Input: Text, Image1.05M tokens$0.83$3.61$0.0810% of input

GPT-5.6 Sol

The flagship for complex work and long-horizon agents.

Input: Text, Image, Audio, Video1.05M tokens$1.94$5.56$0.1910% of input

Qwen 3.8 Flash

Available through NusaGate.

Input: Text, Image1.05M tokens$0.05$0.16$0.00510% of input

Gemini 3.8 Flash

Available through NusaGate.

80% off
Input: Text, Image1.05M tokens$0.06$0.29$0.22$1.11$0.005810% of input

Deepseek V4 Pro

Available through NusaGate.

Input: Text1.05M tokens$0.22$0.67$0.0210% of input

GLM 5.3

Available through NusaGate.

Input: Text1.05M tokens$0.46$1.44$0.0510% of input

Grok 4.7

Available through NusaGate.

Input: Text, Image1.05M tokens$0.56$1.42$0.0610% of input

Qwen 3.8 Max 0902

Available through NusaGate.

Input: Text, Image1.05M tokens$0.66$1.97$0.0710% of input

GLM 5.3 Flash Uncensored

Available through NusaGate.

Input: Text1.05M tokens$1.22$4.17$0.2319% of input

Kimi K3

Available through NusaGate.

Input: Text, Image1.05M tokens$0.94$4.94$0.0910% of input

Qwen 3.8 27B Uncensored

Available through NusaGate.

Input: Text, Image131K tokens$1.67$6.06$0.4225% of input

GPT-6 Astra

Available through NusaGate.

Input: Text, Image272K tokens$3.33$17.22$0.3310% of input

Live prices from the NusaGate catalog, the same as what your account is charged (cached for 1 minute). Models with a cache price support prompt/prefix caching: cached tokens are billed at the percentage shown in the last column.

USD amounts are converted from rupiah at a fixed rate of Rp 18.000 per $1 and are for display only. You are always billed in rupiah.

Compare prices

security

Authentication & API keys

One key works for every model. Keys are hashed before they are stored, so a database leak does not expose customer keys.

Sign up and create an API key

Sign up, open API keys in the dashboard, and create a new key. Keys start with nsk_ and are shown only once when created, so store the key in a secret manager right away.

Send it in a header

Include the following header in every request. Never put the API key in a URL, a request body, or frontend code that the browser can read.

Authorization: Bearer nsk_xxxxxxxx...

Top up and track usage

Top up your balance in the dashboard with stablecoins or Indonesian payment methods. The balance is credited automatically after payment. Every request is logged on the usage page, broken down by model and day.

An empty balance returns 402 insufficient_balance, not 500.

main endpoint

Chat Completions

POST /v1/chat/completions accepts an OpenAI-style body. Every optional parameter falls back to the model default when you omit it.

Body parameters for POST /v1/chat/completions
ParameterTypeRequiredDescription
modelstringrequiredModel ID. Get the full list from GET /v1/models, for example glm-5.3-flash or gpt-5.6-luna.
messagesarrayrequiredConversation history as { role, content } objects. The role can be system, user, or assistant.
streambooleanoptionalDefaults to false. When true, the response is sent as Server-Sent Events.
temperaturenumberoptionalHow creative the answer is, from 0 to 2. Defaults to the model's own default.
max_tokensintegeroptionalMaximum number of tokens in the answer.

Streaming example

curl https://api.nusagate.com/v1/chat/completions \
  -H "Authorization: Bearer nsk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.3-flash",
    "messages": [
      { "role": "user", "content": "Write a three-line poem about rain." }
    ],
    "stream": true
  }'

reference

Endpoint Reference

Public gateway endpoints that follow the OpenAI format and can be called directly from your application.

Gateway API

Public endpoints for requests from your application. Authenticate with an nsk_... API key in the Authorization: Bearer header.

coding agents

Set up your coding agent

One command points your coding agent at NusaGate. The helper merges its changes into your configuration and backs up the old file, so your other settings are kept.

nusagate helper
# wizard: pick an agent and a model, the key is verified first
npx @nusagate-gateway/helper

# no prompts
npx @nusagate-gateway/helper apply -k nsk_... -m gpt-5.6-terra --agents claude,opencode -y

# which agents already point at NusaGate
npx @nusagate-gateway/helper status

# remove only the NusaGate settings, leave the rest alone
npx @nusagate-gateway/helper reset

Supported agents

  • Claude Code
  • Codex
  • OpenCode
  • Cline
  • OpenClaw
  • Hermes
  • OMP
  • Pi
The helper verifies your key with GET /v1/models before writing anything, and cancels the write if a config file can't be read. A copy of the old file is kept as *.nusagate-backup.

Manual configuration (without the helper)

OpenCode

Save this configuration in ~/.config/opencode/opencode.json. Use NusaGate's public model IDs. Don't add limit if the output limit isn't certain, because OpenCode rejects a limit block that only has context.

export NUSAGATE_API_KEY="nsk_..."

# ~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "model": "nusagate/gpt-6-sol",
  "provider": {
    "nusagate": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "NusaGate",
      "options": {
        "baseURL": "https://api.nusagate.com/v1",
        "apiKey": "{env:NUSAGATE_API_KEY}"
      },
      "models": {
        "gpt-6-sol": { "name": "GPT-6 Sol" }
      }
    }
  }
}

Restart OpenCode after changing the environment variable, then choose the model nusagate/gpt-6-sol.

Hermes

Point Hermes's model configuration at the same base URL. Field names can differ between Hermes versions, but the values stay the same.

export NUSAGATE_API_KEY="nsk_..."
export OPENAI_BASE_URL="https://api.nusagate.com/v1"
export OPENAI_MODEL="deepseek-v4.1-flash"

hermes --provider openai-compatible

If Hermes uses a config file, copy the values of OPENAI_BASE_URL and OPENAI_MODEL into it.

Quick debugging: 401 means the key is wrong or revoked, 402 means the balance is empty, and 429 means you hit the rate limit. See the error contract for details.

error handling

Error contract

Every error follows the { error, message } format with a clear HTTP status, so retries and alerting can be automated.

NusaGate API error codes and how to handle them
StatusError codeMeaningWhat to do
400validation_errorThe request body is invalid, for example an empty messages array.Fix the payload according to the details field in the response.
401invalid_api_keyThe API key is wrong or revoked, or the Authorization header is missing.Create a new key in the dashboard and check the Bearer header format.
402insufficient_balanceThe prepaid balance is used up.Top up from the dashboard. The balance becomes active once the payment is verified.
404model_not_foundThe model id is not in the catalog.Get the official ids from GET /v1/models.
429rate_limitMore than 60 requests per minute per key.Wait as long as retry_after says before trying again.
429pass_window_capCoding Plan usage reached the per-window limit (only the Pro and Month tiers have limits).Your plan value stays valid and can be used again once the window resets (see retry_after). If you don't want to wait, turn on the "Continue with balance when the plan limit is reached" option in the dashboard under Wallet, Plan tab, so requests keep going and are paid from your balance.
503upstream_busyThe upstream provider is busy or unavailable.Retry after retry_after. The gateway has already made one internal retry.
500internal_errorAn unexpected error on the NusaGate side.Retry, and if it keeps happening, contact support with the requestId.
example error response
HTTP/1.1 429 Too Many Requests

{
  "error": "rate_limit",
  "message": "Too many requests. Retry in 60 seconds.",
  "retry_after": 60
}

Ready to try it?

Create an API key, top up from ≈ $0.56 (charged Rp 10.000), and send your first request.

Open dashboard