//native
type Cohere = {
apiKey: string;
};
/**
* Get a Model
* Returns the details of a model, provided its name.
*/
export async function main(auth: Cohere, model: string) {
const url = new URL(`https://api.cohere.com/v1/models/${model}`);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + auth.apiKey,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 428 days ago