Skip to main content

Multimodal media generation CLI for Google GenAI

Project description

genmedia

Multimodal media generation CLI for Google GenAI. Images, video, and image editing from the terminal. Bring your own API key.

Install

pipx (recommended)

pipx install git+https://github.com/tennyson-mccalla/genmedia.git

pip

pip install git+https://github.com/tennyson-mccalla/genmedia.git

Requires Python 3.11+.

Setup

Get a Gemini API key and set it:

export GEMINI_API_KEY="your-key-here"

Usage

Generate images

# Simple
genmedia image "a cat on a skateboard" --pretty

# Full control
genmedia image "abstract gradient, soft pastels" \
  --model gemini-3.1-flash-image-preview \
  --size 4K \
  --aspect 16:9 \
  --output backgrounds/pastel.png

# Batch
genmedia image "product mockup on marble" --count 3 --output-dir shots/

# Using Imagen
genmedia image "photorealistic mountain lake" --model imagen-4.0-generate-001

Edit images

genmedia edit input.png "remove the background" --pretty
genmedia edit photo.jpg "make the sky more dramatic" -o edited.jpg

Generate video

# Text-to-video
genmedia video "a cat riding a skateboard downhill at sunset" --duration 8 --pretty

# Image-to-video (animate a still image)
genmedia video "the scene comes to life" --image keyframe.jpg --pretty

# Frame interpolation (morph between two images)
genmedia video "smooth transition" --image start.jpg --last-frame end.jpg

List models

genmedia image --list-models
genmedia video --list-models

Dry run

genmedia image "test" --dry-run   # shows request payload without calling API

Output

JSON by default (for AI agents and scripts):

{
  "status": "success",
  "files": [
    {
      "path": "/tmp/genmedia/genmedia_001.jpg",
      "mime_type": "image/jpeg",
      "size_bytes": 534182
    }
  ],
  "model": "gemini-3.1-flash-image-preview",
  "elapsed_seconds": 14.3,
  "request": {
    "prompt": "a cat on a skateboard",
    "aspect_ratio": "16:9"
  }
}

Use --pretty for human-friendly output:

Saved to /tmp/genmedia/genmedia_001.jpg (521.7 KB)
Model: gemini-3.1-flash-image-preview | Time: 14.3s

Errors go to stderr as JSON with distinct exit codes:

  • 0 — success
  • 1 — API error (rate limit, server error, content blocked)
  • 2 — validation error (bad params, missing API key)
  • 3 — file I/O error

Models

Image generation

Model Notes
gemini-3.1-flash-image-preview Default. Best quality.
gemini-3-pro-image-preview Previous generation.
gemini-2.5-flash-image Older, faster.
imagen-4.0-generate-001 Imagen. Different API, good for photorealism.

Video generation

Model Notes
veo-3.0-generate-001 Default. Standard quality.
veo-3.0-fast-generate-001 Faster, lower quality.
veo-3.1-generate-preview Newer preview.
veo-3.1-fast-generate-preview Newer fast preview.

For AI agents

genmedia is designed to be called by AI agents. JSON output by default, structured errors on stderr, distinct exit codes for branching. No interactive prompts, no spinners unless --pretty is set.

import subprocess, json

result = subprocess.run(
    ["genmedia", "image", "a logo for my app", "--aspect", "1:1"],
    capture_output=True, text=True
)

if result.returncode == 0:
    data = json.loads(result.stdout)
    image_path = data["files"][0]["path"]

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

genmedia-0.1.0.tar.gz (42.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

genmedia-0.1.0-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file genmedia-0.1.0.tar.gz.

File metadata

  • Download URL: genmedia-0.1.0.tar.gz
  • Upload date:
  • Size: 42.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for genmedia-0.1.0.tar.gz
Algorithm Hash digest
SHA256 adb00d22b93791315c314bdc3eed1075f0b3cebc5c4ff254ae73692948f0e5f3
MD5 d757939658cf5bd1a7068a1d98787879
BLAKE2b-256 2d2258ca698b2b6ca09bdfbfe295be8eb3abf7b37b1ac165c1bb7f9e26e35b13

See more details on using hashes here.

File details

Details for the file genmedia-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: genmedia-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for genmedia-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be0ef2651044af3aa9794a0c0b2277849a4664280a54f1a972b9af1d0381b100
MD5 a949e891f9f6dd9b1033d52750d06a7e
BLAKE2b-256 d9404bffc0e6bd3898643c1ce95865e99a098850fd19ad74c0553a0dd9350054

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page