Skip to content

videoeditor-genai: typed image-generation clients (Grok Imagine + Imagen) and an image subcommand#8

Merged
darioalessandro merged 1 commit into
mainfrom
feat/genai-image-client
Jul 8, 2026
Merged

videoeditor-genai: typed image-generation clients (Grok Imagine + Imagen) and an image subcommand#8
darioalessandro merged 1 commit into
mainfrom
feat/genai-image-client

Conversation

@darioalessandro

Copy link
Copy Markdown
Member

What

New crate videoeditor-genai with typed clients for still-image generation, plus a videoeditor image subcommand, so episodes can optionally generate assets (memes, mascots-in-costume, backdrops) without leaving the pipeline.

  • xai module — Grok Imagine (XAI_API_KEY): text→image with reference-image conditioning (--ref, up to 7, encoded as data-URL strings), up to 10 variants, typed AspectRatio enum matching the values the API enumerates. Requests b64_json because xAI's asset CDN 403s plain downloads (June 2026); a UA-header url fallback remains.
  • google module — Imagen 4 (AI_STUDIO/GEMINI_API_KEY): aspect-true safe stills via the Gemini :predict endpoint. Takes no reference images — such requests are rejected with a message routing to grok; empty predictions is reported as a probable safety-filter rejection. Veo (video) is this module's planned next resident.
  • CLI: videoeditor image "prompt" -o out.png [--provider grok|imagen] [--ref img ...] [-n N] [--aspect 1:1] [--model id] — writes _v1.._vN suffixes for multi-variant runs, prints revised prompts when the provider rewrites.
  • Docs: guide.md pipeline + Env, CLAUDE.md layout.

Provider behavior (ref ceiling, CDN workaround, filter routing, b64 preference) ported from production use in the fallout-is-real-life engine's provider layer.

Testing

  • just check clean; unit tests cover payload shape (refs as plain strings, omitted empty optionals, camelCase Imagen params) and aspect-ratio parsing.
  • Live-tested end to end: generated 3 reference-conditioned meme stills for ep004 from the Bun logo (--ref bun.png -n 3 --aspect 1:1), including a moderation-rejection path (surfaces the API's message cleanly).

🤖 Generated with Claude Code

… an `image` subcommand

New crate videoeditor-genai: typed request/response bindings for still-image
generation, built for optional episode-asset generation from the CLI:

- xai module: Grok Imagine images (OpenAI-compatible endpoint) with
  reference-image conditioning (data-URL strings, ≤7), n≤10, aspect_ratio
  enum probed from the API, b64_json responses (the asset CDN 403s plain
  downloads; url branch kept as UA-header fallback).
- google module: Imagen 4 stills via the Gemini :predict endpoint —
  aspect-true, no reference input (requests with refs are rejected with a
  pointer at grok), safety-filter rejections surfaced as such. Veo video is
  the module's planned next resident.
- CLI: `videoeditor image "prompt" -o out.png [--provider grok|imagen]
  [--ref img ...] [-n N] [--aspect 1:1] [--model id]`.
- guide.md pipeline/env + CLAUDE.md layout updated.

Provider behavior (ref limits, CDN workaround, safety-filter routing) ported
from production use in the fallout-is-real-life engine.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@darioalessandro darioalessandro merged commit d225924 into main Jul 8, 2026
4 checks passed
@darioalessandro darioalessandro deleted the feat/genai-image-client branch July 8, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant