0

List public models

by
Published Oct 17, 2025

Get a paginated list of public models. Example cURL request: ```console curl -s \ -H "Authorization: Bearer $REPLICATE_API_TOKEN" \ https://api.replicate.com/v1/models ``` The response will be a pagination object containing a list of model objects. See the [`models.get`](#models.get) docs for more details about the model object.

Script replicate Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Replicate = {
3
  token: string;
4
};
5
/**
6
 * List public models
7
 * Get a paginated list of public models.
8

9
Example cURL request:
10

11
```console
12
curl -s \
13
  -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
14
  https://api.replicate.com/v1/models
15
```
16

17
The response will be a pagination object containing a list of model objects.
18

19
See the [`models.get`](#models.get) docs for more details about the model object.
20

21
 */
22
export async function main(auth: Replicate) {
23
  const url = new URL(`https://api.replicate.com/v1/models`);
24

25
  const response = await fetch(url, {
26
    method: "GET",
27
    headers: {
28
      Authorization: "Bearer " + auth.token,
29
    },
30
    body: undefined,
31
  });
32
  if (!response.ok) {
33
    const text = await response.text();
34
    throw new Error(`${response.status} ${text}`);
35
  }
36
  return await response.json();
37
}
38