Creative Director Engine is a FastAPI backend for Marko AI that turns a campaign brief into ready-to-execute creative packages:
- Hook generation
- Messaging angles
- Platform-specific ad copy
- Visual concept planning
- NanoBanana creative generation
- Scoring and ranking
- Local storage with optional S3 mirroring
The system is API-first. A frontend dashboard is intentionally left optional.
- FastAPI
- Pydantic
- Groq chat completions with structured JSON outputs
- NanoBanana API adapter
- Local filesystem output with S3-ready mirroring
app/
api/routes/creatives.py
core/config.py
models/creative.py
providers/groq_llm.py
providers/nanobanana.py
services/prompts.py
services/generators.py
services/scoring.py
services/storage.py
services/engine.py
examples/
sample_request.json
sample_response.json
sample_prompts.md
output/
Generates 10 to 20 hooks across:
- Curiosity
- Fear-based
- Benefit-driven
- Contrarian
- Social-proof
Generates 3 to 7 angles with:
- Description
- Target emotion
- Use case
Creates platform-aware copy variants with:
primary_textheadlinectadescription
The generator also post-processes character limits per platform.
Builds execution-ready concepts with:
- Scene description
- Camera angle
- Background setting
- Color palette
- Mood
- Style reference
- Aspect ratio
The NanoBanana provider adapter:
- Prefers
/api/v2/images/generate - Falls back to
/api/v1/images/generate - Polls status endpoints when a task ID is returned
- Returns generated image or video URLs when available
- Gracefully marks assets as
skippedorfailedwhen generation cannot complete
Each creative is ranked on:
- Emotional intensity
- Clarity
- Uniqueness
- Platform fit
Every run persists:
input.jsonhooks.jsonangles.jsonad_copy.jsonvisual_concepts.jsoncreative_scores.jsoncreatives.jsoncampaign_manifest.json
Input schema:
{
"brand_name": "Marko AI",
"product_description": "AI ad tool that generates hooks, copy, and creative strategy for founders.",
"target_audience": "Startup founders and growth marketers",
"platform": "meta",
"objective": "conversions",
"tone": "premium",
"key_benefits": ["Faster ideation", "More hooks", "Sharper testing"],
"competitors": ["Jasper", "Copy.ai"],
"visual_style": "cinematic SaaS ads"
}Response includes:
- Hooks
- Angles
- Ad copies
- Visual concepts
- Generated creatives
- Scores
- Packaged creative assets
- Output directory
Returns the highest-ranked creative assets from stored output packages.
Query params:
limitplatform
pip install -r requirements.txtcopy .env.example .envSet:
GROQ_API_KEYNANOBANANA_API_KEY
Optional:
GROQ_MODELGROQ_FALLBACK_MODELSGROQ_MAX_RETRIESGROQ_RETRY_BASE_DELAY_SECONDSOUTPUT_ROOTS3_BUCKET_NAMES3_REGION
uvicorn app.main:app --reloadcurl -X POST http://127.0.0.1:8000/generate-creatives ^
-H "Content-Type: application/json" ^
--data @examples/sample_request.jsonEach campaign run is written to:
output/
campaign-slug/
timestamp/
hooks.json
angles.json
ad_copy.json
visual_concepts.json
creatives.json
creative_scores.json
campaign_manifest.json
GROQ_API_KEYis required for hooks, angles, copy, and visual concepts.- Groq requests now use retry/backoff for transient failures and
429responses. GROQ_FALLBACK_MODELScan be set as a comma-separated env value to try backup models when the primary model is throttled.NANOBANANA_API_KEYis required for actual image generation. Without it, the package still builds and marks generated assets asskipped.- S3 upload is optional. If
S3_BUCKET_NAMEis set andboto3is installed, saved JSON artifacts are mirrored to S3. - Sample request, response, and prompts live in examples/sample_request.json, examples/sample_response.json, and examples/sample_prompts.md.