Langsung ke konten utama

Documentation Index

Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt

Use this file to discover all available pages before exploring further.

Gunakan dokumentasi model video CometAPI dengan memilih alur kerja penyedia yang sesuai dengan jenis tugas Anda. Sebagian besar endpoint video membuat tugas asinkron, jadi simpan task ID dan gunakan polling untuk mengambil hasil. Tambahkan callback hanya ketika halaman khusus model mendokumentasikan dukungan callback.

Pilih API video

Create Sora video

Buat tugas video Sora.

Retrieve Sora video

Query tugas video Sora.

Runway image to video

Hasilkan video Runway dari gambar.

Kling text to video

Hasilkan video Kling dari text prompt.

Seedance create

Buat tugas video Seedance.

xAI video generation

Hasilkan tugas video xAI.

Buat dan polling tugas video

Gunakan model ID yang mendukung video dari Models page atau model directory. Contoh di bawah ini membuat tugas video dengan POST /v1/videos, lalu melakukan polling pada task ID yang dikembalikan sampai tugas mencapai status terminal.
Contoh ini menggunakan placeholder your-video-model-id. Ganti dengan model ID video yang tersedia dari Models page atau model directory sebelum Anda menjalankan request.
Buka Create dan Query untuk menggunakan API playground dan skema endpoint.
import os
import time
import requests

headers = {"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]}

create_response = requests.post(
    "https://api.cometapi.com/v1/videos",
    headers=headers,
    data={
        "model": "your-video-model-id",
        "prompt": "A calm camera move across a desk with a paper airplane",
    },
    timeout=30,
)
create_response.raise_for_status()
task = create_response.json()
task_id = task["id"]

terminal_statuses = {"completed", "failed", "error"}

while True:
    poll_response = requests.get(
        f"https://api.cometapi.com/v1/videos/{task_id}",
        headers=headers,
        timeout=30,
    )
    poll_response.raise_for_status()
    result = poll_response.json()
    print(result["status"], result.get("progress"))

    if result["status"] in terminal_statuses:
        print(result.get("video_url"))
        break

    time.sleep(10)

Contoh respons

Respons create yang berhasil dapat terlihat seperti ini. Simpan task ID sebelum melakukan polling:
{
  "id": "task_example",
  "task_id": "task_example",
  "object": "video",
  "model": "your-video-model-id",
  "status": "queued",
  "progress": 0,
  "created_at": 1779872000
}
Respons polling yang berhasil dapat terlihat seperti ini. Respons yang selesai dapat menyertakan video_url; beberapa format provider menggunakan field hasil khusus model atau route konten video ketika route tersebut didokumentasikan:
{
  "id": "task_example",
  "object": "video",
  "model": "your-video-model-id",
  "status": "completed",
  "progress": 100,
  "completed_at": 1779872300,
  "video_url": "https://example.com/generated-video.mp4"
}

Contoh record model

Contoh respons katalog model ini menampilkan envelope /api/models dan satu bentuk record model video. Ini bukan daftar model lengkap.
cURL
curl https://api.cometapi.com/api/models
{
  "success": true,
  "page": 1,
  "page_size": 20,
  "total": 302,
  "data": [
    {
      "created": 1767529753,
      "id": "your-video-model-id",
      "code": "your-video-model-id",
      "provider": "ExampleProvider",
      "provider_code": "example",
      "name": "Example video model",
      "model_type": "video",
      "features": [
        "text-to-video"
      ],
      "endpoints": "{\n  \"seedance\": {\n    \"path\": \"/v1/videos\",\n    \"method\": \"POST\"\n  }\n}",
      "pricing": {
        "currency": "USD / M Tokens",
        "input": null,
        "output": null,
        "per_request": null,
        "per_second": 0.024
      }
    }
  ]
}

Error umum

Simpan ID dari respons create sebelum kembali dari job handler Anda.
Tambahkan delay dan backoff di antara pengecekan status.
Gunakan field durasi dan resolusi yang didokumentasikan untuk endpoint video yang dipilih.
Perlakukan video_url sebagai opsional dan fallback ke field hasil khusus model atau route konten jika tersedia.
Gunakan polling sebagai sumber kebenaran dan verifikasi bahwa callback URL Anda menerima request POST.

Kode error dan strategi retry

Jangan retry sampai field prompt, files, duration, atau size diperbaiki.
Jangan retry sampai API key tersedia dan valid.
Periksa task ID, base URL, path, dan model ID sebelum retry.
Kurangi ukuran upload sebelum retry.
Retry dengan exponential backoff dan kurangi concurrency create atau polling.
Retry pembuatan tugas dengan backoff; terus lakukan polling pada tugas yang sudah ada kecuali tugas mencapai terminal error.

Harga dan direktori model

Models page

Baca cara CometAPI mengekspos model IDs di dokumentasi.

Model directory

Telusuri ketersediaan dan kemampuan model.

Pricing

Periksa harga sebelum Anda memanggil model.
Last modified on May 28, 2026