Skill: wondershare-boop/tomoviee-reference-to-image (version 1.0.2)

--- name: tomoviee-reference-to-image description: Generate images from a reference image using Tomoviee Image-to-Image API (`tm_reference_img2img`) through Wondershare OpenAPI gateway (`https://openapi.wondershare.cc`). Use when users request image-to-image editing, style transfer, or subject-preserving transformations. --- # Tomoviee AI Reference-to-Image ## Overview Generate new images from a reference image and prompt. - API capability: `tm_reference_img2img` - Create endpoint: `https://openapi.wondershare.cc/v1/open/capacity/application/tm_reference_img2img` - Result endpoint: `https://openapi.wondershare.cc/v1/open/pub/task` ## Provider and Endpoint Provenance Use this mapping to verify provider identity and runtime endpoint provenance: - Vendor portals: `https://www.tomoviee.ai` and `https://www.tomoviee.cn` - Runtime gateway host used by this skill: `https://openapi.wondershare.cc` - This skill sends runtime API calls only to `openapi.wondershare.cc` ## Credential Handling - `app_key` and `app_secret` are only used to build `Authorization: Basic <base64(app_key:app_secret)>`. - Credentials are kept in process memory only and are not written to disk by this skill. - Do not commit credentials into skill files or repository history. ## Quick Start ### Install dependencies ```bash pip install -r requirements.txt ``` ### Authentication helper ```bash python scripts/generate_auth_token.py YOUR_APP_KEY YOUR_APP_SECRET ``` ### Python Client ```python from scripts.tomoviee_img2img_client import TomovieeImg2ImgClient client = TomovieeImg2ImgClient("app_key", "app_secret") ``` ## API Usage ### Basic Example ```python task_id = client.image_to_image( prompt="Keep subject identity and posture, transform scene to modern office, photorealistic lighting", reference_image="https://example.com/reference.jpg", control_type="2", init_image="https://example.com/reference.jpg", width=1024, height=1024, batch_size=1, control_intensity=0.5, ) result = client.poll_until_complete(task_id) import json image_url = json.loads(result["result"])["images_path"][0] print(image_url) ``` ### Parameters - `prompt` (required): Text prompt for preservation and transformation instructions. - `reference_image` (required): Input reference image URL. - `control_type` (required): Control mode. Supported values: `"0"`, `"1"`, `"2"`, `"3"`. - `width` (required): Output width in pixels, range `512-2048`. - `height` (required): Output height in pixels, range `512-2048`. - `batch_size` (required): Number of generated images, range `1-4`. - `control_intensity` (required): Control strength, range `0-1`. - `init_image` (optional): Required by backend when `control_type="2"`. - `callback` (optional): Callback URL. - `params` (optional): Transparent callback passthrough parameter. ## Async Workflow 1. Create task and get `task_id` 2. Poll with `poll_until_complete(task_id)` 3. Parse output image URL(s) from `result` Status codes: - `1` queued - `2` processing - `3` success - `4` failed - `5` cancelled - `6` timeout ## Resources - `scripts/tomoviee_img2img_client.py` - main API client - `scripts/tomoviee_image_to_image_client.py` - compatibility import shim - `scripts/generate_auth_token.py` - auth token helper - `references/image_apis.md` - API reference and constraints - `references/prompt_guide.md` - prompt writing guidance ## External Resources - Developer portal (global): `https://www.tomoviee.ai/developers.html` - API docs (global): `https://www.tomoviee.ai/doc/ai-image/image-to-image.html` - Developer portal (mainland): `https://www.tomoviee.cn/developers.html` - API docs (mainland): `https://www.tomoviee.cn/doc/ai-image/image-to-image.html`

path: requirements.txt
content: requests>=2.31.0,<3.0.0

path: _meta.json
content: ownerId: kn7bn8fv79mjtchs17087tdtsx82fc86
slug: tomoviee-reference-to-image
version: 1.0.1
publishedAt: 1772933965996

path: scripts/generate_auth_token.py
content: #!/usr/bin/env python3
"""
Generate authentication token for Tomoviee API.

Usage:
    python generate_auth_token.py <app_key> <app_secret>

Output:
    Base64 encoded access_token in the format required by Authorization header
"""

import base64
import sys


