Skip to content

Commit c881092

Browse files
Lookovclaude
andcommitted
docs: fold the model catalogue into Complete Model List, restyle service endpoints
The catalogue and Complete Model List documented the same endpoint twice, so the catalogue content moves into Complete Model List and its own page becomes a hidden pointer. Keeping a full second copy would have reproduced the duplicate search collision that GITBOOK-1168 just fixed. - Complete Model List now covers GET /v1/models end to end: include sections, filters, the singular GET /model/{id} lookup, pricing and ETag caching - models.json rewritten for /v1/models with the real response shape. The page had been documenting fields that no longer exist: the response is {object, data}, not a bare array, there is no features or endpoints array, docs_url is docsUrl, maxTokens is outputMax, and aliases/tags/docsJson were missing. Examples are now taken from live responses. - All catalogue URLs point at the canonical /v1/models, with a note that /models and /api/v1/models serve the same data - Complete Model List, Usage Logs, Model Performance Metrics and Account Balance adopt the API Key Management layout: a routing table of endpoints, then one section per endpoint. Parameter tables that the rendered schema already draws are gone; the traps that would break an integration stay as hints. - Account Balance leads with the v2 endpoints; the legacy /v1/billing/balance moves to the bottom, anchor unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 935b91e commit c881092

6 files changed

Lines changed: 509 additions & 443 deletions

File tree

Lines changed: 27 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,43 @@
11
# Account Balance
22

3-
## Get account balance info
3+
<table data-header-hidden data-full-width="true"><thead><tr><th width="220" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top"><a href="account-balance.md#get-balance-info">Get balance info</a></td><td valign="top"><mark style="color:$success;"><strong><code>GET</code></strong></mark> <code>https://api.aimlapi.com/v2/billing</code></td></tr><tr><td valign="top"><a href="account-balance.md#get-detailed-billing-info">Get detailed billing info</a></td><td valign="top"><mark style="color:$success;"><strong><code>GET</code></strong></mark> <code>https://api.aimlapi.com/v2/billing/detail</code></td></tr><tr><td valign="top"><a href="account-balance.md#get-account-transactions">Get account transactions</a></td><td valign="top"><mark style="color:$success;"><strong><code>GET</code></strong></mark> <code>https://api.aimlapi.com/v2/billing/transactions</code></td></tr><tr><td valign="top"><a href="account-balance.md#get-account-balance-info">Get account balance info</a> <em>(legacy)</em></td><td valign="top"><mark style="color:$success;"><strong><code>GET</code></strong></mark> <code>https://api.aimlapi.com/v1/billing/balance</code></td></tr></tbody></table>
44

