Skip to content

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

FieldTypeDefaultNotes
contentstringrequiredWhat to encode (URL / text).
promptstringrequiredPlain language description, ≤ 10000 chars.
stylePresetstringluxuryOne of minimal artistic corporate playful luxury tech nature.
creativitynumber0.50–1. Affects LLM temperature + boldness of design choices.
strictScannabilitybooleantrueWhen on, the engine auto-fixes any scannability issue. When off, it warns.
logoUrlstring—Embedded center, modules cleared beneath, ECC raised to H.
logoBase64string—Same as above but inline base64.
backgroundImageUrlstring—Soft background image (blended behind the QR).
centerTextobject—{ text, color?, backgroundColor?, fontSize? }. Banner across the QR.
ctaTextstring—Caption below.
fileFormatstringpngpng jpg svg pdf webp.
outputWidthnumber800Pixels.
responseTypestringbase64base64 or binary.

Marketplace endpoint additionally requires:

FieldTypeNotes
llmProviderstringopenai anthropic google mistral cohere groq xai deepseek qwen local
llmApiKeystringYour provider key
llmModelstringOptional — 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