Skip to content

Gemini Omni Flash: video dal modello chat

Omni riceve testo e media tramite chat/completions e può generare un risultato media nella risposta. Parametri e risposta differiscono dalla Media API asincrona.

  • I messaggi possono contenere URL di immagini, GIF, audio o video supportati.
  • Usa messages OpenAI-compatible e l'ID Omni completo.
  • La funzione è disponibile anche in Studio e nel bot Telegram.

Esempi completi

Tutti gli esempi eseguibili della guida originale sono conservati qui sotto. Esegui solo i blocchi adatti al tuo strumento e sistema operativo.

bash
curl https://nordrouter.com/v1/chat/completions \
  -H "Authorization: Bearer sk-nr-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-omni-flash-preview",
    "messages": [{"role": "user", "content": "Generate a video: a red balloon floating over a calm sea"}],
    "modalities": ["image", "text"],
    "max_tokens": 4000
  }'
json
{
  "model": "google/gemini-omni-flash-preview",
  "messages": [{
    "role": "user",
    "content": [
      { "type": "text", "text": "Create an ad: use the person from the photo, motion from the reference video, and cut to the audio beat" },
      { "type": "image_url", "image_url": { "url": "https://example.com/hero.png" } },
      { "type": "image_url", "image_url": { "url": "https://example.com/style.gif" } },
      { "type": "input_audio", "input_audio": { "data": "BASE64_AUDIO", "format": "wav" } },
      { "type": "video_url", "video_url": { "url": "https://example.com/motion.mp4" } }
    ]
  }],
  "modalities": ["image", "text"],
  "max_tokens": 4000
}
json
{
  "choices": [{
    "message": {
      "role": "assistant",
      "content": "I've generated the video for you.",
      "videos": [{ "type": "video_url",
                   "video_url": { "url": "https://nordrouter.com/media/file/…" } }]
    }
  }],
  "usage": { "prompt_tokens": 18, "completion_tokens": 58197, "total_tokens": 58215 }
}

Documentazione ufficiale e collegamenti

Omni FlashRegular video models (/media/generate)
EndpointPOST /v1/chat/completionsPOST /media/generate
Billingper token (input $0.2322 / output $1.3932 per 1M)flat per generation
Speed~40–60 s, synchronous responsetask + polling
Video price≈ $0.08from $0.11

Guide correlate

Verifica prima la connessione con una richiesta testuale minima, quindi aggiungi streaming, chiamate agli strumenti, immagini e altre funzioni avanzate. Non inserire mai la chiave API in codice pubblico o nel frontend del browser.

Risoluzione dei problemi