Gemini media
Generate images, speech and video with the Google GenAI SDK: generateContent, predict and predictLongRunning through the Gemini endpoints.
The Gemini endpoints also run media models.
Base URL:
https://platform-api.invideo.iofrom google import genai
from google.genai import types
import os, base64
client = genai.Client(api_key=os.environ["INVIDEO_API_KEY"], http_options={"base_url": "https://platform-api.invideo.io", "api_version": "v1beta"})
response = client.models.generate_content(
model="gemini-2.5-flash-image",
contents="A red fox in fresh snow",
config=types.GenerateContentConfig(response_modalities=["IMAGE"], image_config=types.ImageConfig(aspect_ratio="16:9")),
)
image = response.candidates[0].content.parts[0].inline_data.datagenerateContentandstreamGenerateContentrun image and speech models and answerinlineDataparts.predictruns image models in Imagen's shape (predictions[].bytesBase64Encoded).predictLongRunningruns video models (Veo); read the operation withGET /v1beta/models/{model}/operations/{id}untildone. The video isresponse.generateVideoResponse.generatedSamples[0].video.uri.candidateCountandsampleCountmust be 1.