0

Model Meta Update

by
Published Oct 17, 2025
Script deep_infra Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Deepinfra = {
3
  token: string;
4
};
5
/**
6
 * Model Meta Update
7
 *
8
 */
9
export async function main(
10
  auth: Deepinfra,
11
  model_name: string,
12
  body: {
13
    description?: string;
14
    github_url?: string;
15
    paper_url?: string;
16
    license_url?: string;
17
    readme?: string;
18
    cover_img_url?: string;
19
    reported_type?:
20
      | "automatic-speech-recognition"
21
      | "image-classification"
22
      | "question-answering"
23
      | "token-classification"
24
      | "text-to-image"
25
      | "fill-mask"
26
      | "zero-shot-image-classification"
27
      | "text2text-generation"
28
      | "text-generation"
29
      | "text-classification"
30
      | "object-detection"
31
      | "embeddings"
32
      | "dreambooth"
33
      | "custom"
34
      | "text-to-speech"
35
      | "text-to-video";
36
  },
37
) {
38
  const url = new URL(`https://api.deepinfra.com/models/${model_name}/meta`);
39

40
  const response = await fetch(url, {
41
    method: "POST",
42
    headers: {
43
      "Content-Type": "application/json",
44
      Authorization: "Bearer " + auth.token,
45
    },
46
    body: JSON.stringify(body),
47
  });
48
  if (!response.ok) {
49
    const text = await response.text();
50
    throw new Error(`${response.status} ${text}`);
51
  }
52
  return await response.json();
53
}
54