Skip to main content

Overview

AI Meme Generator creates humorous memes by combining popular meme templates with your custom topics. The API automatically generates contextually appropriate text for both top and bottom panels that fits the chosen meme template and your specified topic.

How It Works

  1. Choose a template - Select from popular meme formats (Drake, Distracted Boyfriend, etc.)
  2. Provide a topic - Describe what the meme should be about
  3. Optional web search - Enable AI to search for relevant context
  4. API generates text - AI creates appropriate text for the meme panels
  5. Download - Retrieve your completed meme

Use Cases

  • Social media content - Quick meme generation for engagement
  • Marketing campaigns - Relatable brand content
  • Internal communications - Team humor and culture building
  • Educational content - Making learning more engaging
  • Community management - Timely responses to trends

Best Practices

Topic Selection

Be specific about your topic - Clear topics generate more relevant and funny memes.
✅ Good topics:
  • “When the code finally works after 3 hours of debugging”
  • “Designers vs developers arguing about button placement”
  • “Coffee before and after the first sip”
  • “Me explaining my job to my parents”
❌ Avoid:
  • Vague topics like “work” or “life”
  • Topics requiring extensive context
  • Offensive or controversial subjects

Template Selection

Popular templates work best with their intended formats:
TemplateBest ForExample Topic
Drake Hotline BlingPreferences, choices”Old code vs new refactored code”
Distracted BoyfriendConflicting interests”Me, my project, new framework”
Two ButtonsDifficult decisions”Fix bug or add feature”
Expanding BrainProgressive ideas”Levels of code optimization”

Web Search Option

  • Enable search_web: true when your topic references current events or trends
  • Disable search_web: false for general topics that don’t need context
  • Web search may add slight processing time but improves relevance

Code Examples

Basic Meme Generation

from magic_hour import Client
import os

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

result = client.v1.ai_meme_generator.generate(
    style={
        "search_web": False,
        "template": "Drake Hotline Bling",
        "topic": "When the code finally works after hours of debugging"
    },
    name="Code Works Meme",
    wait_for_completion=True,
    download_outputs=True,
    download_directory="./outputs/"
)

if result.status == "complete":
    print(f"✅ Meme 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}")

Random Template

result = client.v1.ai_meme_generator.generate(
    style={
        "search_web": False,
        "template": "Random",
        "topic": "Forgetting to turn the stove off at 2am"
    },
    name="Stove Meme",
    wait_for_completion=True,
    download_outputs=True,
    download_directory="./outputs/"
)

if result.status == "complete":
    print(f"✅ Meme 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}")
result = client.v1.ai_meme_generator.generate(
    style={
        "search_web": True,
        "template": "Two Buttons",
        "topic": "The latest controversy in AI image generation"
    },
    name="AI Controversy Meme",
    wait_for_completion=True,
    download_outputs=True,
    download_directory="./outputs/"
)

if result.status == "complete":
    print(f"✅ Meme 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

OutputCredits
1 meme10 credits
Try this in our Google Colab Cookbook: Run this API with sample code. Just add your API key.

API Reference

AI Meme Generator API Reference

View full API specification