Required environment variable
File router
The upload endpoint is defined inapp/api/uploadthing/core.ts. It accepts a single image up to 4 MB and requires an authenticated Clerk session.
app/api/uploadthing/core.ts
React helpers
lib/uploadthing.ts exports pre-typed React components and hooks generated from OurFileRouter.
lib/uploadthing.ts
UploadButton or UploadDropzone anywhere in the UI to trigger the designImageUploader route, or use the useUploadThing hook for a fully custom upload experience.
How uploaded images flow through the system
- The user uploads a screenshot via
designImageUploader. - UploadThing returns the hosted image URL to the client.
- The client sends the
imageUrlas part of the message payload when triggering the Inngest function. - The Inngest
build-agent-inputstep callsextractDesignSpecFromImagewith the URL. - GPT-4o-2024-08-06 analyses the image and returns a structured
DesignSpec. - The spec is prepended to the coding agent’s input, and the
imageUrlis stored on both theMessageandCodeFragmentrecords.
Image uploads are only available to Pro users. The upload UI is gated behind the
screenshot_upload feature flag. Users on the free plan cannot attach design screenshots to their prompts.Related pages
Design to code
How uploaded screenshots are converted into a design spec and passed to the agent.
AI models
The GPT-4o model that processes the uploaded image.