//native
type Replicate = {
token: string;
};
/**
* List public models
* 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.
*/
export async function main(auth: Replicate) {
const url = new URL(`https://api.replicate.com/v1/models`);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago