Koneksia Labs
IDENEnglishLog inSign up free
Test mode — balances and payments are not real money.

Send your first request

1. Top up and create a key

Add a Rupiah balance, then create an API key on the API keys page. The key is shown only once.

Top upCreate an API key

2. Set the base URL and key

Store the base URL and key as environment variables. ROUTER_BASE_URL already includes /v1. Never put the key in browser code.

export ROUTER_BASE_URL="https://api.koneksialabs.ai.id/v1"
export ROUTER_API_KEY="sk-kl-..."   # dari halaman Kunci API / from the API keys page

3. Send a message

Use the official OpenAI SDK; only the base URL and key change. Replace MODEL_ID with an ID from the catalog.

curl "$ROUTER_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $ROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"MODEL_ID","messages":[{"role":"user","content":"Halo!"}]}'

Run the JavaScript sample on a server, not in a browser holding a secret key.

Sample response

A sample, not a real test run.

{
  "id": "gen-0000-contoh",
  "object": "chat.completion",
  "model": "MODEL_ID",
  "choices": [{ "index": 0, "message": { "role": "assistant", "content": "Halo! Ada yang bisa saya bantu?" }, "finish_reason": "stop" }],
  "usage": {
    "prompt_tokens": 9, "completion_tokens": 12, "total_tokens": 21,
    "cost": 0.000235, "cost_micro_idr": "235"
  }
}
Streaming

The last chunk (empty choices) carries usage. The final cost comes from server metering; look it up via /v1/generation if the connection drops.

curl -N "$ROUTER_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $ROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"MODEL_ID","stream":true,"messages":[{"role":"user","content":"Halo!"}]}'

4. Check the cost

Every response carries usage.cost (IDR) and usage.cost_micro_idr (exact value). See per-request detail and cache discounts in Activity.

Open Activity

Errors to handle

API error codes and what they mean
HTTPCodeMeaning
402insufficient_balanceBalance too low. Top up to continue.
402key_monthly_budget_exceededThe key's monthly budget is used up; it resets on the 1st (WIB).
402key_credit_limit_exceededThe key's lifetime credit limit is reached. Raise the limit or use another key.
429rate_limitedToo many requests. Wait as the Retry-After header says.
429free_daily_limitThe free model's daily quota is used up.
404no_eligible_endpointNo provider meets the policy (PDP, region or provider filters).
502all_providers_failedEvery provider failed. The request is not charged.
401invalid_api_keyThe key is missing, wrong or revoked.
Send your first request · Koneksia Labs