// Run as a Node.js .mjs file.
const headers = {
"x-api-key": process.env.BEEBLE_API_KEY,
"Content-Type": "application/json",
}
if (process.env.BEEBLE_TEAM_ID) {
headers["X-Beeble-Team-Id"] = process.env.BEEBLE_TEAM_ID
}
const response = await fetch("https://api.beeble.ai/v1/products/switchx/jobs", {
method: "POST",
headers,
body: JSON.stringify({
model_id: "switchx-2.0",
idempotency_key: "first-switchx-001",
inputs: {
source: "beeble://uploads/your-upload-id/source.png",
alpha_mode: "fill",
max_resolution: 720,
prompt: "Warm studio lighting",
mode: "standard",
},
}),
signal: AbortSignal.timeout(120_000),
})
if (!response.ok) throw new Error(await response.text())
const { id: jobId } = await response.json()
console.log(jobId)