0

Upscale a generation

by
Published Oct 17, 2025

Upscale a generation by its ID

Script lumaai Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Lumaai = {
3
  apiKey: string;
4
};
5
/**
6
 * Upscale a generation
7
 * Upscale a generation by its ID
8
 */
9
export async function main(
10
  auth: Lumaai,
11
  id: string,
12
  body: {
13
    generation_type?: "upscale_video";
14
    resolution?: string;
15
    callback_url?: string;
16
  },
17
) {
18
  const url = new URL(
19
    `https://api.lumalabs.ai/dream-machine/v1/generations/${id}/upscale`,
20
  );
21

22
  const response = await fetch(url, {
23
    method: "POST",
24
    headers: {
25
      "Content-Type": "application/json",
26
      Authorization: "Bearer " + auth.apiKey,
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