def generate_access_token(app_key: str, app_secret: str) -> str:
    """
    Generate access token for Tomoviee API authentication.
    
    Args:
        app_key: Application key from Tomoviee console
        app_secret: Application secret from Tomoviee console
    
    Returns:
        Base64 encoded string in format: base64(app_key:app_secret)
    """
    credentials = f"{app_key}:{app_secret}"
    access_token = base64.b64encode(credentials.encode()).decode()
    return access_token


if __name__ == "__main__":
    if len(sys.argv) != 3:
        print("Usage: python generate_auth_token.py <app_key> <app_secret>")
        sys.exit(1)
    
    app_key = sys.argv[1]
    app_secret = sys.argv[2]
    
    [REDACTED_SECRET], app_secret)
    print(f"Access [REDACTED_SECRET]")
    print(f"\nUse in Authorization header as: Basic {token}")


path: scripts/tomoviee_image_to_image_client.py
content: #!/usr/bin/env python3
"""Compatibility shim. Prefer importing TomovieeImg2ImgClient from tomoviee_img2img_client."""

try:
    from scripts.tomoviee_img2img_client import TomovieeClient, TomovieeImg2ImgClient
except Exception:
    from tomoviee_img2img_client import TomovieeClient, TomovieeImg2ImgClient

__all__ = ["TomovieeClient", "TomovieeImg2ImgClient"]

path: scripts/tomoviee_img2img_client.py
content: #!/usr/bin/env python3
"""Tomoviee AI - Image-to-Image API client."""

import base64
import json
import time
from typing import Any, Dict, Optional

import requests


class TomovieeImg2ImgClient:
    """Image-to-Image API client for Tomoviee AI."""

    BASE_URL = "https://openapi.wondershare.cc/v1/open/capacity/application"
    RESULT_ENDPOINT = "https://openapi.wondershare.cc/v1/open/pub/task"
    ENDPOINT = "tm_reference_img2img"
    REQUEST_TIMEOUT = 60

    def __init__(self, app_key: str, app_secret: str):
        self.app_key = app_key
        self.access_token = self._generate_token(app_key, app_secret)

    def _generate_token(self, app_key: str, app_secret: str) -> str:
        credentials = f"{app_key}:{app_secret}"
        return base64.b64encode(credentials.encode()).decode()

    def _get_headers(self) -> Dict[str, str]:
        return {
            "Content-Type": "application/json",
            "X-App-Key": self.app_key,
            "Authorization": f"Basic {self.access_token}",
        }

    def _safe_json(self, response: requests.Response) -> Dict[str, Any]:
        try:
            return response.json()
        except ValueError as exc:
            raise Exception(f"Invalid JSON response: {response.text}") from exc

    def _make_request(self, payload: Dict[str, Any]) -> str:
        url = f"{self.BASE_URL}/{self.ENDPOINT}"
        response = requests.post(
            url,
            headers=self._get_headers(),
            json=payload,
            timeout=self.REQUEST_TIMEOUT,
        )
        response.raise_for_status()
        result = self._safe_json(response)

        if result.get("code") != 0:
            raise Exception(f"API Error: {result.get('msg', 'Unknown error')}")

        task_id = result.get("data", {}).get("task_id")
        if not task_id:
            raise Exception(f"Missing task_id in response: {result}")
        return task_id

    def image_to_image(
        self,
        prompt: str,
        reference_image: Optional[str] = None,
        control_type: str = "2",
        init_image: Optional[str] = None,
        width: int = 1024,
        height: int = 1024,
        batch_size: int = 1,
        control_intensity: float = 0.5,
        callback: Optional[str] = None,
        params: Optional[str] = None,
        image: Optional[str] = None,
        image_num: Optional[int] = None,
    ) -> str:
        """Create an image-to-image task and return task_id.

        Backward compatibility:
        - `image` is treated as `reference_image`.
        - `image_num` is treated as `batch_size`.
        """
        ref = reference_image or image
        if not ref:
            raise ValueError("reference_image is required")

        if image_num is not None:
            batch_size = image_num

        if width < 512 or width > 2048:
            raise ValueError("width must be in range 512..2048")
        if height < 512 or height > 2048:
            raise ValueError("height must be in range 512..2048")
        if batch_size < 1 or batch_size > 4:
            raise ValueError("batch_size must be in range 1..4")
        if control_intensity < 0 or control_intensity > 1:
            raise ValueError("control_intensity must be in range 0..1")

        ct = str(control_type)
        if ct not in {"0", "1", "2", "3"}:
            raise ValueError("control_type must be one of: 0, 1, 2, 3")

        payload: Dict[str, Any] = {
            "prompt": prompt,
            "width": width,
            "height": height,
            "batch_size": batch_size,
            "control_intensity": control_intensity,
            "control_type": ct,
            "reference_image": ref,
        }

        if ct == "2":
            payload["init_image"] = init_image or ref
        elif init_image:
            payload["init_image"] = init_image

        if callback:
            payload["callback"] = callback
        if params:
            payload["params"] = params

        return self._make_request(payload)

    def get_result(self, task_id: str) -> Dict[str, Any]:
        response = requests.post(
            self.RESULT_ENDPOINT,
            headers=self._get_headers(),
            json={"task_id": task_id},
            timeout=self.REQUEST_TIMEOUT,
        )
        response.raise_for_status()
        result = self._safe_json(response)

        if result.get("code") != 0 and not result.get("data"):
            raise Exception(f"API Error: {result.get('msg', 'Unknown error')}")

        data = result.get("data")
        if not data:
            raise Exception(f"Missing task data in response: {result}")
        return data

    def poll_until_complete(
        self,
        task_id: str,
        poll_interval: int = 10,
        timeout: int = 600,
    ) -> Dict[str, Any]:
        elapsed = 0
        while elapsed < timeout:
            result = self.get_result(task_id)
            status = result.get("status")

            if status == 3:
                return result
            if status in [4, 5, 6]:
                raise Exception(f"Task failed: {result.get('reason', 'Unknown error')}")

            time.sleep(poll_interval)
            elapsed += poll_interval

        raise TimeoutError(f"Task did not complete within {timeout} seconds")


