لم تُترجَم هذه الصفحة إلى العربية بعد. يتم عرض النص الإنجليزي الأصلي.

GET /credits

Total granted and total used

Returns how much credit has ever entered the account and how much has left it. Both figures are in Korean won (KRW).

GET https://openrouter.myip.co.kr/api/v1/credits

Authentication

Authorization: Bearer <key> is required. Both key kinds are accepted — inference and management. Credit belongs to the account rather than to a key, so any key on the account gives the same answer.

/api/v1 does not accept cookies. A logged-in browser showing a balance uses the session cookie against /api/dashboard/credits instead.

Request parameters

None. The endpoint takes no query parameters and no body.

Request example

curl https://openrouter.myip.co.kr/api/v1/credits \
  -H "Authorization: Bearer $MYIP_API_KEY"

Response

total_creditsnumber

Sum of credit granted to the account, in won: the ledger's charge (paid top-ups) and bonus entries added together. It is a monotonically increasing total, not the current balance.

total_usagenumber

Sum of money that has left the account, in won: the absolute values of the ledger's deduct (usage) and expire entries. Also cumulative, so it never decreases. It is significant to six decimal places, because a single call often costs less than one won.

json
{
  "data": {
    "total_credits": 50000,
    "total_usage": 12480.351200
  }
}

Getting a balance from this

balance ≈ total_credits - total_usage

When the numbers move

  • Right after a top-up: total_credits rises as soon as the payment is approved.
  • Right after a call: total_usage is settled after the response is sent, so there is a short delay. A call that has just finished may not be reflected yet.
  • Streaming: settlement happens when the stream ends ([DONE], or the connection closing).

If you need the exact cost of one call immediately, do not poll this endpoint. Use usage.cost in a non-streaming response, the X-MyIP-Cost-KRW response header, or the usage chunk in a stream. For an authoritative figure after the fact, use GET /generation.

Per-key spend

This endpoint is account-wide. To see what a single key has spent, read usage, usage_daily, usage_weekly and usage_monthly from GET /key. The spend of all keys on an account adds up to total_usage.

Errors

Statuserror_typeWhen
401invalid_api_keyNo header. A token without one of our prefixes. An unknown, switched-off, or revoked key
401expired_api_keyThe key has expired
402insufficient_creditsThe key is suspended_no_credit; metadata.balance_krw is attached
403key_suspendedAn administrator suspended the key
500serverAny other server-side failure
json
{
  "error": {
    "code": 402,
    "message": "크레딧이 부족합니다.",
    "metadata": { "error_type": "insufficient_credits", "balance_krw": "0.000000" }
  }
}

message is written in Korean, the service's primary locale. Branch on metadata.error_type, not on the message text.

آخر تحديث ٠٥‏/٠٩‏/٢٠٢٦