Esta página ainda não foi traduzida para Português. Exibindo o original em inglês.
GET and POST /keys
Listing and issuing keys with a management key
Lists the inference keys an account holds (GET) and issues new ones (POST). Both methods require a management key.
GET https://openrouter.myip.co.kr/api/v1/keys
POST https://openrouter.myip.co.kr/api/v1/keysAuthentication — the most common mistake
Authorization: Bearer sk-mo-mgmt-v1-…, that is, a management key only. Calling with an inference key (sk-mo-v1-…) returns 401 invalid_api_key.
The two kinds do different jobs.
| Key | Prefix | Can call |
|---|---|---|
| Inference key | sk-mo-v1- | /chat/completions, /completions, /generation, /key, /credits |
| Management key | sk-mo-mgmt-v1- | /keys, /keys/{hash}, /key, /credits. Cannot run inference |
Management keys cannot be created over the API. You issue one yourself in the dashboard under Settings → API keys by choosing the management kind. Letting a management key mint further management keys would mean a single leaked key has no recovery point.
GET /keys — list
Request parameters
None. The endpoint takes no query parameters.
openrouter's offset and include_disabled are not implemented. Our list returns all of the management key owner's inference keys in one response, newest first. Two things are never in it:
- Revoked keys. They cannot be brought back, so there is nothing to show.
- The management key itself. Only issued inference keys appear.
Keys the user has merely switched off (disabled: true), and keys stopped by an empty balance or by an administrator, all remain in the list and all show disabled: true.
Request example
curl https://openrouter.myip.co.kr/api/v1/keys \
-H "Authorization: Bearer $MYIP_MANAGEMENT_KEY"Response
{"data": [ … ]}, where each item is a key object with eight fields. POST /keys, GET /keys/{hash} and PATCH /keys/{hash} all return this same object.
created_atstringCreation timestamp (ISO 8601).
updated_atstring | nullLast modification timestamp, or null if the key has never been edited.
hashstringsha256(plaintext key) as 64 hex characters. This is the only address a key has and is used verbatim as the path segment in /keys/{hash}.
labelstringThe masked string sk-mo-v1-au7…890. It exists so a human can tell keys apart on screen; it cannot be used to authenticate.
namestringThe name given at creation.
disabledbooleantrue means the key cannot run inference. It collapses several cases into one: the user switched it off, the balance ran out and the system suspended it, or an administrator suspended it. This field does not tell you which — send a request with that key and the status code will: 402 (a top-up fixes it) or 403 (only an administrator can).
limitnumber | nullSpend limit in won. null means unlimited.
usagenumberSpend during the current limit_reset period, in won, with boundaries in Asia/Seoul; when the reset is never or unset this is the lifetime total. limit_reset itself is not part of this object — if you need it, read that key through GET /key.
Response example
{
"data": [
{
"created_at": "2026-09-01T02:11:40.881Z",
"updated_at": null,
"hash": "9f2c1d0a7b3e4f5061728394a5b6c7d8e9f0112233445566778899aabbccddee",
"label": "sk-mo-v1-au7…890",
"name": "production",
"disabled": false,
"limit": 100000,
"usage": 25500
},
{
"created_at": "2026-08-20T11:05:02.130Z",
"updated_at": "2026-08-29T09:41:18.004Z",
"hash": "1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f809",
"label": "sk-mo-v1-c3f…21b",
"name": "staging",
"disabled": true,
"limit": null,
"usage": 0
}
]
}POST /keys — issue
Creates a new inference key. There is no kind parameter, so this path cannot create management keys.
Request parameters
namestringobrigatórioThe key's name. An empty or whitespace-only string returns 400. Surrounding whitespace is trimmed before storing.
limitnumber | nullSpend limit as a number of Korean won. Omit it or pass null for unlimited. These are not dollars — 10 means ten won.
limit_resetstring | nullHow often the limit resets: one of never, daily, weekly, monthly. Any other value returns 400. Omitted means null, and the limit then applies to lifetime spend. Boundaries are taken in Asia/Seoul.
Request example
curl -X POST https://openrouter.myip.co.kr/api/v1/keys \
-H "Authorization: Bearer $MYIP_MANAGEMENT_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "batch-worker",
"limit": 50000,
"limit_reset": "monthly"
}'Response
dataobjectThe key object just created — the same eight fields as in GET /keys. Being brand new, usage is 0 and updated_at is null.
keystringThe plaintext key: sk-mo-v1- followed by 64 hex characters. It appears in this one response and nowhere else, ever.
{
"data": {
"created_at": "2026-09-04T05:22:07.412Z",
"updated_at": null,
"hash": "4d6a8b2c0e1f3a5b7c9d0e2f4a6b8c0d1e3f5a7b9c1d3e5f7a9b1c3d5e7f9a1b",
"label": "sk-mo-v1-8f2…c41",
"name": "batch-worker",
"disabled": false,
"limit": 50000,
"usage": 0
},
"key": "sk-mo-v1-8f2b6d1e0a4c7f93b5d8e02a6c1f4b7d9e3a5c8f0b2d4e6a8c0f2b4d6e8c41"
}hash is precisely the SHA-256 of the returned key. You can check it yourself.
printf '%s' "$PLAINTEXT_KEY" | sha256sumErrors
| Status | error_type | When |
|---|---|---|
| 400 | invalid_request | The body is not valid JSON. name missing or empty. limit is not a number. limit_reset is not one of the four allowed values |
| 401 | invalid_api_key | No header. Called with an inference key. Unknown, switched-off, or revoked key |
| 401 | expired_api_key | The management key has expired |
| 402 | insufficient_credits | The management key is suspended_no_credit |
| 403 | key_suspended | An administrator suspended the management key |
| 500 | server | Any other server-side failure |
{
"error": {
"code": 400,
"message": "`name` 이 필요합니다.",
"metadata": { "error_type": "invalid_request" }
}
}message is written in Korean, the service's primary locale. Branch on metadata.error_type, not on the message text.
The three ways an issued key stops working
| Status | Set by | Requests get | How it is lifted |
|---|---|---|---|
suspended_no_credit | The system, when the balance runs out | 402 insufficient_credits | Automatically, on top-up |
suspended_admin | An administrator | 403 key_suspended | Only by an administrator |
revoked | DELETE /keys/{hash} | 401 invalid_api_key | Never. It is permanent |
Separately, if a key has a limit and its period spend has reached it, requests get 402 key_limit_exceeded, with metadata.limit_krw and metadata.usage_krw attached.
Related
- GET, PATCH and DELETE /keys/{hash} — read, update and revoke one key
- GET /key and /auth/key — the state of the key you are using
- Management API keys — when to use a management key
- Errors and debugging — the full
error_typetable
Última atualização: 5 de set. de 2026