# Backward-compatible alias
TomovieeClient = TomovieeImg2ImgClient


if __name__ == "__main__":
    import sys

    if len(sys.argv) < 5:
        print(
            "Usage: python scripts/tomoviee_img2img_client.py "
            "<app_key> <app_secret> <prompt> <reference_image_url> "
            "[control_type] [width] [height] [batch_size] [control_intensity] [init_image_url]"
        )
        sys.exit(1)

    app_key = sys.argv[1]
    app_secret = sys.argv[2]
    prompt = sys.argv[3]
    reference_image = sys.argv[4]
    control_type = sys.argv[5] if len(sys.argv) > 5 else "2"
    width = int(sys.argv[6]) if len(sys.argv) > 6 else 1024
    height = int(sys.argv[7]) if len(sys.argv) > 7 else 1024
    batch_size = int(sys.argv[8]) if len(sys.argv) > 8 else 1
    control_intensity = float(sys.argv[9]) if len(sys.argv) > 9 else 0.5
    init_image = sys.argv[10] if len(sys.argv) > 10 else None

    client = TomovieeImg2ImgClient(app_key, app_secret)

    try:
        print("Creating image-to-image task...")
        task_id = client.image_to_image(
            prompt=prompt,
            reference_image=reference_image,
            control_type=control_type,
            width=width,
            height=height,
            batch_size=batch_size,
            control_intensity=control_intensity,
            init_image=init_image,
        )
        print(f"Task created: {task_id}")
        print("Polling for result...")

        result = client.poll_until_complete(task_id)

        print("\nTask completed")
        print(f"Progress: {result.get('progress', 'N/A')}%")

        result_data = json.loads(result["result"])
        print(json.dumps(result_data, indent=2, ensure_ascii=False))

    except Exception as exc:
        print(f"Error: {exc}")
        sys.exit(1)

path: references/image_apis.md
content: # Tomoviee Image-to-Image API Reference

## Provenance and Endpoint Mapping

- Vendor portals: `https://www.tomoviee.ai` and `https://www.tomoviee.cn`
- Runtime gateway host used by this skill: `https://openapi.wondershare.cc`
- Primary capability: `tm_reference_img2img`

All runtime API calls in this skill target only:

