1
//native
2
type Deepinfra = {
3
token: string;
4
};
5
/**
6
* Deploy Create Llm
7
*
8
*/
9
export async function main(
10
auth: Deepinfra,
11
body: {
12
model_name: string;
13
gpu: "A100-80GB" | "H100-80GB" | "H200-141GB";
14
num_gpus?: number;
15
max_batch_size?: number;
16
hf?: { repo: string; revision?: string; token?: string };
17
settings?: { min_instances?: number; max_instances?: number };
18
},
19
) {
20
const url = new URL(`https://api.deepinfra.com/deploy/llm`);
21
22
const response = await fetch(url, {
23
method: "POST",
24
headers: {
25
"Content-Type": "application/json",
26
Authorization: "Bearer " + auth.token,
27
28
body: JSON.stringify(body),
29
});
30
if (!response.ok) {
31
const text = await response.text();
32
throw new Error(`${response.status} ${text}`);
33
}
34
return await response.json();
35
36