AI Imaging — Image Generation Foundation

  • Area: Intelligence
  • Path: services/ai/imaging
  • Kind: Image generation foundation (txt2img + img2img + inpainting + upscale + composition)
  • Status: v0.1.0 — foundation landed 2026-05-24. HTTP daemon koder-imaging + CLI kimaging + 5 routes (generateeditupscalecomposemodels) with the deterministic colour-block stub provider + the in-process og-package composer (unblocks specs/landing-pages/packages.kmd OG-image requirement). SDXL adapter is the typed stub awaiting imaging#004. Auth + per-request sizen caps live; daily per-tenant cap + safety filter via `servicesai/classify` track in imaging#019.

Role in the stack

imaging consolidates server-side image generation. Before this sector, every consumer that needed an image (kode, agents, marketing landings, dynamic OG images) called a provider directly — no shared cache, no consolidated billing, no fallback, no path to self-host. The bug from 2026-04-29 where Hub package pages rendered a generic OG image traced back to the absence of a composition foundation.

It is the Koder analog of OpenAI DALL-E, Google Imagen, Midjourney and Replicate — self-hosted where viable (SDXL on GPU runtime) and a thin proxy front for frontier models routed via services/ai/gateway.

Boundary vs neighbors

  • services/ai/vision is the input half (image in); imaging is the output half (image out).
  • services/ai/video handles temporal generation (SoraVeoRunway proxy).
  • services/ai/scene3d handles 3D mesh generation; image-to-3D is a future pipeline candidate spanning the two.

Features (v1 target)

  • txt2img: SDXL self-hosted on GPU; DALL-EImagenMidjourney via gateway proxy
  • img2img + inpainting: SDXL pipeline with mask support
  • Upscaling: 2x/4x super-resolution
  • Composition: templated PNG output for OG images, banners, social cards
  • Cross-provider knob normalization (sampler, scheduler, CFG, seed)
  • Per-tenant quotas, safety filter (configurable strictmoderateoff)

Primary couplings

Consumer Relationship
services/ai/kode In-chat image generation tool calls
services/ai/agents Image-gen tool exposed to agent loops
`meta/sites