Guides

Generate images and video

Drive image and video models from the CLI, on the same key as your text models.

OpenLLM is not only for chat. The same key and the same gateway reach image, video, audio, and embedding models, so you can generate media from your terminal or from inside a coding tool without wiring up a second service. This guide covers the image and video endpoints and how to reach them from the CLI.

The media endpoints

Everything lives behind your one gateway URL, in OpenAI-compatible shapes:

  • POST /v1/images/generations: generate an image from a prompt.
  • POST /v1/videos: start a video generation job.
  • GET /v1/videos/{id}: check a video job's status.
  • GET /v1/videos/{id}/content: download the finished video.
  • POST /v1/audio/speech and POST /v1/audio/transcriptions: text-to-speech and transcription.
  • POST /v1/embeddings: embeddings.

As with text, these run on the accounts you connected, billed by your provider at your provider's price, with no markup. Which image and video models you can call depends on which providers you have connected under Providers.

Generate an image

curl https://openllm.sh/v1/images/generations \
  -H "Authorization: Bearer sk-llm-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-1",
    "prompt": "A wide hero image of a calm desert at dawn, muted tones",
    "size": "1536x1024"
  }'

Swap model for any image model your connected providers expose. Call /v1/models to see what is available on your accounts.

Generate a video

Video is a job: you start it, poll until it is ready, then download it.

# 1. Start the job (returns an id and a status)
curl https://openllm.sh/v1/videos \
  -H "Authorization: Bearer sk-llm-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "your-video-model",
    "prompt": "A slow aerial push over a coastline at golden hour",
    "seconds": "8",
    "size": "720x1280"
  }'

# 2. Poll status until status is "completed"
curl https://openllm.sh/v1/videos/VIDEO_ID \
  -H "Authorization: Bearer sk-llm-YOUR_KEY"

# 3. Download the finished file
curl https://openllm.sh/v1/videos/VIDEO_ID/content \
  -H "Authorization: Bearer sk-llm-YOUR_KEY" \
  -o out.mp4

From inside a coding tool

The OpenLLM CLI serves an MCP server that exposes the full gateway API, including these media endpoints, to any agent that speaks MCP. With the CLI installed, a coding agent can generate an image or kick off a video job as part of a task (mocking up a hero image, producing a demo clip) without leaving the tool or holding a separate provider key. Install it from Connect your tools:

curl -fsSL "https://openllm.sh/api/setup/cli/install.sh" | bash

Then point your agent at the openllmc MCP server and the image and video operations show up alongside the rest of the gateway API.

On this page