1. `https://openapi.wondershare.cc/v1/open/capacity/application/tm_reference_img2img`
2. `https://openapi.wondershare.cc/v1/open/pub/task`

## Text Parameters

- `prompt` (required): Prompt text (preserve + modify instructions)

## Control Parameters

- `control_type` (required): `"0"`, `"1"`, `"2"`, `"3"`
- `control_intensity` (required): `0-1`

## Image Parameters

- `reference_image` (required): reference image URL
- `init_image` (optional): backend-required when `control_type="2"`

## Output Parameters

- `width` (required): `512-2048`
- `height` (required): `512-2048`
- `batch_size` (required): `1-4`

## Optional Callback Parameters

- `callback` (optional): callback URL
- `params` (optional): transparent callback passthrough

## Result Endpoint

`https://openapi.wondershare.cc/v1/open/pub/task`

## Status Codes

- `1` queued
- `2` processing
- `3` success
- `4` failed
- `5` cancelled
- `6` timeout

## Example

```python
from scripts.tomoviee_img2img_client import TomovieeImg2ImgClient

client = TomovieeImg2ImgClient("app_key", "app_secret")
task_id = client.image_to_image(
    prompt="Keep identity and composition, change background to modern office",
    reference_image="https://example.com/reference.jpg",
    control_type="2",
    init_image="https://example.com/reference.jpg",
    width=1024,
    height=1024,
    batch_size=1,
    control_intensity=0.5,
)
result = client.poll_until_complete(task_id)
```

path: references/prompt_guide.md
content: # Tomoviee Prompt Engineering Guide

## Overview
This guide provides structured prompt formulas and best practices for all Tomoviee AI APIs to achieve optimal generation results.

---

## Video APIs

### Text-to-Video Prompt Formula
```
主体(描述) + 运动 + 场景(描述) + (镜头语言 + 光影 + 氛围)
Subject (description) + Motion + Scene (description) + (Camera + Lighting + Atmosphere)
```

**Component Breakdown**:

1. **Subject (主体)**: Main focus of the video
   - Who/what is in the scene
   - Key characteristics, appearance
   - Position and pose

2. **Motion (运动)**: Action and movement
   - What the subject is doing
   - Speed and direction of movement
   - Dynamic elements

3. **Scene (场景)**: Environment and context
   - Location and setting
   - Background elements
   - Time of day/season

4. **Camera (镜头语言)**: Optional camera work
   - Camera angle (wide, close-up, aerial, etc.)
   - Camera movement (pan, zoom, tracking, etc.)
   - Or specify `camera_move_index` parameter

5. **Lighting (光影)**: Optional lighting style
   - Natural/artificial light
   - Time of day (golden hour, blue hour, etc.)
   - Light direction and quality

6. **Atmosphere (氛围)**: Optional mood and tone
   - Overall feeling (dramatic, peaceful, energetic)
   - Color palette/grading
   - Weather/environmental effects

**Examples**:

**Minimal** (Subject + Motion + Scene):
```
"A red sports car driving fast on a coastal highway at sunset"
```

**Standard** (+ Camera + Lighting):
```
"A red sports car speeding along a winding coastal highway at golden hour, 
camera following from the side, warm orange sunlight reflecting off the car"
```

**Detailed** (+ Atmosphere):
```
"A sleek red Ferrari speeding along a dramatic coastal highway carved into cliffs, 
camera tracking smoothly from the side at car level, 
golden hour sunset casting long shadows and warm orange glow, 
cinematic and epic atmosphere with ocean waves crashing below"
```

**More Examples by Use Case**:

**Product Showcase**:
```
"White wireless headphones slowly rotating on a minimalist white surface, 
studio lighting with soft shadows, clean and modern atmosphere"
```

**Nature/Travel**:
```
"Majestic waterfall cascading down mossy rocks in a lush rainforest, 
slow zoom in from wide to medium shot, 
dappled sunlight filtering through the canopy, 
serene and peaceful atmosphere"
```

**Action/Sports**:
```
"Professional skateboarder performing a kickflip on urban street ramp, 
slow motion capture from low angle, 
bright daylight with high contrast shadows, 
energetic and dynamic atmosphere"
```

### Image-to-Video Prompt Formula
```
主体 + 运动 + 镜头语言
Subject + Motion + Camera
```

