Bild zu Video

Grok Imagine Video — image to video

Grok Imagine Video — image to video über die MegaBrain API (Bild zu Video): $0.0144 pro Sekunde Video. Ein Schlüssel für alle Modelle, Bezahlung aus einem Prepaid-Guthaben in US-Dollar, ohne Abo.

xai/grok-imagine-video/image-to-video
Preis
$0.0144
pro Sekunde Video

Dauer 6–30 s; ein Video mit 6 s kostet $0.0864.

Wird abgebucht, wenn der Auftrag in die Warteschlange kommt, und erstattet, wenn die Generierung scheitert.

Beispielergebnis

Im Browser ausprobieren

Nach der Anmeldung führt der Playground auf der englischen Seite Grok Imagine Video — image to video im Browser aus, bezahlt aus demselben Guthaben wie die API.

Playground öffnen

Anfrageparameter

Felder des JSON-Bodys der Anfrage. Andere Felder nimmt das Modell nicht an: Eine Anfrage mit ihnen erhält einen 400-Fehler.

  • promptStringoptional
  • image_urlsListe von URLserforderlich
    Bis zu 7 Einträge
  • resolutionStringoptional
    Standard:
    480p
    Werte:
    480p, 720p, 1080p
  • modeStringoptional
    Standard:
    normal
    Werte:
    fun, normal
  • durationStringoptional
    Standard:
    6
    Werte:
    6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
  • aspect_ratioStringoptional
    Standard:
    16:9
    Werte:
    2:3, 3:2, 1:1, 16:9, 9:16

Nutzung über die API

Senden Sie den Auftrag, fragen Sie seine status_url ab, bis sie COMPLETED meldet, und holen Sie das Ergebnis von response_url. Derselbe Schlüssel und dasselbe Guthaben gelten für die Textmodelle. API-Dokumentation (auf Englisch)

curl

curl -X POST https://getmegabrain.com/api/gateway/v1/queue/xai/grok-imagine-video/image-to-video \
  -H "Authorization: Bearer $MEGABRAIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"a slow dolly shot of a lighthouse at dawn, waves below","image_urls":["https://example.com/photo.jpg"]}'

# Then poll status_url and fetch the result from response_url:
curl https://getmegabrain.com/api/gateway/v1/queue/requests/$REQUEST_ID -H "Authorization: Bearer $MEGABRAIN_API_KEY"

Python

import os, time, requests

BASE = "https://getmegabrain.com/api/gateway/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['MEGABRAIN_API_KEY']}"}

job = requests.post(f"{BASE}/queue/xai/grok-imagine-video/image-to-video", headers=HEADERS, json={
  "prompt": "a slow dolly shot of a lighthouse at dawn, waves below",
  "image_urls": [
    "https://example.com/photo.jpg"
  ]
}).json()

while requests.get(job["status_url"], headers=HEADERS).json()["status"] not in ("COMPLETED", "FAILED"):
    time.sleep(2)

print(requests.get(job["response_url"], headers=HEADERS).json())

JavaScript

const BASE = 'https://getmegabrain.com/api/gateway/v1';
const headers = {
  Authorization: `Bearer ${process.env.MEGABRAIN_API_KEY}`,
  'Content-Type': 'application/json',
};

const job = await fetch(`${BASE}/queue/xai/grok-imagine-video/image-to-video`, {
  method: 'POST',
  headers,
  body: JSON.stringify({
    "prompt": "a slow dolly shot of a lighthouse at dawn, waves below",
    "image_urls": [
      "https://example.com/photo.jpg"
    ]
  }),
}).then(r => r.json());

let status = job.status;
while (status !== 'COMPLETED' && status !== 'FAILED') {
  await new Promise(r => setTimeout(r, 2000));
  ({ status } = await fetch(job.status_url, { headers }).then(r => r.json()));
}
console.log(await fetch(job.response_url, { headers }).then(r => r.json()));

Häufige Fragen

Was kostet die Grok Imagine Video — image to video API?

$0.0144 pro Sekunde Video: Ein Video mit 6 Sekunden kostet $0.0864. Der Betrag wird aus einem Prepaid-Guthaben in US-Dollar abgebucht; eine fehlgeschlagene Generierung wird vollständig erstattet. Es gibt kein Abo.

Wie nutze ich Grok Imagine Video — image to video über die API?

Senden Sie den Auftrag mit POST https://getmegabrain.com/api/gateway/v1/queue/xai/grok-imagine-video/image-to-video und Ihrem MegaBrain API-Schlüssel, fragen Sie seine status_url ab, bis sie COMPLETED meldet, und holen Sie das Ergebnis von response_url. Derselbe Schlüssel und dasselbe Guthaben gelten für die Textmodelle.

Kann ich Grok Imagine Video — image to video ohne Code ausprobieren?

Ja: Nach der Anmeldung führt der Playground auf der englischen Seite des Modells Grok Imagine Video — image to video im Browser aus, bezahlt aus demselben Guthaben wie die API.

Nimmt Grok Imagine Video — image to video ein Eingabebild an?

Ja: Übergeben Sie das Bild in image_urls (eine Liste von Bild-URLs), und Grok Imagine Video — image to video macht daraus ein Video.

Wie lang kann ein Video von Grok Imagine Video — image to video sein?

6–30 Sekunden, eingestellt über das Feld duration.