POST /api/qr/ai/generate
/api/qr/generate と同じレンダラーですが、欲しいものを文で説明すると、エンジンが形状、色、ファインダーの目を選びます。
AIエンドポイントには3つのバリエーションがあります。使用する認証方式に合ったものを選んでください。
マーケットプレイス — LLMキーは各自で用意
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"
}'
LLMの認証情報はあなたが用意します。エンジンは生成された設定を検証し、スキャン保証のチェックを実行して、QRをレンダリングします。
マーケットプレイス — マネージドAI(LLMキー不要)
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"
}'
llmProvider / llmApiKey は不要です。サーバーは独自のモデルを、Groq → Gemini → OpenAI のフォールバックチェーンで使用します。レスポンスには "managed": true が含まれ、呼び出しはプランのマネージドAIクォータに計上されます。
コンシューマー — サーバー側のLLMキー
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
}'
llmProvider / llmApiKey は不要です。サーバーはGroq(gpt-oss-120b、次にgpt-oss-20b)→ OpenAI → Geminiの順に試します。成功すると残高からAIクレジットが1つ差し引かれ、失敗した場合はクレジットを消費しません。
コードサンプル
リクエストボディ
| フィールド | 型 | デフォルト | 備考 |
|---|---|---|---|
content | string | 必須 | エンコードする内容(URL / テキスト)。 |
prompt | string | 必須 | 自然な言葉による説明。10000文字以内。 |
stylePreset | string | luxury | minimal artistic corporate playful luxury tech nature のいずれか。 |
creativity | number | 0.5 | 0–1。LLMのtemperatureと、デザインの選択の大胆さに影響します。 |
strictScannability | boolean | true | オンのとき、エンジンは読み取り可能性の問題を自動修正します。オフのときは警告します。 |
logoUrl | string | — | 中央に埋め込み、その下のモジュールを消去し、ECCをHに引き上げます。 |
logoBase64 | string | — | 上と同じですが、インラインのbase64で渡します。 |
backgroundImageUrl | string | — | 控えめな背景画像(QRの背後にブレンド)。 |
centerText | object | — | { text, color?, backgroundColor?, fontSize? }。QRを横切るバナー。 |
ctaText | string | — | 下部のキャプション。 |
fileFormat | string | png | png jpg svg pdf webp。 |
outputWidth | number | 800 | ピクセル。 |
responseType | string | base64 | base64 または binary。 |
マーケットプレイスのエンドポイントでは、さらに次が必要です。
| フィールド | 型 | 備考 |
|---|---|---|
llmProvider | string | openai anthropic google mistral cohere groq xai deepseek qwen local |
llmApiKey | string | プロバイダーのキー |
llmModel | string | 任意 — 省略時はそのプロバイダーのデフォルトモデル(/api/qr/ai/providers を参照)。プロバイダーが提供する任意のモデルIDを指定できます |
レスポンス
{
"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 はAIが生成したQrConfigの全体です。その設定を手動モードに持ち込んで手で調整したいときに便利です。
関連項目
- POST /api/qr/generate — 内部で使われるレンダリング用エンドポイント
- QrConfigリファレンス — AIが選択できるパラメータの全一覧