POST /api/qr/ai/generate
Same renderer as /api/qr/generate, but you describe what you want in a sentence and the engine picks the shapes, colors and finder eyes.
There are three variants of the AI endpoint — pick the one that matches your auth.
Marketplace — bring your own LLM key
POST https://api.qr-branding.com/api/qr/ai/generate
curl -X POST https://api.qr-branding.com/api/qr/ai/generate \
-H "Content-Type: application/json" \
-H "X-RapidAPI-Proxy-Secret: <secret>" \
-d '{
"content": "https://yourbrand.com",
"prompt": "art deco gold leaf, geometric chevrons, ivory background",
"llmProvider": "openai",
"llmApiKey": "sk-...",
"creativity": 0.6,
"strictScannability": true,
"stylePreset": "luxury"
}'
You supply the LLM credentials. The engine validates the resulting config, runs the scan guarantee, and renders the QR.
Marketplace — managed AI, no LLM key
curl -X POST https://api.qr-branding.com/api/qr/ai/generate-managed \
-H "Content-Type: application/json" \
-H "X-RapidAPI-Proxy-Secret: <secret>" \
-d '{
"content": "https://yourbrand.com",
"prompt": "art deco gold leaf, geometric chevrons, ivory background",
"creativity": 0.6,
"strictScannability": true,
"stylePreset": "luxury"
}'
No llmProvider / llmApiKey needed. The server uses its own models with a Groq → Gemini → OpenAI fallback chain. The response includes "managed": true, and the call counts towards your plan's Managed AI quota.
Consumer — server-side LLM key
POST https://qr-branding.com/api/qr/ai/generate/server
curl -X POST https://qr-branding.com/api/qr/ai/generate/server \
-H "Content-Type: application/json" \
-d '{
"content": "https://yourbrand.com",
"prompt": "art deco gold leaf, geometric chevrons, ivory background",
"stylePreset": "luxury",
"creativity": 0.6
}'
No llmProvider / llmApiKey needed. Server tries Groq (gpt-oss-120b, then gpt-oss-20b) → OpenAI → Gemini in order. One AI credit is deducted from your balance on success; on failure no credit is consumed.
Code samples
Request body
| Field | Type | Default | Notes |
|---|---|---|---|
content | string | required | What to encode (URL / text). |
prompt | string | required | Plain language description, ≤ 10000 chars. |
stylePreset | string | luxury | One of minimal artistic corporate playful luxury tech nature. |
creativity | number | 0.5 | 0–1. Affects LLM temperature + boldness of design choices. |
strictScannability | boolean | true | When on, the engine auto-fixes any scannability issue. When off, it warns. |
logoUrl | string | — | Embedded center, modules cleared beneath, ECC raised to H. |
logoBase64 | string | — | Same as above but inline base64. |
backgroundImageUrl | string | — | Soft background image (blended behind the QR). |
centerText | object | — | { text, color?, backgroundColor?, fontSize? }. Banner across the QR. |
ctaText | string | — | Caption below. |
fileFormat | string | png | png jpg svg pdf webp. |
outputWidth | number | 800 | Pixels. |
responseType | string | base64 | base64 or binary. |
Marketplace endpoint additionally requires:
| Field | Type | Notes |
|---|---|---|
llmProvider | string | openai anthropic google mistral cohere groq xai deepseek qwen local |
llmApiKey | string | Your provider key |
llmModel | string | Optional — defaults to the provider's default model (see /api/qr/ai/providers); any model ID the provider offers is accepted |
Response
{
"success": true,
"qrBase64": "iVBORw0KGgo…",
"format": "png",
"contentType": "image/png",
"sizeBytes": 38291,
"generatedConfig": { "moduleShape": "diamond", "finderOuterShape": "octagon", "...": "..." },
"aiExplanation": "Diamond modules and octagonal finders for the geometric art deco feel; gold-on-ivory keeps contrast at 6.4:1.",
"llmProviderUsed": "openai",
"llmModelUsed": "gpt-6-luna"
}
generatedConfig is the full QrConfig the AI produced — useful if you want to take that config into Manual mode and tweak it by hand.
See also
- POST /api/qr/generate — the rendering endpoint underneath
- QrConfig reference — full parameter list the AI is allowed to pick from