0

Inference Deploy

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
 * Inference Deploy
7
 *
8
 */
9
export async function main(
10
  auth: Deepinfra,
11
  deploy_id: string,
12
  x_deepinfra_source: string,
13
  user_agent: string,
14
) {
15
  const url = new URL(
16
    `https://api.deepinfra.com/v1/inference/deploy/${deploy_id}`,
17
  );
18

19
  const response = await fetch(url, {
20
    method: "POST",
21
    headers: {
22
      "x-deepinfra-source": x_deepinfra_source,
23
      "user-agent": user_agent,
24
      Authorization: "Bearer " + auth.token,
25
    },
26
    body: undefined,
27
  });
28
  if (!response.ok) {
29
    const text = await response.text();
30
    throw new Error(`${response.status} ${text}`);
31
  }
32
  return await response.json();
33
}
34