Endpoints
Key
Read the calling key's limit and spend, and the account's available credit and free credit.
GET/v1/key
Returns details about the key in the request. Use it to check credit from a script or a statusline. Send the key as Authorization: Bearer sk-df-... or x-api-key.
Example
curl https://deference.si/v1/key \
-H "Authorization: Bearer $DEFERENCE_API_KEY"import os
import requests
response = requests.get(
"https://deference.si/v1/key",
headers={"Authorization": f"Bearer {os.environ['DEFERENCE_API_KEY']}"},
)
print(response.json()["data"]["credit_available"])const response = await fetch("https://deference.si/v1/key", {
headers: { Authorization: `Bearer ${process.env.DEFERENCE_API_KEY}` },
});
const { data } = await response.json();
console.log(data.credit_available);Response
{
"data": {
"name": "claude-code",
"label": "sk-df-Ab3x…Qz9k",
"limit": 50,
"usage": 12.4,
"limit_remaining": 37.6,
"credit_available": 112.8,
"free_credit_available": 1.25,
"free_credit_expires_at": "2026-11-07T00:00:00.000Z",
"expires_at": null
}
}Fields
- namestring
- The key's name.
- labelstring
- The masked key.
- limitnumber | null
- The key's credit limit in dollars, or
nullfor no limit. - usagenumber
- Dollars the key has spent.
- limit_remainingnumber | null
- The limit minus usage and minus the credit the key's running requests hold, never below
0, ornullfor no limit. This is what a new request on the key can use. - credit_availablenumber
- The account's credit balance minus held credit, in dollars, and
0when that is negative. This does not include free credit. - free_credit_availablenumber
- The account's free credit that can still be spent, in dollars: grants that have not expired, less what running requests hold.
0when there is none. See Free credit. - free_credit_expires_atstring | null
- An ISO 8601 time: when the next free credit expires.
nullwhen there is no free credit, or none of it expires. - expires_atstring | null
- An ISO 8601 time, or
nullif the key does not expire.
Errors
A bad key returns the key errors in Authentication, in the OpenAI envelope.