0

List available hardware for models

by
Published Oct 17, 2025

Example cURL request: ```console curl -s \ -H "Authorization: Bearer $REPLICATE_API_TOKEN" \ https://api.replicate.com/v1/hardware ``` The response will be a JSON array of hardware objects: ```json [ {"name": "CPU", "sku": "cpu"}, {"name": "Nvidia T4 GPU", "sku": "gpu-t4"}, {"name": "Nvidia A40 GPU", "sku": "gpu-a40-small"}, {"name": "Nvidia A40 (Large) GPU", "sku": "gpu-a40-large"}, ] ```

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 available hardware for models
7
 * Example cURL request:
8

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

15
The response will be a JSON array of hardware objects:
16

17
```json
18
[
19
    {"name": "CPU", "sku": "cpu"},
20
    {"name": "Nvidia T4 GPU", "sku": "gpu-t4"},
21
    {"name": "Nvidia A40 GPU", "sku": "gpu-a40-small"},
22
    {"name": "Nvidia A40 (Large) GPU", "sku": "gpu-a40-large"},
23
]
24
```
25

26
 */
27
export async function main(auth: Replicate) {
28
  const url = new URL(`https://api.replicate.com/v1/hardware`);
29

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