//native
type Replicate = {
token: string;
};
/**
* Get a model
* Example cURL request:
```console
curl -s \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
https://api.
*/
export async function main(
auth: Replicate,
model_owner: string,
model_name: string,
) {
const url = new URL(
`https://api.replicate.com/v1/models/${model_owner}/${model_name}`,
);
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.text();
}
Submitted by hugo697 235 days ago