//native
type Replicate = {
token: string;
};
/**
* Delete a model
* Delete a model
Model deletion has some restrictions:
- You can only delete models you own.
*/
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: "DELETE",
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