Kapable starter template: BYO-key AI Image Studio (auth, ai image, store)
  • TypeScript 72.2%
  • CSS 23.3%
  • JavaScript 4.5%
Find a file
Image Studio Operator cfd2721967 feat(imagestudio): BYO-key AI Image Studio — prompt → real image → store gallery
Forked from kapable-starter-kit. Demonstrates kapable-ai image modality
(generic proxy pass-through; openrouter + google/gemini-2.5-flash-image via
modalities:[image,text]), kapable-store (imagestudio-gallery bucket), and
kapable-data (imagestudio_images metadata). Real generated bytes only.

- app/lib/ai.server.ts: generateImage() — real bytes from the AI proxy
- app/lib/store.server.ts: putImage/getImage — kapable-store
- app/lib/gallery.server.ts: imagestudio_images metadata + listing
- routes/api.generate.tsx: generate -> store -> record
- routes/api.image.$id.tsx: stream stored bytes (+?download=1)
- routes/home.tsx + app.css: impeccable composer + masonry gallery wall

Verified locally end-to-end: 1.29MB PNG generated, stored, round-tripped,
persisted on reload, downloaded with Content-Disposition.
2026-06-21 16:44:10 -04:00
app feat(imagestudio): BYO-key AI Image Studio — prompt → real image → store gallery 2026-06-21 16:44:10 -04:00
public feat(imagestudio): BYO-key AI Image Studio — prompt → real image → store gallery 2026-06-21 16:44:10 -04:00
.gitignore feat(imagestudio): BYO-key AI Image Studio — prompt → real image → store gallery 2026-06-21 16:44:10 -04:00
.npmrc feat(imagestudio): BYO-key AI Image Studio — prompt → real image → store gallery 2026-06-21 16:44:10 -04:00
bun.lock feat(imagestudio): BYO-key AI Image Studio — prompt → real image → store gallery 2026-06-21 16:44:10 -04:00
DESIGN.md feat(imagestudio): BYO-key AI Image Studio — prompt → real image → store gallery 2026-06-21 16:44:10 -04:00
package.json feat(imagestudio): BYO-key AI Image Studio — prompt → real image → store gallery 2026-06-21 16:44:10 -04:00
react-router.config.ts feat(imagestudio): BYO-key AI Image Studio — prompt → real image → store gallery 2026-06-21 16:44:10 -04:00
README.md feat(imagestudio): BYO-key AI Image Studio — prompt → real image → store gallery 2026-06-21 16:44:10 -04:00
seed.ts feat(imagestudio): BYO-key AI Image Studio — prompt → real image → store gallery 2026-06-21 16:44:10 -04:00
tsconfig.json feat(imagestudio): BYO-key AI Image Studio — prompt → real image → store gallery 2026-06-21 16:44:10 -04:00
vite.config.ts feat(imagestudio): BYO-key AI Image Studio — prompt → real image → store gallery 2026-06-21 16:44:10 -04:00

Image Studio — Kapable starter app

A BYO-key AI image generation studio. Type a prompt, generate a real image through the Kapable AI proxy (your org's own provider key), store it in kapable-store, and browse a gallery of everything you've conjured — each tile captioned with its prompt and re-downloadable.

Live: https://imagestudio.kapable-starters.kapable.run/

What it demonstrates

  • kapable-ai (image modality) — the AI proxy is a generic OpenAI-compatible pass-through, so an image-output model reached via v1/chat/completions with modalities: ["image", "text"] returns real image bytes inline. Uses the org's existing openrouter strongbox key + an image model (google/gemini-2.5-flash-image, overridable via IMAGESTUDIO_MODEL). No mocked images — every tile is real generated bytes.
  • kapable-store — generated PNGs are uploaded to the app-slug-prefixed imagestudio-gallery bucket and re-served (the org credential stays server-side; the browser only hits this app's /api/image/:id).
  • kapable-data — gallery metadata (prompt, object key, model, timestamp) lives in the imagestudio_images table; the wall persists across reloads.

Architecture

Layer File Role
SDK wiring app/lib/kapable.server.ts per-service base URLs + the org key (KAPABLE_ORG_KEY)
Generate app/lib/ai.server.ts prompt → real image bytes via the AI proxy
Store app/lib/store.server.ts upload + re-serve the bytes (kapable-store)
Metadata app/lib/gallery.server.ts the imagestudio_images table (kapable-data)
Generate route app/routes/api.generate.tsx POST: generate → store → record
Image route app/routes/api.image.$id.tsx stream stored bytes (?download=1 to download)
UI app/routes/home.tsx + app/app.css composer + masonry gallery wall

Run locally

bun install
bun run build
KAPABLE_ORG_KEY=sk_live_… bun run start   # an sk_live_ org key with {read,write} scopes

Built on the kapable-starter-kit golden skeleton. See DESIGN.md for the design rationale.