Skip to main content

Overview

AI QR Code Generator creates visually appealing, artistic QR codes that maintain full functionality while incorporating custom designs, colors, and artistic elements. The API generates QR codes that blend seamlessly with branding and creative designs.

How It Works

  1. Provide QR content - Enter the URL or text for the QR code
  2. Describe the style - Use a text prompt to describe the visual design
  3. API generates the QR code - AI creates an artistic QR code that still scans
  4. Download and test - Retrieve and verify your QR code works

Use Cases

  • Marketing materials - Branded QR codes for campaigns
  • Event tickets - Artistic codes that match event branding
  • Restaurant menus - Stylized codes that fit restaurant aesthetics
  • Business cards - Eye-catching professional QR codes
  • Product packaging - QR codes that complement packaging design

Best Practices

Style Prompts

Describe artistic elements, not the QR code itself - Focus on colors, themes, and artistic style.
✅ Good prompts:
  • “Ocean waves with blue and teal colors, flowing organic patterns”
  • “Forest landscape with trees and green nature elements”
  • “Abstract geometric art in corporate blue and white”
  • “Japanese cherry blossoms with pink and white colors”
❌ Avoid:
  • “QR code” - The system already knows it’s a QR code
  • Conflicting styles that would obscure the code pattern
  • Extremely dark or low-contrast designs

Ensuring Scannability

  • Test every generated QR code - Always verify it scans before using
  • Maintain contrast - Lighter backgrounds with darker patterns work best
  • Avoid over-complexity - Very busy designs may reduce scan reliability
  • Use error correction - The AI maintains error correction for reliability

Content Guidelines

Content TypeExampleBest Practice
URLshttps://yoursite.comUse short URLs or URL shorteners
TextContact infoKeep text concise
vCardsContact cardsMinimize data for smaller codes

Code Examples

Basic QR Code Generation

from magic_hour import Client
import os

client = Client(token=os.getenv("MAGIC_HOUR_API_KEY"))

result = client.v1.ai_qr_code_generator.generate(
    content="https://magichour.ai",
    style={"art_style": "Watercolor"},
    name="Brand QR Code",
    wait_for_completion=True,
    download_outputs=True,
    download_directory="./outputs/"
)

if result.status == "complete":
    print(f"✅ QR code complete!")
    print(f"Downloaded to: {result.downloaded_paths}")
    print(f"Credits charged: {result.credits_charged}")
else:
    print(f"❌ Job failed with status: {result.status}")
    if hasattr(result, 'error_message'):
        print(f"Error: {result.error_message}")

Custom Prompt

result = client.v1.ai_qr_code_generator.generate(
    content="https://openai.com",
    style={
        "art_style": "Studio Ghibli style scene of Shibuya streets at rush hour",
    },
    name="OpenAI QR Code",
    wait_for_completion=True,
    download_outputs=True,
    download_directory="./outputs/"
)

if result.status == "complete":
    print(f"✅ QR code complete!")
    print(f"Downloaded to: {result.downloaded_paths}")
    print(f"Credits charged: {result.credits_charged}")
else:
    print(f"❌ Job failed with status: {result.status}")
    if hasattr(result, 'error_message'):
        print(f"Error: {result.error_message}")

Pricing

Currently Free - QR Code Generator is temporarily free to use. Normally, each QR code costs 5 credits.
OutputCredits
1 QR codeTemporarily free (normally 5 credits)
Try this in our Google Colab Cookbook: Run this API with sample code. Just add your API key.

API Reference

AI QR Code Generator API Reference

View full API specification