AI
Configure Vercel AI Gateway and try AI demos
The template's main branch includes an AI Playground with six on-demand
demos. Text, speech, image understanding, and image generation share one Vercel AI Gateway key.
Setup
Create an AI Gateway Key
Create a key in your Vercel team's AI Gateway dashboard.
Set Environment Variables
Add the key to .env in the project root:
AI_GATEWAY_API_KEY=YOUR-GATEWAY-API-KEYRun the Demo
Restart pnpm dev, then open AI Playground.
If you are setting up the environment, now you can go back to the Environment Setup guide and continue. The rest of this guide can be read later.
Environment Setup
Set up environment variables
Usage
| Demo | What to try | Default model |
|---|---|---|
| Summarization | Summarize supplied text | google/gemini-2.5-flash-lite |
| Translation | Translate between supported languages | google/gemini-2.5-flash-lite |
| Taglines | Generate taglines from a product description | google/gemini-2.5-flash-lite or openai/gpt-4o-mini |
| Text to speech | Generate WAV audio with a selected voice | openai/tts-1 |
| Image understanding | Describe an uploaded image | google/gemini-2.5-flash-lite |
| Image generation | Generate one image from a prompt | bfl/flux-2-klein-4b |
Notices
Requests consume your team's Gateway credits. Check available credits, model access, and request limits in Vercel, and configure a key budget before exposing a public demo. Free-tier eligibility and provider availability can change; the configured model list is not a guarantee of free or successful requests.
- Missing key: check the variable name and restart or redeploy.
- Authentication errors: check that the Gateway key is valid for the intended team.
- Balance or rate-limit errors: check credits, budgets, and limits before retrying.
- Upload errors: use a supported image type under the size limit.
Video Tutorial
A Complete Guide To Vercel’s AI SDK // The ESSENTIAL Tool For Shipping AI Apps
References
- Vercel AI Gateway API
- AI SDK
- AI Elements
- AI Gateway
- OpenAI
- Google Generative AI
- DeepSeek
- OpenRouter
- FAL
- Fireworks
- Replicate
MkSaaS 문서