**Why simpler?** The image already provides:
- Scene and environment
- Lighting and color palette
- Composition and framing
- Atmosphere and mood

**Your prompt should focus on**:
- Motion to add to the static image
- Camera movement to apply
- Any new dynamic elements

**Examples**:

```
"Camera slowly zooming in, subject's hair gently blowing in the wind"
```

```
"Slow pan from left to right, leaves rustling, golden hour lighting"
```

```
"Camera orbiting around the subject, dramatic lighting, cinematic feel"
```

```
"Gentle push in toward the subject's face, bokeh background, emotional atmosphere"
```

### Video Continuation Prompt Formula
```
延续的动作 + 场景变化 + 镜头延续
Continued action + Scene evolution + Camera continuation
```

**Focus on**:
- How the action continues from the last frame
- Natural progression of movement
- Scene changes or transitions
- Camera movement consistency

**Examples**:

```
"The bird continues flying higher, soaring into the clouds, 
camera following the ascent"
```

```
"The car continues down the road, passing through a tunnel, 
maintaining tracking shot"
```

```
"The person continues walking, entering a brightly lit room, 
camera follows smoothly"
```

---

## Image APIs

### Image-to-Image Prompt Formula
```
参考图描述 + 保留要素 + 修改/新增指令
Reference description + Elements to preserve + Modifications/additions
```

**Component Breakdown**:

1. **Reference Description**: What's in the original image
2. **Preserve**: Explicitly state what to keep unchanged
3. **Modify/Add**: What to change or add

**Examples**:

```
"A woman in business attire at a modern office, 
preserve facial features and body pose, 
change background to outdoor garden with natural lighting, 
add warm sunset atmosphere"
```

```
"Portrait of a man wearing a blue shirt, 
keep facial features and expression, 
change clothing to formal black suit with tie, 
maintain studio lighting"
```

```
"Kitchen interior with white cabinets, 
preserve layout and appliance positions, 
change color scheme to navy blue cabinets with gold hardware, 
add marble countertops"
```

### Image Redrawing Prompt Formula
```
替换区域的新内容描述
Description of what replaces the masked area
```

**Focus on**:
- What should appear in the masked region
- Style/texture matching surrounding areas
- Lighting consistency
- Natural integration

**Examples**:

```
"Clear blue sky with white fluffy clouds"
(for replacing background)
```

```
"Natural grass texture with small wildflowers"
(for replacing foreground)
```

```
"Modern glass windows with reflections of cityscape"
(for replacing building facade)
```

```
"Empty wooden table surface with subtle wood grain"
(for removing objects from table)
```

### Image Recognition Prompt Formula
```
要识别的对象/区域描述
Description of objects/regions to identify
```

**Focus on**:
- Clear object identification
- Specific vs. general (depending on need)
- Spatial context if helpful

**Examples**:

```
"person" / "all people"
```

```
"the red car in the foreground"
```

```
"sky and clouds"
```

```
"text and logos"
```

```
"background behind the main subject"
```

---

## Audio APIs

### Text-to-Music Prompt Formula
```
主体 + 场景(氛围/风格)
Subject/Theme + Scene (Atmosphere/Style)
```

**Component Breakdown**:

1. **Subject/Theme**: Purpose or topic of the music
2. **Atmosphere**: Mood and emotional quality
3. **Style/Genre**: Musical style and genre
4. **Instruments** (optional): Key instruments to feature

**Examples**:

**Simple**:
```
"Upbeat electronic music, energetic and modern"
```

**Standard**:
```
"Corporate presentation background music, professional and clean, 
soft piano and ambient synth"
```

**Detailed**:
```
"Epic cinematic orchestral score, dramatic and heroic, 
soaring strings and powerful brass, 
Hans Zimmer style, for action scene"
```

**By Genre**:

**Electronic/Pop**:
```
"Energetic EDM track, festival atmosphere, heavy bass and synth drops"
```

**Jazz**:
```
"Smooth jazz for evening ambience, sophisticated and relaxed, 
piano trio with double bass"
```

**Orchestral**:
```
"Emotional film score, contemplative and moving, 
piano and string ensemble"
```

**Ambient**:
```
"Peaceful meditation music, calm and spacious, 
soft pads and gentle chimes"
```

