Architecture Overview
Driver Registry System
ClawRecipes uses a driver registry that maps providers to skill scripts:- MediaDriver — TypeScript adapter with provider-specific logic
- Skill — Folder containing scripts, dependencies, and documentation
- Registry — Maps provider names to drivers for runtime lookup
- Worker — Executes media nodes using appropriate drivers
Execution Flow
- Workflow node specifies provider (e.g.,
"provider": "nano-banana-pro") - Worker looks up driver in registry by slug
- Driver locates skill directory and script
- Script executes with prompt and config
- Output file saved to workflow run media directory
Setup Instructions
Image Generation
Nano Banana Pro (Gemini)
Requirements:- GEMINI_API_KEY environment variable
- ClawHub skill:
nano-banana-pro
1024x1024→ 1K resolution1792x1792→ 2K resolution3840x3840→ 4K resolution
DALL-E (OpenAI)
Requirements:- OPENAI_API_KEY environment variable
- ClawHub skill:
openai-dalle
- size:
1024x1024,1024x1792,1792x1024 - quality:
standard,hd - style:
natural,vivid
Video Generation
Kling AI
Requirements:- Kling AI credentials file (NOT environment variables)
- ClawHub skill:
klingai
- Duration: 3-15 seconds
- Aspect ratios:
16:9,9:16,1:1 - Mode: pro (fixed)
Runway
Requirements:- RUNWAYML_API_SECRET environment variable
- ClawHub skill:
runway-video
Luma AI
Requirements:- LUMAAI_API_KEY environment variable
- ClawHub skill:
luma-video
Configuration Fields
Core Fields
promptTemplate — Template string with variable substitutionSize Configuration
For Images:Duration Configuration (Videos)
- Kling AI: 3-15 seconds
- Runway: 1-10 seconds
- Luma AI: 2-10 seconds
Prompt Refinement
addRefinement — Enable LLM prompt enhancement (opt-in)- Input prompt processed by LLM for enhancement
- Enhanced prompt sent to media provider
- Results in more detailed, production-ready prompts
false (upstream LLM nodes should produce ready prompts)
Environment Variables
Loading Hierarchy
ClawRecipes loads environment variables from:- Process environment —
process.env(highest priority) - OpenClaw config —
~/.openclaw/openclaw.json→env.vars
OpenClaw Config Format
Modern format: (recommended)Setting Environment Variables
Skill Installation
ClawHub Installation
Installation Roots
Skills are discovered from these directories:~/.openclaw/skills/— Global shared skills~/.openclaw/workspace/skills/— Workspace-local skills~/.openclaw/workspace/— ClawHub sometimes installs here
Verification
Template Variables
Media nodes support full template variable substitution in:- promptTemplate — AI generation prompt
- outputPath — Custom file paths
Available Variables
Global variables:Example Templates
Product marketing image:Troubleshooting
Driver Not Found
Error:- Install missing skill:
clawhub install nano-banana-pro - Check skill directory permissions
- Restart gateway if skill was just installed
Missing Environment Variables
Error:- Set via config:
openclaw gateway config update env.vars.GEMINI_API_KEY "your-key" - Export in shell before starting gateway
- Restart gateway after config changes
Script Execution Failures
Error:- Reinstall skill:
clawhub install nano-banana-pro --force - Manually setup venv:
cd skill && python -m venv .venv && .venv/bin/pip install -r requirements.txt - Check skill documentation for dependencies
Prompt Too Long
Error:- Enable refinement:
"addRefinement": "true"— let LLM condense the prompt - Shorten templates: Remove verbose instructions from prompt template
- Upstream editing: Have prior LLM nodes produce concise briefs
Output Path Issues
Error:- Use relative paths:
"outputPath": "media/{{node.id}}.png" - Don’t include
../in paths - Paths are resolved relative to workflow run directory
Permission Errors
Error:- Fix ownership:
sudo chown -R control:control ~/.openclaw/ - Check directory permissions:
chmod 755 ~/.openclaw/skills/ - Reinstall skill if corrupted
Timeout Issues
Error:- Increase timeout: Add
"timeoutMs": 600000to node config - Check API status: Verify provider service availability
- Reduce complexity: Simplify prompts for faster generation
Advanced Configuration
Custom Output Directories
workspace-team/assets/Content Pipeline/2025-04-04T03-53-00-123Z/hero.png
Model Selection (Provider-Specific)
Some drivers support model selection:Provider Fallbacks
Use LLM nodes to implement fallback logic:Related Documentation
- MEDIA_DRIVERS.md — Developer guide for adding new providers
- TEMPLATE_VARIABLES.md — Template variable syntax and examples
- WORKFLOW_NODES.md — Complete node configuration reference
- INSTALLATION.md — Installing ClawRecipes and dependencies
Implementation Details
Core Code Locations:src/lib/workflows/media-drivers/— Driver implementationssrc/lib/workflows/workflow-worker.ts— Media node executionsrc/handlers/media-drivers.ts— CLI media-drivers command
MediaDriver— TypeScript interface for all providersMediaDriverInvokeOpts— Standardized invocation parametersMediaDriverResult— Standardized return format
- Known drivers registered in
registry.ts - Generic driver auto-discovery for unlisted skills
- Runtime environment variable availability checking
