Developer Guide
Lovart AI Code
Integrate AI-powered design generation into your apps, workflows, and products. Ship logos, brand kits, social creatives, and video — all from a few lines of code.
Quick-Start Code Examples
Get up and running in under 5 minutes. Choose your preferred language and copy the snippet into your project.
curl -X POST https://api.lovart.pro/v1/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A minimalist tech startup logo with a gradient icon",
"style": "brand-identity",
"resolution": "1024x1024",
"format": "svg"
}'import Lovart from '@lovart/sdk';
const client = new Lovart({ apiKey: process.env.LOVART_API_KEY });
// Generate a logo from a text prompt
const result = await client.generate({
prompt: 'Modern SaaS dashboard icon, purple gradient, flat design',
style: 'brand-identity',
resolution: '1024x1024',
format: 'svg',
});
console.log(result.imageUrl); // https://cdn.lovart.pro/...
console.log(result.creditUsed); // 1import lovart
client = lovart.Client(api_key="YOUR_API_KEY")
# Generate a brand kit from a single prompt
result = client.generate(
prompt="Organic skincare brand, earthy tones, elegant serif typography",
style="brand-kit",
resolution="2048x2048",
format="png",
)
print(result.image_url) # https://cdn.lovart.pro/...Framework Integration
Drop the Lovart AI code directly into your Next.js, React, or Node.js project. Here's a full API route example.
// app/api/generate/route.ts
import { NextResponse } from 'next/server';
export async function POST(req: Request) {
const { prompt } = await req.json();
const response = await fetch('https://api.lovart.pro/v1/generate', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.LOVART_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
prompt,
style: 'marketing',
resolution: '1024x1024',
}),
});
const data = await response.json();
return NextResponse.json(data);
}API Endpoints
A concise overview of the core endpoints. For request/response schemas and error codes, see the full API documentation.
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/generate | Generate images, logos, or brand kits from a text prompt |
| POST | /v1/video | Create cinematic video clips from prompts or reference images |
| GET | /v1/styles | List all available style presets (200+) |
| GET | /v1/credits | Check remaining credits and usage stats |
| POST | /v1/upscale | AI upscale an existing image to 4K resolution |
| POST | /v1/remove-bg | Remove background from images with one call |
What Can You Build?
The Lovart API powers a wide range of applications — from simple image generators to full creative automation pipelines.
E-Commerce Product Shots
Auto-generate lifestyle product images for listings. Great for Shopify and Amazon storefronts.
SaaS Marketing Automation
Batch-create ad creatives, social banners, and email headers from marketing copy.
Design Tool Plugins
Embed AI generation directly into Figma, Sketch, or your own design tool.
Content Platforms
Add AI illustration to CMS workflows — auto-generate featured images from article titles.
Frequently Asked Questions
What languages and frameworks does the Lovart API support?+
The API is REST-based and works with any language that supports HTTP. We provide official SDKs for JavaScript/TypeScript and Python, with community SDKs for Go, Ruby, and PHP.
How does authentication work?+
Pass your API key in the Authorization header as a Bearer token. Keys are managed in the Lovart dashboard under Settings → API Keys.
What are the rate limits?+
Free-tier keys allow 10 requests per minute. Pro keys support 60 requests per minute with burst up to 100. Enterprise plans have custom limits.
Can I generate SVG output via the API?+
Yes. Set the format parameter to "svg" in your generate request. SVG output is available on all paid plans.
Where can I find the full API reference?+
The complete endpoint documentation, request/response schemas, and error codes are available on the Lovart API page.
Ready to Ship AI-Powered Design?
Get your API key, explore the code examples above, and start generating production-ready assets today.