Skip to content

Commit 849bd54

Browse files
kristinaorekhovagitbook-bot
authored andcommitted
GITBOOK-1164: Reformat Model Catalogue API page to match house style
1 parent 70a5f6e commit 849bd54

1 file changed

Lines changed: 27 additions & 33 deletions

File tree

docs/api-references/service-endpoints/models-catalogue.md

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,14 @@ icon: list-tree
55

66
# Model Catalogue API
77

8-
## List models
8+
`GET /v1/models` returns the live model catalogue — the machine-readable source for which models exist, what they're called, what they can do, and what they cost.\
9+
Use it instead of scraping the model pages. No API key is required for this request; you can also open [the endpoint](https://api.aimlapi.com/v1/models) directly in a browser.
910

10-
`GET /v1/models` returns the live catalogue. It is the machine-readable source for which models exist, what they are called, what they can do, and what they cost — use it instead of scraping the model pages.
11-
12-
By default each entry carries only its identity. Pricing, modalities and capabilities are opt-in, so the default response stays small:
13-
14-
```bash
15-
curl https://api.aimlapi.com/v1/models
16-
```
17-
18-
```json
19-
{
20-
"object": "list",
21-
"data": [
22-
{
23-
"id": "deepgram/aura-2",
24-
"aliases": ["aura-2", "aura-2-helena-en", "deepgram/aura-2-helena-en"],
25-
"type": "internal/text-to-speech",
26-
"info": { "name": "Aura-2", "developer": "Deepgram" },
27-
"tags": ["playground:tts"]
28-
}
29-
]
30-
}
31-
```
32-
33-
{% openapi-operation spec="models-catalogue" path="/v1/models" method="get" %}
34-
[Broken link](/broken/openapi/models-catalogue)
35-
{% endopenapi-operation %}
11+
By default each entry carries only its identity. Pricing, modalities and capabilities are opt-in, so the default response stays small.
3612

3713
## Asking for more per model
3814

39-
`include` attaches optional sections. Combine them freely, comma-separated:
15+
`include` attaches optional sections to each model. Combine values freely, comma-separated:
4016

4117
```bash
4218
curl 'https://api.aimlapi.com/v1/models?include=pricing'
@@ -55,7 +31,7 @@ Unknown values are ignored rather than rejected, so a typo returns a valid respo
5531

5632
## Filtering
5733

58-
Every filter below narrows _which models_ come back. They are independent of `include`, so you can filter on capabilities without asking for the capabilities section.
34+
Every filter below narrows _which models_ come back. Filters are independent of `include`, so you can filter on capabilities without asking for the capabilities section.
5935

6036
| Parameter | Keeps models that… |
6137
| ------------------- | -------------------------------------------- |
@@ -67,8 +43,6 @@ Every filter below narrows _which models_ come back. They are independent of `in
6743
| `output_modalities` | produce this output modality |
6844
| `capabilities` | declare this capability |
6945

70-
Rules that apply to all of them:
71-
7246
* **Several values, one parameter — OR.** `?capabilities=text_to_video,image_to_video` returns models that do either.
7347
* **Several parameters — AND.** `?output_modalities=video&capabilities=audio_generation` returns models that do both.
7448
* Values are **case-insensitive**, and may be given comma-separated (`?tags=a,b`) or repeated (`?tags=a&tags=b`). Both forms merge.
@@ -82,10 +56,25 @@ curl 'https://api.aimlapi.com/v1/models?capabilities=image_to_video'
8256
curl 'https://api.aimlapi.com/v1/models?id=deepgram/aura-2&include=pricing'
8357
```
8458

59+
## Get the model catalogue
60+
61+
Returns the full list of models matching the given filters, with the requested optional sections attached.
62+
63+
## GET /v1/models
64+
65+
>
66+
67+
```json
68+
{"openapi":"3.0.0","info":{"title":"AIML API","version":"1.0.0"},"servers":[{"url":"https://api.aimlapi.com"}],"paths":{"/v1/models":{"get":{"operationId":"ModelsController_getModelsV2","parameters":[{"name":"id","in":"query","required":false,"description":"Keep models matching this id, or carrying it as an alias. Comma-separated or repeated values are OR'd together.","schema":{"type":"string"}},{"name":"type","in":"query","required":false,"description":"Keep models served through this endpoint type.","schema":{"type":"string"}},{"name":"tags","in":"query","required":false,"description":"Keep models carrying this tag, e.g. playground:video. Comma-separated or repeated values are OR'd together.","schema":{"type":"string"}},{"name":"modalities","in":"query","required":false,"description":"Keep models with this modality among either their input or output modalities.","schema":{"type":"string"}},{"name":"input_modalities","in":"query","required":false,"description":"Keep models accepting this input modality.","schema":{"type":"string"}},{"name":"output_modalities","in":"query","required":false,"description":"Keep models producing this output modality.","schema":{"type":"string"}},{"name":"capabilities","in":"query","required":false,"description":"Keep models declaring this capability, e.g. image_to_video. Comma-separated or repeated values are OR'd together; combining with other filter parameters is AND'd.","schema":{"type":"string"}},{"name":"include","in":"query","required":false,"description":"Attach optional sections to each model: pricing, modalities, capabilities, or all (?details=true is a synonym for all). Comma-separated. Unknown values are ignored rather than rejected.","schema":{"type":"string"}}],"responses":{"200":{"description":"The live model catalogue, filtered and expanded as requested. Responses carry an ETag; see Caching below.","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","description":"Always \"list\"."},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Canonical unique identifier of the model."},"aliases":{"type":"array","nullable":true,"description":"Other names this model can still be requested under.","items":{"type":"string"}},"type":{"type":"string","description":"Endpoint type this model is served through."},"info":{"type":"object","description":"Model identity.","properties":{"name":{"type":"string","description":"Human-readable model name."},"developer":{"type":"string","description":"Organization or company that developed the model."}},"required":["name","developer"]},"tags":{"type":"array","description":"Free-form tags, e.g. playground:tts.","items":{"type":"string"}},"pricing":{"type":"object","nullable":true,"description":"Present only with ?include=pricing or all. See Reading prices below."},"modalities":{"type":"object","nullable":true,"description":"Present only with ?include=modalities or all. Input and output modalities the model handles."},"capabilities":{"type":"array","nullable":true,"description":"Present only with ?include=capabilities or all. Declared capabilities, e.g. image_to_video.","items":{"type":"string"}}},"required":["id","type","info","tags"]}}},"required":["object","data"]}}}}}}}}}}
69+
```
70+
8571
## Checking whether a model is still available
8672

87-
Match against **`id` and `aliases` together**. A model may be published under a canonical id while the name you integrated against lives on as an alias — the alias keeps working, but it is not the `id` any more, so an `id`-only comparison reports a live model as gone.
73+
{% hint style="warning" %}
74+
Match against **`id` and `aliases` together**, not `id` alone. A model may be published under a canonical id while the name you integrated against lives on as an alias — the alias keeps working, but it is not the `id` any more, so an `id`-only comparison reports a live model as gone.
75+
{% endhint %}
8876

77+
{% code overflow="wrap" %}
8978
```js
9079
const res = await fetch('https://api.aimlapi.com/v1/models');
9180
const { data } = await res.json();
@@ -98,6 +87,7 @@ for (const model of data) {
9887

9988
const canonical = byName.get(myModelId); // undefined ⇒ genuinely unavailable
10089
```
90+
{% endcode %}
10191
10292
The same map de-duplicates your list: two names resolving to one canonical id are one model, not two.
10393
@@ -111,7 +101,9 @@ With `?include=pricing`, each model carries a `pricing` block. Read `kind` first
111101
| `variants` | the rate depends on request parameters — `dimensions` names them, `variants[]` quotes a rate per combination |
112102
| `variable` | the rate cannot be quoted ahead of the request |
113103
114-
**Always read `per` together with `price`.** `price` is the charge for `per` units, and `per` is not the same across models — `1000000` for most token rates, `1000` for some, `1` for per-second and per-megapixel rates. Comparing bare `price` values across models compares different bases and will be wrong by orders of magnitude.
104+
{% hint style="warning" %}
105+
Always read `per` together with `price`. `price` is the charge for `per` units, and `per` is not the same across models — `1000000` for most token rates, `1000` for some, `1` for per-second and per-megapixel rates. Comparing bare `price` values across models compares different bases and will be wrong by orders of magnitude.
106+
{% endhint %}
115107
116108
```json
117109
{
@@ -141,4 +133,6 @@ curl -H 'If-None-Match: W/"1440a0-uH6NONsG/9An5njw3kqMcYY5k8w"' \
141133
# 304
142134
```
143135
136+
{% hint style="info" %}
144137
The ETag covers the whole response, so it changes on any catalogue edit — a new model or a reworded description, not only a price change. Treat it as "something moved, re-read and diff", not as a price-change feed.
138+
{% endhint %}

0 commit comments

Comments
 (0)