5-
{% hint style="warning" %}
6-
This endpoint is considered legacy and is scheduled for future deprecation.\
7-
Please plan to migrate to the new `/v2/billing` and `/v2/billing/detail` endpoints documented below.
8-
{% endhint %}
9-
10-
You can query your account balance and other billing details through this API.\
115
To make a request, you only need your AIMLAPI key obtained from your [account dashboard](https://aimlapi.com/app/keys).
126

13-
{% openapi-operation spec="billing-test-1" path="/v1/billing/balance" method="get" %}
14-
[OpenAPI billing-test-1](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/service-endpoints/billing-balance-v1.json)
15-
{% endopenapi-operation %}
16-
17-
## Get balance info
7+
### Get balance info
188

199
Returns a user's balance.
2010

2111
{% openapi-operation spec="billing-v2" path="/v2/billing" method="get" %}
2212
[OpenAPI billing-v2](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/service-endpoints/billing-v2.json)
2313
{% endopenapi-operation %}
2414

25-
## Get detailed billing info
15+
***
16+
17+
### Get detailed billing info
2618

2719
Returns detailed billing information, balance and auto top-up settings.
2820

2921
{% openapi-operation spec="billing-detail-v2" path="/v2/billing/detail" method="get" %}
3022
[OpenAPI billing-detail-v2](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/service-endpoints/billing-detail-v2.json)
3123
{% endopenapi-operation %}
3224

33-
## Get account transactions
25+
***
26+
27+
### Get account transactions
3428

35-
`GET /v2/billing/transactions` answers "where did the balance go". Each entry is one movement of money — either a **successful top-up** or a **charge**, and a charge carries the model that produced it.
29+
The account money feed: one entry per balance movement, either a successful top-up or a charge carrying the model that produced it. Authenticate with a **regular** AIML API key — there is no `key_prefix`, because a wallet belongs to the account, not to a key.
3630

37-
Authenticate with a **regular** AIML API key. There is no `key_prefix` here: a wallet belongs to the account, not to a key, so the endpoint always answers for the account behind the key you used.
31+
For a `MODEL_USAGE` charge, `reference_id` is the inference id — the same value returned in the `x-inference-id` response header and reported as `inference_id` in [Usage Logs](usage-logs.md).
3832

3933
{% hint style="info" %}
4034
This is the account ledger — the same figures that move your balance — so it is what you reconcile against. [API Key Usage](api-key-usage.md) and [Usage Logs](usage-logs.md) come from the analytics pipeline instead, and are meant for attribution and budgeting.
41-
{% endhint %}
42-
43-
### Reading an entry
44-
45-
`amount` is **always positive**; `direction` is what carries the sign — `TOPUP` for money in, `CHARGE` for money out. `type` says what produced the entry: `PAYMENT`, `BONUS`, `REFUND`, `ADJUSTMENT`, `MODEL_USAGE`, `CREDITS_EXPIRED` or `INIT`.
46-
47-
`reference_id` is what makes an entry joinable to something you already have. For a `MODEL_USAGE` charge it is the **inference id** — the same value returned in the `x-inference-id` response header, reported as `inference_id` in [Usage Logs](usage-logs.md), and, for an async generation, the `generation_id` that submit returned. For a payment it is the payment transaction id. It is `null` when there is nothing on your side to point at, such as a bonus, an expiry or a manual adjustment.
48-
49-
`model` is `null` on top-ups, on charges that are not model usage, and in the rare case where the model could not be resolved.
50-
51-
```bash
52-
# every charge, newest first
53-
curl -H 'Authorization: Bearer <YOUR_AIMLAPI_KEY>' \
54-
'https://api.aimlapi.com/v2/billing/transactions?direction=CHARGE&limit=100'
55-
```
5635

57-
### Paging through the ledger
58-
59-
Paging is **cursor-based**. Take `pagination.next_cursor` from a response and pass it back as `cursor` to get the next page; it is `null` once you reach the end.
60-
61-
{% hint style="warning" %}
62-
Do not page this endpoint by offset, and do not rebuild the cursor. The ledger grows at the head, so a numeric offset silently skips or repeats entries between pages. The cursor is opaque and is accepted **only in the exact form we issued** — re-encoding it is rejected with `400`.
36+
A charge lands **after** you saw your response, and for async video after the generation reports `completed`, so reconciling the instant a generation finishes will under-count. Failed requests are never charged and have no entry here at all.
6337
{% endhint %}
6438

65-
{% hint style="info" %}
66-
A charge lands **after** you saw your response — it is applied when the request completes on the billing side, and for async video after the generation reports `completed`. Reconciling the instant a generation finishes will under-count. Failed requests are not charged at all, so they have no entry here.
67-
68-
Timestamps are UTC, and a balance may legitimately go negative — overdraft is allowed.
39+
{% hint style="warning" %}
40+
Page with the cursor, never with an offset. The ledger grows at the head, so a numeric offset silently skips or repeats entries between pages. Pass `pagination.next_cursor` back as `cursor` — it is opaque and accepted only in the exact form we issued, so re-encoding it is rejected with `400`.
6941
{% endhint %}
7042

7143
Returns the account's balance movements, newest first.
@@ -74,10 +46,23 @@ Returns the account's balance movements, newest first.
7446
[OpenAPI billing-transactions-v2](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/service-endpoints/billing-transactions-v2.json)
7547
{% endopenapi-operation %}
7648

77-
### Errors
49+
#### Errors
7850

7951
| Code | When |
8052
| ----- | ------------------------------------------------------------------------------------------------------------------ |
8153
| `400` | `to` not later than `from`; an unknown query parameter; `limit` outside 1–100; an unknown `direction` or `type`; a malformed or re-encoded cursor |
8254
| `401` | Missing or invalid key |
8355
| `403` | A management key — this route is for regular keys |
56+
57+
***
58+
59+
### Get account balance info
60+
61+
{% hint style="warning" %}
62+
This endpoint is considered legacy and is scheduled for future deprecation.\
63+
Please plan to migrate to the `/v2/billing` and `/v2/billing/detail` endpoints documented above.
64+
{% endhint %}
65+
66+
{% openapi-operation spec="billing-test-1" path="/v1/billing/balance" method="get" %}
67+
[OpenAPI billing-test-1](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/service-endpoints/billing-balance-v1.json)
68+
{% endopenapi-operation %}

0 commit comments

Comments
 (0)