Caption a curated image, embed the caption, and export a portable image index without a vector database.
Use this when teaching or prototyping caption-then-embed for images and you want a downloadable index file as the result.
Similar patterns, and when each one is the better fit.

Local Image SearchUse this when you already have an exported image index and need to search it by meaning in the browser using caption embeddings.
Local RAG IngestUse this when a small docs or knowledge-base prototype needs its text turned into embeddings held in React state and saved as a portable index.
Generate Image (Grok Imagine)FreeUse this when your app should generate images on xAI Grok Imagine and you want a starting setup that shows results in a basic UI.
JSON Render ImageUse this when users describe a social card or marketing graphic in plain language and need a downloadable SVG or PNG image as the result.Requirements, wiring steps, and what this pattern adds to your project.
Pick how you want to pull this pattern in. Then wire env vars and routes the same way.
Download → Next.js app
Use Download → Next.js app in the preview toolbar. You get a zip scaffold (Pro downloads rewrite preview `/view/.../api/*` paths to `/api/*` automatically).
Extract the zip and install dependencies
Unzip the archive, then run `pnpm install` (or npm / yarn) in the project folder.
Fill .env.local
The download includes .env.local placeholders when needed. Add real values for: AI_GATEWAY_API_KEY.
Customize the agent and tool files
Adapt prompts, tools, and stop conditions in the generated project for your product.
Run the app and open the pattern route
Run `pnpm dev`, open the setup/checklist page if present, then navigate to the generated pattern route and verify responses.
AI_GATEWAY_API_KEYGet keyAI SDK APIs
generateTextembedExternal services
app/page.tsxapp/layout.tsxapp/api/caption-embed/route.tscomponents/local-image-ingest.tsxhooks/use-local-image-ingest.tslib/hash.tslib/caption-config.tslib/embedding-config.tslib/local-image-index.tslib/rate-limit.tslib/request-utils.tslib/sample-images.tsfixtures/sample-images.jsonREADME.mdnpm packages
6
Registry components
lib/local-image-index.tsV1 portable image-index contract (schema, Zod validation, invariants, export constructor). Local Image Search must reuse this module as the compatibility seam—reject incompatible schema/version/model/dimensions/caption identity before cosineSimilarity.
lib/caption-config.tsPinned caption identity: google/gemini-2.5-flash with caption-prompt-v1, plus ALLOW_UNLISTED_IMAGES toggle (false for the deployed gallery allowlist).
caption-embed/route.tsStateless caption-then-embed boundary: generateText with a vision model, then Core embed of the caption using openai/text-embedding-3-small at 512 dimensions. Never persist images, captions, or vectors.
Caption a curated image, embed the caption, and export a portable image index without a vector database.
Use this when teaching or prototyping caption-then-embed for images and you want a downloadable index file as the result.
Similar patterns, and when each one is the better fit.

Local Image SearchUse this when you already have an exported image index and need to search it by meaning in the browser using caption embeddings.
Local RAG IngestUse this when a small docs or knowledge-base prototype needs its text turned into embeddings held in React state and saved as a portable index.
Generate Image (Grok Imagine)FreeUse this when your app should generate images on xAI Grok Imagine and you want a starting setup that shows results in a basic UI.
JSON Render ImageUse this when users describe a social card or marketing graphic in plain language and need a downloadable SVG or PNG image as the result.Requirements, wiring steps, and what this pattern adds to your project.
Pick how you want to pull this pattern in. Then wire env vars and routes the same way.
Download → Next.js app
Use Download → Next.js app in the preview toolbar. You get a zip scaffold (Pro downloads rewrite preview `/view/.../api/*` paths to `/api/*` automatically).
Extract the zip and install dependencies
Unzip the archive, then run `pnpm install` (or npm / yarn) in the project folder.
Fill .env.local
The download includes .env.local placeholders when needed. Add real values for: AI_GATEWAY_API_KEY.
Customize the agent and tool files
Adapt prompts, tools, and stop conditions in the generated project for your product.
Run the app and open the pattern route
Run `pnpm dev`, open the setup/checklist page if present, then navigate to the generated pattern route and verify responses.
AI_GATEWAY_API_KEYGet keyAI SDK APIs
generateTextembedExternal services
app/page.tsxapp/layout.tsxapp/api/caption-embed/route.tscomponents/local-image-ingest.tsxhooks/use-local-image-ingest.tslib/hash.tslib/caption-config.tslib/embedding-config.tslib/local-image-index.tslib/rate-limit.tslib/request-utils.tslib/sample-images.tsfixtures/sample-images.jsonREADME.mdnpm packages
6
Registry components
lib/local-image-index.tsV1 portable image-index contract (schema, Zod validation, invariants, export constructor). Local Image Search must reuse this module as the compatibility seam—reject incompatible schema/version/model/dimensions/caption identity before cosineSimilarity.
lib/caption-config.tsPinned caption identity: google/gemini-2.5-flash with caption-prompt-v1, plus ALLOW_UNLISTED_IMAGES toggle (false for the deployed gallery allowlist).
caption-embed/route.tsStateless caption-then-embed boundary: generateText with a vision model, then Core embed of the caption using openai/text-embedding-3-small at 512 dimensions. Never persist images, captions, or vectors.
Loading preview…
Early-bird pricing — limited time


Open on desktop for the interactive preview.
Caption a curated image, embed the caption, and export a portable image index without a vector database.
Loading preview…
Early-bird pricing — limited time


Open on desktop for the interactive preview.
Caption a curated image, embed the caption, and export a portable image index without a vector database.