The Stitch SDK generates and edits mobile, desktop, or tablet UI screens from text prompts and returns HTML and screenshot URLs programmatically.
Overview
Stitch SDK is a TypeScript client for Google’s Stitch design service, which produces user interface screens from natural-language prompts. You authenticate with an API key or OAuth credentials, open or create projects, call generate with a prompt and optional device type, then fetch HTML and image download URLs for each screen.
Project APIs list screens, load a screen by ID, edit layouts with follow-up prompts, and create design variants with controls for count, creative range, and which aspects change. Design systems can be created, updated, and applied to selected screen instances within a project. Domain classes cache generation results when possible and call Stitch APIs when data must be refreshed.
For agents, StitchToolClient exposes MCP tools directly, while stitchTools integrates with the Vercel AI SDK and Google ADK so models can invoke generation tools autonomously. A StitchProxy can forward MCP requests through your own server. Methods may raise StitchError with codes such as rate limits, auth failures, or clarification questions that you answer by resubmitting a prompt.
Configuration uses environment variables including STITCH_API_KEY, optional OAuth tokens, project ID, and host overrides. The package notes it is not an officially supported Google product.
Key features
- Text-to-UI screen generation
- HTML and screenshot download URLs
- Project and screen management APIs
- Prompt-based screen edits
- Design variant generation options
- Design system create and apply
- MCP and AI SDK tool integration
- Clarification-aware error handling
Use cases
- Automate UI mockups from prompts
- Wire Stitch into AI agent workflows
- Iterate screens with edit and variants
- Apply branding via design systems
- Extract HTML for downstream tooling