Skip to content

Commit 3bdabfd

Browse files
Lookoff-AIMLAPIgitbook-bot
authored andcommitted
GITBOOK-1153: No subject
1 parent 82d2aa2 commit 3bdabfd

1 file changed

Lines changed: 6 additions & 23 deletions

File tree

docs/api-references/service-endpoints/api-key-usage.md

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ The response always echoes `start` and `end` resolved to UTC, so you can see exa
2222

2323
## Choosing the key
2424

25-
| Your key | `key_prefix` | Result |
26-
| ---------------- | ------------------------ | ---------------- |
27-
| any key | omitted | its own spend |
28-
| management key | provided | that key's spend |
29-
| regular key | provided, its own prefix | its own spend |
30-
| regular key | provided, another prefix | `403` |
25+
| Your key | `key_prefix` | Result |
26+
| -------------- | ------------------------ | ---------------- |
27+
| any key | omitted | its own spend |
28+
| management key | provided | that key's spend |
29+
| regular key | provided, its own prefix | its own spend |
30+
| regular key | provided, another prefix | `403` |
3131

3232
Any key can read its own spend. Reading the spend of a **different** key requires a management key.
3333

@@ -46,20 +46,3 @@ Returns the same total plus a per-model breakdown, sorted by spend.
4646
{% openapi-operation spec="usage-detail-v2" path="/v2/usage/detail" method="get" %}
4747
[OpenAPI usage-detail-v2](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/service-endpoints/usage-detail-v2.json)
4848
{% endopenapi-operation %}
49-
50-
## Good to know
51-
52-
* **`spend` is the authoritative total.** In the detailed response it is computed from the total rather than by adding up `models`, so the two can differ by a few nano-dollars. That is expected.
53-
* **Unfinished work is not counted.** A video generation that is still running is excluded until it completes.
54-
* **This is not your balance.** These endpoints answer "what did this key cost", which is useful for cost attribution and budgeting. For your current balance use [Account Balance](account-balance.md).
55-
* **Polling?** Prefer `period`. Responses are cached briefly per exact window, and a hand-built timestamp that changes on every call never reuses that cache.
56-
57-
## Errors
58-
59-
| Code | Meaning |
60-
| ----- | ---------------------------------------------------------------------------------------------------------------------- |
61-
| `400` | No window given, both window forms given at once, a malformed date or period, `end` earlier than `start`, or over 92 days |
62-
| `401` | Missing or invalid API key |
63-
| `403` | A regular key asked for another key's prefix |
64-
| `404` | The prefix does not belong to your account |
65-
| `429` | Too many requests |

0 commit comments

Comments
 (0)