Api18.dev

SDKs & snippets

There's no package to install — the API is plain HTTP. Copy the snippets below in cURL, JavaScript or Python.

Request + polling#

End-to-end example using centaurus-1.0-text-to-video. Swap the id and body per the model page.

curl -X POST "https://api18.dev/v1/generate?wait=true" \
  -H "Authorization: Bearer $API18_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"centaurus-1.0-text-to-video","prompt":"A cinematic shot of a city street at night, neon reflections on wet pavement, slow dolly-in","resolution":"720p","aspect_ratio":"16:9","duration":5}'

# → returns the finished job; the output URL is at .data[0].url

Reusable helper#

A small generate() client that does POST + polling and returns the URLs. Drop it into your project:

// api18.js — minimal helper (no dependencies)
const BASE = "https://api18.dev";
const KEY = process.env.API18_KEY;
const headers = { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json" };

export async function generate(endpoint, body, { pollMs = 3000 } = {}) {
  let job = await fetch(BASE + endpoint, {
    method: "POST", headers, body: JSON.stringify(body),
  }).then((r) => r.json());

  while (job.status !== "completed" && job.status !== "failed") {
    await new Promise((r) => setTimeout(r, pollMs));
    job = await fetch(BASE + "/v1/jobs/" + job.id, { headers }).then((r) => r.json());
  }
  if (job.status === "failed") throw new Error(job.error || "generation failed");
  return job.data.map((d) => d.url);
}

// usage:
const urls = await generate("/v1/video/generations", {"model":"centaurus-1.0-text-to-video","prompt":"A cinematic shot of a city street at night, neon reflections on wet pavement, slow dolly-in","resolution":"720p","aspect_ratio":"16:9","duration":5});
console.log(urls);
Integrating with an AI assistant? Paste the contents of /llms-full.txt into your assistant — or the model-specific llms.txt for the model you're using.
SDKs — cURL, JavaScript & Python — Api18.dev Docs