### Text-to-Sound-Effect Prompt Formula
```
声音来源 + 动作/环境 + 特征
Sound source + Action/Context + Characteristics
```

**Component Breakdown**:

1. **Sound Source**: What's making the sound
2. **Action/Context**: What's happening / where it is
3. **Characteristics**: Sound qualities (loud, soft, sharp, etc.)

**Examples**:

**Single Events**:
```
"Glass bottle shattering on concrete, sharp and crisp"
```

```
"Car door closing, solid thunk, reverb in garage"
```

```
"Notification bell sound, soft and pleasant"
```

**Continuous Sounds**:
```
"Heavy rain on metal roof, steady and rhythmic"
```

```
"City traffic ambience, cars passing, distant sirens"
```

```
"Forest birds chirping, peaceful morning atmosphere"
```

**By Category**:

**Nature**:
```
"Ocean waves crashing on beach, powerful and continuous"
```

**Mechanical**:
```
"Old typewriter keys typing, mechanical clicks and dings"
```

**Human**:
```
"Crowd cheering and applauding, enthusiastic and loud"
```

**UI/Digital**:
```
"Futuristic UI beep, high-tech and clean"
```

### Text-to-Speech Tips

**Structure**:
- Write naturally as you would speak
- Use punctuation for pacing and pauses
- Spell out numbers and abbreviations

**Examples**:

**With Pacing**:
```
"Welcome to our platform... Let me show you around."
(Ellipsis adds natural pause)
```

**With Emphasis**:
```
"This is extremely important. Pay close attention."
(Period creates strong pause for emphasis)
```

**Numbers**:
```
"Call one, eight hundred, five five five, zero one two three"
(Instead of "Call 1-800-555-0123")
```

### Video Soundtrack Prompt Formula
```
风格/类型 + 情绪 + (节奏/能量)
Style/Genre + Mood + (Optional: pacing/energy)
```

**Why simpler?** The API analyzes video content automatically.

**Examples**:

**Minimal** (let API analyze):
```
(no prompt - fully automatic based on video)
```

**Guided Style**:
```
"Upbeat travel vlog music, adventurous and inspiring"
```

```
"Corporate tech presentation music, modern and professional"
```

```
"Emotional documentary score, contemplative and moving"
```

---

## General Best Practices

### Do's ✅

1. **Be Specific**: Clear descriptions yield better results
   - Good: "Golden retriever puppy playing with red ball"
   - Bad: "Dog playing"

2. **Use Descriptive Adjectives**: Add relevant details
   - Good: "Sleek modern smartphone with edge-to-edge display"
   - Bad: "Phone"

3. **Specify Mood/Atmosphere**: Set the tone
   - Good: "Dramatic sunset with vibrant orange and purple clouds"
   - Bad: "Sunset"

4. **Include Context**: Where, when, why
   - Good: "Professional product photography on white background"
   - Bad: "Product"

5. **Mention Key Visual Elements**:
   - Lighting conditions
   - Color palette
   - Composition style
   - Movement characteristics

### Don'ts ❌

1. **Don't Be Vague**:
   - Bad: "Nice video"
   - Bad: "Good music"
   - Bad: "Cool image"

2. **Don't Contradict**:
   - Bad: "Bright and dark scene"
   - Bad: "Fast and slow motion"
   - Bad: "Happy sad music"

3. **Don't Over-specify Technical Details**:
   - Bad: "1920x1080 resolution 24fps H.264 codec"
   - Bad: "120 BPM in C major with I-V-vi-IV progression"
   - (API handles technical parameters automatically)

4. **Don't Use Negations**:
   - Bad: "Not blurry, not dark, not boring"
   - Good: "Sharp, bright, engaging"

5. **Don't Mix Multiple Unrelated Concepts**:
   - Bad: "Cat playing piano in space while cooking pasta"
   - Better: Split into multiple generations or choose one focus

---

## Advanced Techniques

### Chaining Outputs

Use output from one API as input to another:

