Create Generation V2
curl --request POST \
--url https://api.devkit4ai.com/api/v1/generation/generate-v2 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'instructions=<string>' \
--form files=@example-fileimport requests
url = "https://api.devkit4ai.com/api/v1/generation/generate-v2"
files = { "files": ("example-file", open("example-file", "rb")) }
payload = { "instructions": "<string>" }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('instructions', '<string>');
form.append('files', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.devkit4ai.com/api/v1/generation/generate-v2', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.devkit4ai.com/api/v1/generation/generate-v2",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"instructions\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.devkit4ai.com/api/v1/generation/generate-v2"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"instructions\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.devkit4ai.com/api/v1/generation/generate-v2")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"instructions\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devkit4ai.com/api/v1/generation/generate-v2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"instructions\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"message": "Generation request submitted successfully"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}AI Generation
Create Generation
POST
/
api
/
v1
/
generation
/
generate-v2
Create Generation V2
curl --request POST \
--url https://api.devkit4ai.com/api/v1/generation/generate-v2 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'instructions=<string>' \
--form files=@example-fileimport requests
url = "https://api.devkit4ai.com/api/v1/generation/generate-v2"
files = { "files": ("example-file", open("example-file", "rb")) }
payload = { "instructions": "<string>" }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('instructions', '<string>');
form.append('files', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.devkit4ai.com/api/v1/generation/generate-v2', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.devkit4ai.com/api/v1/generation/generate-v2",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"instructions\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.devkit4ai.com/api/v1/generation/generate-v2"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"instructions\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.devkit4ai.com/api/v1/generation/generate-v2")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"instructions\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devkit4ai.com/api/v1/generation/generate-v2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"instructions\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"message": "Generation request submitted successfully"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Create a new AI-powered image generation request. Upload 1-5 example images and provide instructions to generate new images based on your examples. Uses Replicate AI’s Stability AI SDXL model for high-quality results.
Constraints:
Authentication
Requires valid JWT token withend_user role and project-scoped headers.
Headers
string
required
Bearer JWT access token obtained from login
string
required
Must be set to
end_userstring
required
Developer key associated with the project
string
required
Project UUID for project-scoped access
string
required
Project API key for authentication
string
required
Must be
multipart/form-data for file uploadsRequest Body (Multipart Form Data)
file[]
required
Array of 1-5 example images to guide generation. Supported formats: JPEG, PNG, WebP. Maximum 10MB per image.
json string
required
JSON-encoded string containing generation instructions. Must be between 1-1000 characters when serialized.Example:
{"prompt": "Generate a futuristic cityscape with neon lights"}Response
string
Unique UUID identifier for the generation request
string
Initial status: always
pending for new requestsstring
Confirmation message: “Generation request submitted successfully”
Example Request
curl -X POST https://api.vibecoding.ad/api/v1/generation/generate-v2 \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
-H "X-User-Role: end_user" \
-H "X-Developer-Key: ak_abc123XYZ-_789def456ghi012jkl345" \
-H "X-Project-ID: 550e8400-e29b-41d4-a716-446655440000" \
-H "X-API-Key: pk_xyz789ABC-_123def456ghi012jkl345" \
-F "example_images=@/path/to/image1.jpg" \
-F "example_images=@/path/to/image2.jpg" \
-F "example_images=@/path/to/image3.jpg" \
-F 'instructions={"prompt": "Generate a futuristic cityscape with neon lights and flying cars", "style": "cyberpunk"}'
Example Response
{
"id": "990e8400-e29b-41d4-a716-446655440004",
"status": "pending",
"message": "Generation request submitted successfully"
}
Generation Status Lifecycle
After submission, the generation progresses through multiple states:- pending - Request queued for processing
- processing - AI model actively generating image
- completed - Generation successful, image available
- failed - Generation failed due to error
Image Requirements
File Formats
- Supported: JPEG (
.jpg,.jpeg), PNG (.png), WebP (.webp) - Unsupported: GIF, TIFF, BMP, SVG
File Size
- Maximum per image: 10MB
- Total request size: 50MB (5 images × 10MB each)
Image Count
- Minimum: 1 example image required
- Maximum: 5 example images allowed
- Recommended: 3-5 images for best results
Image Quality
For best generation results:- Use high-resolution images (1024x1024 or higher)
- Ensure images are well-lit and in focus
- Provide diverse examples showing different angles/styles
- Avoid heavily compressed or low-quality images
Instructions Format
Theinstructions field must be a JSON-encoded string with the following constraints:
Structure:
{
"prompt": "Your generation prompt here",
"style": "Optional style modifier",
"additional_params": "Any additional instructions"
}
- Must be valid JSON
- Serialized length: 1-1000 characters
- Must contain at least a
promptkey - Other keys are optional and passed to AI model
{"prompt": "Generate a sunset over mountains"}
{
"prompt": "Create a modern minimalist interior design",
"style": "scandinavian",
"mood": "calm and serene"
}
{
"prompt": "Generate a fantasy landscape with magical elements",
"style": "concept art",
"details": "include floating islands and glowing crystals"
}
Processing Time
Typical generation times:- Fast: 1-2 minutes (simple generations)
- Average: 2-5 minutes (standard complexity)
- Slow: 5-10 minutes (complex or high-detail generations)
Poll the Generation Status endpoint every 10-15 seconds to check for completion. Avoid polling more frequently to minimize API usage.
Use Cases
Portfolio Website
Generate custom images for your portfolio projects:async function generatePortfolioImage(
examples: File[],
prompt: string,
authHeaders: HeadersInit
): Promise<string> {
const formData = new FormData();
// Add example images
examples.forEach(file => {
formData.append('example_images', file);
});
// Add instructions
formData.append('instructions', JSON.stringify({
prompt,
style: 'professional photography'
}));
const response = await fetch(
'https://api.vibecoding.ad/api/v1/generation/generate-v2',
{
method: 'POST',
headers: authHeaders, // Include all required auth headers
body: formData
}
);
const data = await response.json();
return data.id; // Return generation ID for status polling
}
E-Commerce Product Variations
Create product variations for online stores:async function generateProductVariations(
productImages: File[],
variations: string[]
): Promise<string[]> {
const generationIds: string[] = [];
for (const variation of variations) {
const formData = new FormData();
productImages.forEach(img => formData.append('example_images', img));
formData.append('instructions', JSON.stringify({
prompt: `Generate ${variation} variation of the product`,
style: 'product photography',
background: 'white'
}));
const response = await fetch(apiUrl, {
method: 'POST',
headers: authHeaders,
body: formData
});
const data = await response.json();
generationIds.push(data.id);
}
return generationIds;
}
Content Creation Platform
Build a content creation tool with AI generation:interface GenerationRequest {
images: File[];
prompt: string;
style?: string;
mood?: string;
}
async function createContent(request: GenerationRequest) {
const formData = new FormData();
request.images.forEach(img => {
formData.append('example_images', img);
});
const instructions = {
prompt: request.prompt,
...(request.style && { style: request.style }),
...(request.mood && { mood: request.mood })
};
formData.append('instructions', JSON.stringify(instructions));
// Submit generation
const response = await fetch(apiUrl, {
method: 'POST',
headers: authHeaders,
body: formData
});
const { id } = await response.json();
// Poll for completion
return await pollGenerationStatus(id);
}
Error Responses
Missing Example Images (422)
{
"detail": [
{
"loc": ["body", "example_images"],
"msg": "field required",
"type": "value_error.missing"
}
]
}
Too Many Images (422)
{
"detail": "Maximum 5 example images allowed"
}
File Too Large (413)
{
"detail": "File size exceeds maximum allowed size of 10MB"
}
Invalid File Format (422)
{
"detail": "Invalid file format. Supported formats: JPEG, PNG, WebP"
}
Invalid Instructions (422)
{
"detail": [
{
"loc": ["body", "instructions"],
"msg": "Invalid JSON format",
"type": "value_error.json"
}
]
}
Instructions Too Long (422)
{
"detail": "Instructions must be between 1 and 1000 characters"
}
Unauthorized (401)
{
"detail": "Could not validate credentials"
}
Insufficient Permissions (403)
{
"detail": "Insufficient permissions for this operation"
}
Rate Limit Exceeded (429)
{
"detail": "AI generation rate limit exceeded. Try again later.",
"retry_after": 3600
}
Rate Limits
AI generation endpoints have stricter rate limits due to computational cost:| Tier | Generations per Month | Concurrent Requests |
|---|---|---|
| Free Starter | 100 | 1 |
| Cloud Starter | 1,000 | 3 |
| Cloud Premium | Unlimited | 10 |
Exceeding rate limits will result in
429 Too Many Requests responses. Monitor your usage via Cloud Admin console.Related Pages
Get Generation Status
Check generation progress and results
List Generations
View all your generation requests
Toggle Public
Make generations public or private
Delete Generation
Remove generation requests
AI Generation Guide
Implement in Starter Kit
Quick Start
Complete generation tutorial
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

