Docs/API
Connection check
How do I confirm a key works and see my balance from a script?
Checked against the code on
GET https://heyaskr.ai/v1One call that says whether the API is up, whether your key is valid, and how many credits are on the account. It answers without a key too, minus the account.
curl https://heyaskr.ai/v1 -H "Authorization: Bearer $ASKR_KEY"| Field | Meaning |
|---|---|
| models | How many chat models currently have a rate and can be called |
| authenticated | Whether the key you sent was accepted |
| account.credits | Balance in credits. One dollar is 1,000. |
Why curl gets a banner
When the User-Agent is curl, wget, httpie, PowerShell or fetch, the response is plain text with colour: the email, the key's name and prefix, the balance and what it buys. That is for a person at a terminal. Set any other User-Agent and you get the JSON above.
Balance after a call
You rarely need this endpoint for that: every completion returns askr.credits_charged, so a script can keep its own running total and check in here only occasionally.