```python
# 1. Generate image
img_task = client.image_to_image(
    prompt="Modern office space, clean and minimal",
    image="reference.jpg"
)
img_url = get_result_url(img_task)

# 2. Animate image
video_task = client.image_to_video(
    prompt="Camera slowly panning right, golden hour lighting",
    image=img_url
)
video_url = get_result_url(video_task)

# 3. Add soundtrack
audio_task = client.video_soundtrack(
    video=video_url,
    prompt="Professional corporate music"
)
```

### Iterative Refinement

1. **Start Simple**: Test with minimal prompt
2. **Evaluate Output**: What's missing or wrong?
3. **Add Details**: Incrementally add specificity
4. **Test Again**: Compare results

**Example Iteration**:
```
V1: "Car driving"
→ Too generic

V2: "Red sports car driving fast on highway"
→ Better, but lighting unclear

V3: "Red Ferrari speeding on coastal highway, golden hour sunset, dramatic"
→ Good result!
```

### A/B Testing

Generate multiple variations to compare:

```python
# Test different camera movements
variants = [
    client.image_to_video(image=img, prompt="Slow zoom in", camera_move_index=5),
    client.image_to_video(image=img, prompt="Pan right", camera_move_index=12),
    client.image_to_video(image=img, prompt="Orbit around subject", camera_move_index=23)
]
```

### Consistency Across Assets

For cohesive content, maintain consistent prompt elements:

```python
# Consistent style keywords across multiple generations
style_guide = "cinematic, golden hour lighting, dramatic atmosphere"

video1 = client.text_to_video(f"Mountain landscape, {style_guide}")
video2 = client.text_to_video(f"Forest scene, {style_guide}")
video3 = client.text_to_video(f"Beach sunset, {style_guide}")
```

---

## Prompt Templates by Use Case

### Marketing/Commercial
```
"[Product name] showcased on [surface/background], 
[camera movement], 
studio lighting with soft shadows, 
premium and elegant atmosphere"
```

### Social Media
```
"[Subject] [action], 
[camera angle/movement], 
vibrant colors and high energy, 
engaging and eye-catching for [platform]"
```

### Documentary/Educational
```
"[Subject] in [environment], 
[natural action], 
natural documentary style cinematography, 
informative and authentic atmosphere"
```

### Artistic/Creative
```
"[Abstract concept] visualized as [imagery], 
[unique camera work], 
[lighting style], 
[artistic mood/style reference]"
```

---

## Troubleshooting

### Problem: Output doesn't match prompt
**Solutions**:
- Simplify prompt to core elements
- Remove contradictory instructions
- Be more specific about key aspects
- Check for typos or ambiguous terms

### Problem: Output quality is poor
**Solutions**:
- Add style keywords (cinematic, professional, high quality)
- Specify lighting conditions
- Mention camera quality/style
- Add atmosphere/mood descriptors

### Problem: Inconsistent results
**Solutions**:
- Use more specific prompts
- Reference specific styles or examples
- Test with variations to find optimal wording
- Use consistent style keywords across generations

### Problem: Generation fails (status=4)
**Solutions**:
- Check prompt for inappropriate content
- Simplify overly complex prompts
- Verify input files (images/videos) are valid
- Ensure parameters are within valid ranges
- Try with default parameters first

---

## Language Considerations

Tomoviee supports both **Chinese** and **English** prompts.

**Tips**:
- Use language you're most comfortable with
- Be aware of cultural/contextual nuances
- Technical terms may work better in English
- Artistic descriptions may vary by language interpretation

**Example Comparisons**:

Chinese:
```
"一只金毛寻回犬在阳光明媚的草地上奔跑,镜头跟随,电影级画质"
```

English:
```
"A golden retriever running through a sunlit meadow, camera following, cinematic quality"
```

Both can produce excellent results - choose based on your fluency and precision needs.

---

## Summary Checklist

Before submitting your prompt, verify:

- [ ] **Clear Subject**: What's the main focus?
- [ ] **Specific Action**: What's happening?
- [ ] **Scene Context**: Where is this taking place?
- [ ] **Visual Style**: What's the look and feel?
- [ ] **Technical Parameters**: Resolution, duration, aspect ratio set correctly?
- [ ] **No Contradictions**: All elements work together?
- [ ] **Appropriate Specificity**: Not too vague, not over-specified?

A well-crafted prompt is the foundation of excellent AI-generated content. Take time to refine your prompts for best results!


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (HIGH)