Skip to main content

Architecture Overview

Driver Registry System

ClawRecipes uses a driver registry that maps providers to skill scripts:
Key Components:
  • 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

  1. Workflow node specifies provider (e.g., "provider": "nano-banana-pro")
  2. Worker looks up driver in registry by slug
  3. Driver locates skill directory and script
  4. Script executes with prompt and config
  5. 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
Setup:
Configuration:
Supported sizes:
  • 1024x1024 → 1K resolution
  • 1792x1792 → 2K resolution
  • 3840x3840 → 4K resolution

DALL-E (OpenAI)

Requirements:
  • OPENAI_API_KEY environment variable
  • ClawHub skill: openai-dalle
Setup:
Configuration:
Supported options:
  • 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
Setup:
Configuration:
Constraints:
  • 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
Setup:
Configuration:

Luma AI

Requirements:
  • LUMAAI_API_KEY environment variable
  • ClawHub skill: luma-video
Setup:
Configuration:

Configuration Fields

Core Fields

promptTemplate — Template string with variable substitution
provider — Driver slug (matches skill folder name)
outputPath — Custom output file path (optional)

Size Configuration

For Images:
For Videos:

Duration Configuration (Videos)

Provider Constraints:
  • Kling AI: 3-15 seconds
  • Runway: 1-10 seconds
  • Luma AI: 2-10 seconds

Prompt Refinement

addRefinement — Enable LLM prompt enhancement (opt-in)
When enabled:
  1. Input prompt processed by LLM for enhancement
  2. Enhanced prompt sent to media provider
  3. Results in more detailed, production-ready prompts
Default: false (upstream LLM nodes should produce ready prompts)

Environment Variables

Loading Hierarchy

ClawRecipes loads environment variables from:
  1. Process environmentprocess.env (highest priority)
  2. OpenClaw config~/.openclaw/openclaw.jsonenv.vars

OpenClaw Config Format

Modern format: (recommended)
Legacy format: (still supported)

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:
Upstream node outputs:

Example Templates

Product marketing image:
Social video:

Troubleshooting

Driver Not Found

Error:
Diagnosis:
Solutions:
  1. Install missing skill: clawhub install nano-banana-pro
  2. Check skill directory permissions
  3. Restart gateway if skill was just installed

Missing Environment Variables

Error:
Diagnosis:
Solutions:
  1. Set via config: openclaw gateway config update env.vars.GEMINI_API_KEY "your-key"
  2. Export in shell before starting gateway
  3. Restart gateway after config changes

Script Execution Failures

Error:
Diagnosis:
Solutions:
  1. Reinstall skill: clawhub install nano-banana-pro --force
  2. Manually setup venv: cd skill && python -m venv .venv && .venv/bin/pip install -r requirements.txt
  3. Check skill documentation for dependencies

Prompt Too Long

Error:
Solutions:
  1. Enable refinement: "addRefinement": "true" — let LLM condense the prompt
  2. Shorten templates: Remove verbose instructions from prompt template
  3. Upstream editing: Have prior LLM nodes produce concise briefs

Output Path Issues

Error:
Solutions:
  1. Use relative paths: "outputPath": "media/{{node.id}}.png"
  2. Don’t include ../ in paths
  3. Paths are resolved relative to workflow run directory

Permission Errors

Error:
Solutions:
  1. Fix ownership: sudo chown -R control:control ~/.openclaw/
  2. Check directory permissions: chmod 755 ~/.openclaw/skills/
  3. Reinstall skill if corrupted

Timeout Issues

Error:
Solutions:
  1. Increase timeout: Add "timeoutMs": 600000 to node config
  2. Check API status: Verify provider service availability
  3. Reduce complexity: Simplify prompts for faster generation

Advanced Configuration

Custom Output Directories

Creates: 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:

Implementation Details

Core Code Locations:
  • src/lib/workflows/media-drivers/ — Driver implementations
  • src/lib/workflows/workflow-worker.ts — Media node execution
  • src/handlers/media-drivers.ts — CLI media-drivers command
Driver Interface:
  • MediaDriver — TypeScript interface for all providers
  • MediaDriverInvokeOpts — Standardized invocation parameters
  • MediaDriverResult — Standardized return format
Registry System:
  • Known drivers registered in registry.ts
  • Generic driver auto-discovery for unlisted skills
  • Runtime environment variable availability checking