To use DeepAI with V0, generate your AI feature UI in V0, then create a Next.js API route at app/api/deepai/route.ts that calls DeepAI's REST API using your API key from an environment variable. DeepAI supports image generation, text summarization, style transfer, and more — all via simple HTTP POST requests with no model hosting required.
Adding AI Image Generation and Text Processing to Your V0 App with DeepAI
DeepAI offers one of the simplest AI API integrations available — no model setup, no fine-tuning, no infrastructure to manage. You send a POST request with your API key and a prompt, and DeepAI returns an image URL or processed text within seconds. For V0 founders who want to add AI features to their apps without the complexity of hosting models or navigating OpenAI's more advanced API, DeepAI is an accessible starting point.
DeepAI's most popular endpoint for V0 integrations is the text-to-image generator, which converts text prompts into AI-generated images. Other useful APIs include the text summarizer (condenses long text to bullet points), the AI content detector (checks if text was AI-generated), image colorization, and neural style transfer (applies an artistic style to a photo). Each API has the same simple POST structure — the main difference is the endpoint URL and the input parameters.
The security pattern is identical to any other API integration: your DeepAI API key lives in a Vercel environment variable, a Next.js API route uses it to call DeepAI, and your React components call your API route. The API key never appears in browser-accessible code. DeepAI's free tier provides a reasonable number of API calls per month for testing, making it easy to prototype AI features before committing to a paid plan.
Integration method
V0 generates the front-end UI for your AI features while a Next.js API route proxies requests to DeepAI's REST API, keeping your API key server-side. DeepAI's simple POST API makes integration straightforward — most operations just need a text prompt or image URL and return results immediately.
Prerequisites
- A V0 account with a Next.js project at v0.dev
- A DeepAI account at deepai.org to get an API key (free tier available)
- Your DeepAI API key from the deepai.org dashboard after signing up
- A Vercel project connected to your V0 app via GitHub for environment variable management
Step-by-step guide
Get Your DeepAI API Key
Get Your DeepAI API Key
Getting started with DeepAI is simple — the API key is available immediately after signing up with no approval process. Go to deepai.org and click Sign Up. You can sign up with an email address or a Google account. After signing in, navigate to your profile dashboard by clicking your username or profile icon. On the dashboard page, you will see your API Key displayed. Copy this key — it starts with a string of alphanumeric characters and is the only credential you need for all DeepAI endpoints. DeepAI's free tier includes a limited number of API calls per month, which is more than enough for development and testing. If you are building a production app with significant traffic, review the pricing page for paid plan details. DeepAI's API key is a simple Bearer token — every API request must include it in the api-key header. Unlike OAuth-based APIs, there is no token refresh or expiration to manage. Keep the key private by storing it only in environment variables, not in your code.
Pro tip: DeepAI does not support rotating or creating multiple API keys from the dashboard. If your key is compromised, contact DeepAI support to get a new one.
Expected result: You have your DeepAI API key copied and ready to add as a Vercel environment variable.
Generate Your AI Feature UI with V0
Generate Your AI Feature UI with V0
Use V0 to generate the front-end components for your DeepAI-powered feature. The interface depends on which DeepAI API you are using. For text-to-image generation, you need a text input, a submit button, and an image display area. For text summarization, you need a text area and a results panel. For style transfer, you need two image upload inputs. When prompting V0, describe the exact input parameters and the API endpoint path. For image generation, the input is a single text prompt string. For text processing, the input is a text string. For style transfer or other image APIs, the inputs are image files or image URLs. Ask V0 to handle the asynchronous nature of API calls: include a loading state (spinner or skeleton) while the API call is in progress, since DeepAI's image generation can take 5-15 seconds. Also include an error state for failed API calls and a default placeholder state before the user has generated anything. For image display, ask V0 to generate an img tag that shows the URL returned by your API route. DeepAI's image generation endpoint returns an object with an output_url field — this is the URL of the generated image hosted on DeepAI's CDN.
Create an AI image generator with a card layout: at the top, a text area with placeholder 'Describe the image you want to create...' and a character counter (max 500). Below it, a Generate button that POSTs { text: prompt } to /api/deepai/generate-image and displays a loading spinner while waiting. Below the button, an image display area that shows the generated image from the response's output_url. Include a Download button below the image and an error message area.
Paste this in V0 chat
Pro tip: Ask V0 to add a gallery section below the generator that saves the last 4-5 generated images in component state using useState, so users can compare results.
Expected result: V0 generates a polished AI image generator UI with loading states, result display, and error handling wired to your /api/deepai/generate-image endpoint.
Create the DeepAI API Route
Create the DeepAI API Route
Create the Next.js API route that proxies requests from your V0 components to DeepAI's API. The route reads your API key from environment variables and formats the request correctly for DeepAI's multipart form data API. DeepAI uses multipart/form-data (not JSON) for most of its endpoints. This is because many endpoints accept image files as binary data. Even for text-only endpoints like text2img, DeepAI still expects form data. In Node.js, you construct this using the FormData web API and append your text or file inputs as fields. The API key is passed in the api-key request header — not as a Bearer token, but directly as the header value. The base URL for all DeepAI APIs is https://api.deepai.org/api/ followed by the endpoint name (e.g., text2img for image generation, summarization for text summarization, neural-style for style transfer). DeepAI's response is a JSON object. For image generation, the response includes an output_url field with the generated image URL. For text endpoints, the response includes an output field with the processed text. Always check that the response status is OK and that the expected field exists before returning to the client. For different DeepAI endpoints, you can create separate API routes (app/api/deepai/generate-image/route.ts, app/api/deepai/summarize/route.ts) or a single generic route that accepts an endpoint parameter. The separate route approach is cleaner and easier to maintain for a V0 project.
Create a Next.js API route at app/api/deepai/generate-image/route.ts that accepts POST with { text: string }. Use FormData to send a multipart request to https://api.deepai.org/api/text2img with the text field and api-key header from process.env.DEEPAI_API_KEY. Return { imageUrl: data.output_url } on success or { error } on failure.
Paste this in V0 chat
1// app/api/deepai/generate-image/route.ts2import { NextRequest, NextResponse } from 'next/server';34export async function POST(request: NextRequest) {5 try {6 const { text } = await request.json();78 if (!text || text.trim().length === 0) {9 return NextResponse.json(10 { error: 'text prompt is required' },11 { status: 400 }12 );13 }1415 const formData = new FormData();16 formData.append('text', text);1718 const response = await fetch('https://api.deepai.org/api/text2img', {19 method: 'POST',20 headers: {21 'api-key': process.env.DEEPAI_API_KEY!,22 },23 body: formData,24 });2526 if (!response.ok) {27 const error = await response.text();28 return NextResponse.json(29 { error: `DeepAI error: ${error}` },30 { status: response.status }31 );32 }3334 const data = await response.json();3536 if (!data.output_url) {37 return NextResponse.json(38 { error: 'No image generated' },39 { status: 500 }40 );41 }4243 return NextResponse.json({ imageUrl: data.output_url });44 } catch (error) {45 console.error('DeepAI error:', error);46 return NextResponse.json(47 { error: 'Internal server error' },48 { status: 500 }49 );50 }51}Pro tip: For RapidDev clients building production AI features, consider adding rate limiting on your API route to control costs if your app has public-facing AI generation that could be abused.
Expected result: POST /api/deepai/generate-image with a text prompt returns a JSON object with an imageUrl field pointing to a DeepAI-hosted generated image.
Add the DEEPAI_API_KEY Environment Variable in Vercel
Add the DEEPAI_API_KEY Environment Variable in Vercel
Your DeepAI API route reads one environment variable: DEEPAI_API_KEY. Add it in Vercel Dashboard → Settings → Environment Variables. Set the key name to DEEPAI_API_KEY and the value to your API key from the DeepAI dashboard. Set the environment scope to Production, Preview, and Development so it works across all your deployment contexts. Do not add the NEXT_PUBLIC_ prefix. The API key must remain server-side only — if it were exposed in the browser bundle, anyone visiting your site could extract it and use your DeepAI quota. For local development, add DEEPAI_API_KEY to your .env.local file in the project root. Next.js automatically loads .env.local variables during local development. Never commit .env.local to Git — V0-generated projects include it in .gitignore by default. After adding the variable, trigger a redeployment by pushing any commit to GitHub. Then test the full flow: submit a prompt in your V0 UI, confirm the API route calls DeepAI, and verify the generated image appears. DeepAI's free tier processes requests quickly, typically within 5-15 seconds for image generation.
Pro tip: DeepAI image URLs are temporary and may expire over time. If you need to keep generated images, download them to your own storage (AWS S3 or similar) immediately after generation.
Expected result: Vercel shows DEEPAI_API_KEY saved as an environment variable. Submitting a prompt in the app generates and displays a real AI image from DeepAI.
Common use cases
AI Image Generator from Text Prompt
A creative tool allows users to type a description and generate a custom image. V0 generates the prompt input form and image display area. The Next.js API route sends the prompt to DeepAI's text2img endpoint and returns the generated image URL to display in the UI.
Create an AI image generator page with a text area for entering an image description, a Generate Image button that POSTs the prompt to /api/deepai/generate-image, and an image display area below that shows the generated image with its URL. Include a loading spinner while generating. Show a placeholder image with instructions before the first generation.
Copy this prompt to try it in V0
Automatic Content Summarizer
A research tool lets users paste long articles or reports and get an instant AI summary. V0 generates a two-panel layout with the original text on the left and the summary on the right. The API route sends the text to DeepAI's text summarization endpoint.
Build a text summarizer tool with a large text area for pasting content (placeholder: 'Paste your article or document here'), a Summarize button that POSTs the text to /api/deepai/summarize, and a right panel showing the summary result with a copy-to-clipboard button. Show character count for both original and summary.
Copy this prompt to try it in V0
Photo Style Transfer Feature
A photo editing app lets users apply artistic styles to their photos. They upload a content image and select a style image, and DeepAI's neural style transfer API blends them. V0 generates the dual image upload interface and the styled result display.
Create a style transfer page with two image upload zones side by side: one labeled 'Your Photo' and one labeled 'Style Image'. Include a Generate Styled Image button that sends both image files to /api/deepai/style-transfer. Show the resulting styled image in a large display area below with a download button.
Copy this prompt to try it in V0
Troubleshooting
API returns 401 Unauthorized
Cause: The DEEPAI_API_KEY environment variable is missing or incorrect, or the api-key header is not being sent in the request.
Solution: Verify the DEEPAI_API_KEY is set in Vercel environment variables and that your API route reads it correctly with process.env.DEEPAI_API_KEY. The header name must be api-key (not Authorization or Bearer).
1headers: { 'api-key': process.env.DEEPAI_API_KEY! }Generated image URL returns 404 or broken image after some time
Cause: DeepAI's CDN hosting for generated images is temporary. Image URLs may expire after a period.
Solution: After receiving the output_url, immediately fetch the image and upload it to your own storage (AWS S3, Cloudflare R2) for permanent hosting. Return your storage URL to the client instead of the DeepAI URL.
Next.js Image component shows error loading DeepAI output images
Cause: Next.js blocks external images from unrecognized domains unless they are configured in next.config.ts.
Solution: Add DeepAI's CDN domain to the remotePatterns in next.config.ts, or use a standard img HTML element instead of Next.js Image component for DeepAI-generated images.
1// next.config.ts2const nextConfig = {3 images: {4 remotePatterns: [5 { protocol: 'https', hostname: 'api.deepai.org' },6 ],7 },8};9export default nextConfig;API route times out on Vercel for image generation requests
Cause: DeepAI image generation can take 10-30 seconds for complex prompts, exceeding Vercel Hobby plan's default 10-second function timeout.
Solution: Add export const maxDuration = 60; to your API route to extend the maximum duration. This requires a Vercel Pro plan for durations above 10 seconds.
1// app/api/deepai/generate-image/route.ts2export const maxDuration = 60; // secondsBest practices
- Cache DeepAI results for identical prompts using Next.js fetch caching or an in-memory cache to reduce API calls and costs
- Add prompt length validation in both client and server to prevent excessively long inputs that waste API credits
- Store generated content URLs in your database alongside the original prompt for user history and cost auditing
- Implement a usage counter per user to prevent a single user from exhausting your DeepAI quota
- Handle DeepAI's occasional slower response times gracefully with generous timeout settings and clear loading indicators
- Download and re-host generated images to your own storage if they need to be reliably accessible long-term
- Review DeepAI's content policy before building public-facing generators to understand what inputs are blocked
Alternatives
OpenAI provides more advanced language models and higher-quality image generation with DALL-E, at higher cost and with more configuration options.
Google Cloud AI Platform offers enterprise-grade ML services with Vertex AI for teams that need custom model training and fine-tuning capabilities.
H2O AI specializes in AutoML and business intelligence use cases, making it a better fit for structured data prediction than content generation.
Frequently asked questions
What AI capabilities does DeepAI offer beyond image generation?
DeepAI offers text summarization, AI content detection (checks if text was written by AI), image colorization (adds color to black-and-white photos), neural style transfer (applies artistic styles to photos), image upscaling, background removal, text-to-image, and more. All use the same simple POST API pattern.
How is DeepAI different from OpenAI?
DeepAI is simpler to integrate — it uses plain REST API calls with form data, has no complex SDK to install, and offers lower per-call pricing. OpenAI provides more sophisticated language models (GPT-4), higher-quality image generation (DALL-E 3), and embeddings for semantic search. DeepAI is better for quick AI features without infrastructure overhead; OpenAI is better for advanced reasoning and high-quality outputs.
Does DeepAI have a free tier?
Yes. DeepAI's free tier includes a limited number of API calls per month across all endpoints. The exact limit varies and is displayed in your dashboard. The free tier is sufficient for development and light production use. Paid plans provide higher rate limits and more monthly calls.
Can I use DeepAI for commercial projects?
Yes, DeepAI allows commercial use of their API. Review DeepAI's terms of service for specific restrictions on generated content ownership and usage rights. Generally, content you generate via the API can be used in commercial applications.
Why should I proxy DeepAI through an API route instead of calling it from the browser?
Your DeepAI API key would be visible in the browser's network inspector if you call DeepAI directly from client-side code. Anyone visiting your page could steal the key and use your DeepAI quota. The Next.js API route keeps the key on the server, so it never appears in browser-accessible JavaScript or network requests.
How long does DeepAI image generation take?
DeepAI's text-to-image generation typically takes 5-20 seconds depending on server load and the complexity of the prompt. Simple prompts are usually faster. Plan your UI loading states accordingly — a spinner with a message like 'Generating your image...' improves the user experience during the wait.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation