Skip to main content

Prompt Writing Techniques

Basic Principles

Be Specific

Describe scenes, actions, lighting and other details in detail

Clear Structure

Organize in the order of “subject → action → environment → style”

Avoid Ambiguity

Use clear vocabulary, avoid vague or ambiguous words

Control Length

Keep between 50-200 characters, not too short or verbose

Excellent Prompt Examples

Recommended:
An orange kitten chasing butterflies on green grass, sunlight filtering through leaves creating dappled shadows, gentle breeze moving the grass blades, blurred forest background, cinematic depth of field effect
Avoid:
Cat playing
Key Points:
  • Described subject (orange kitten)
  • Specific action (chasing butterflies)
  • Environmental details (grass, sunlight, leaves)
  • Visual effects (depth of field, lighting)

Image-to-Video Best Practices

Image Selection Requirements

Image Quality Requirements:
  • Resolution: Recommended 1024x1024 or higher
  • Format: JPEG, PNG, WebP
  • Size: Not exceeding 10MB per image
  • Clarity: Avoid blurry or low-quality images

Single Image Generation

Use a single image as the starting frame to generate video:
response = client.chat.completions.create(
    model="veo-3.1-fl",
    messages=[{
        "role": "user",
        "content": [
            {
                "type": "text",
                "text": "Bring this scene to life, gentle breeze moving leaves, clouds slowly drifting"
            },
            {
                "type": "image_url",
                "image_url": {
                    "url": "https://example.com/scene.jpg"
                }
            }
        ]
    }],
    stream=True
)
Single Image Prompt Tips:
  • Describe desired actions and changes
  • Specify magnitude and speed of movements
  • Indicate which elements should remain static

Two-Image Transition

Use two images to generate smooth transition video:
response = client.chat.completions.create(
    model="veo-3.1-fl",
    messages=[{
        "role": "user",
        "content": [
            {
                "type": "text",
                "text": "Create a smooth transition from the first image to the second, maintaining natural and fluid motion"
            },
            {
                "type": "image_url",
                "image_url": {"url": "https://example.com/start.jpg"}
            },
            {
                "type": "image_url",
                "image_url": {"url": "https://example.com/end.jpg"}
            }
        ]
    }],
    stream=True
)
Two-Image Transition Tips:
  • Choose two images with similar characteristics
  • Specify transition method in prompt (fade, slide, morph, etc.)
  • Keep lighting and color tone consistent between images

Model Selection Strategy

Choose Based on Scenario

Scenarios without image referenceRecommended models:
  • veo-3.1: Standard quality, suitable for most scenarios
  • veo-3.1-fast: Quick testing, reduce costs
Example scenarios:
  • Fully creative content
  • Abstract concept visualization
  • No specific visual reference needed
Scenarios requiring image-based generationRecommended models:
  • veo-3.1-fl: Standard image-to-video (supports 1-2 image inputs)
  • veo-3.1-fast-fl: Fast image-to-video (supports 1-2 image inputs)
Example scenarios:
  • Bring static images to life
  • Smooth transitions between two images
  • Generate animations based on reference images
Important: Only models with fl suffix support image input functionality
Professional landscape format requirementsRecommended models:
  • veo-3.1-landscape: Landscape text-to-video
  • veo-3.1-landscape-fast: Fast landscape
  • veo-3.1-landscape-fl: Landscape image-to-video
  • veo-3.1-landscape-fast-fl: Fast landscape image-to-video
Example scenarios:
  • Film production preview
  • Commercial advertisements
  • Widescreen content

Cost Optimization Strategy

Goal: Quickly validate ideas, reduce costsStrategy:
model = "veo-3.1-fast"  # Use fast series
n = 1  # Single generation
Applicable:
  • Prompt testing
  • Concept validation
  • Rapid iteration

Common Scenario Optimization

Action Description

Clear Verbs

Use specific verbs: “run”, “jump”, “rotate”Avoid: “move”, “change” and other vague words

Speed Control

Specify speed: “fast”, “slow”, “constant speed”Example: “Bird rapidly flapping wings”

Direction Indication

Clear direction: “leftward”, “upward”, “clockwise”Example: “Camera panning from left to right”

Magnitude Description

Specify magnitude: “slight”, “intense”, “large amplitude”Example: “Leaves swaying gently”

Lighting Effects

Excellent example:
"At dusk, golden sunlight slanting from the right, casting long shadows on the ground, light penetrating through mist creating Tyndall effect"

Key points:
✓ Time (dusk)
✓ Light source direction (slanting from the right)
✓ Lighting effects (long shadows, Tyndall effect)
✓ Environmental factors (mist)

Camera Movement

Camera fixed, subject in center of frame, background slightly out of focus

Batch Generation Strategy

Using n Parameter

Generate multiple variants for selection:
response = client.chat.completions.create(
    model="veo-3.1-fast",
    messages=[{
        "role": "user",
        "content": [{"type": "text", "text": "Sunset beach scene"}]
    }],
    n=4,  # Generate 4 different results simultaneously
    stream=True
)
n parameter recommendations:
  • Testing phase: n=1-2
  • Important projects: n=2-4
  • Cost-sensitive: n=1

Concurrent Requests

import asyncio
from openai import AsyncOpenAI

client = AsyncOpenAI(
    api_key="sk-YOUR_API_KEY",
    base_url="https://api.laozhang.ai/v1"
)

async def generate_video(prompt, model="veo-3.1-fast"):
    response = await client.chat.completions.create(
        model=model,
        messages=[{
            "role": "user",
            "content": [{"type": "text", "text": prompt}]
        }],
        stream=True
    )

    async for chunk in response:
        if chunk.choices[0].delta.content:
            print(f"{prompt[:20]}: {chunk.choices[0].delta.content}")

# Generate multiple videos concurrently
prompts = [
    "Sunset beach",
    "City night scene",
    "Forest morning light",
    "Rainy street"
]

await asyncio.gather(*[generate_video(p) for p in prompts])

Quality Improvement Tips

Increase Detail Levels

1

Basic Description

First describe core subject and actionExample: “A cat walking”
2

Add Environment

Include scene and background informationExample: “A cat walking on grass, forest background”
3

Enrich Details

Add lighting, color, textureExample: “An orange cat elegantly walking on green grass, sunlight filtering through leaves creating dappled shadows, blurred forest background”
4

Artistic Style

Specify visual style and effectsExample: “An orange cat elegantly walking on green grass, sunlight filtering through leaves creating dappled shadows, blurred forest background, cinematic color grading, shallow depth of field effect”

Style Reference

Common style keywords:

Visual effects:
- Cinematic, documentary style, MV quality
- Slow motion, time-lapse, super slow-mo
- HD, 4K quality, film grain

Color tone:
- Warm tones, cool tones, vintage color
- High contrast, low saturation, Morandi palette
- Cyberpunk, vaporwave, oil painting style

Lighting:
- Rembrandt lighting, side light, backlight
- Soft light, hard light, neon lighting
- Golden hour, blue hour, magic hour

Common Mistakes to Avoid

Common errors:❌ Prompt too brief
"cat"
❌ Contains contradictory information
"a cat flying underwater"
❌ Overly complex
"An orange Persian cat wearing elaborate Victorian clothing chasing a talking mechanical butterfly on 19th century London streets while aurora and rainbow appear in the sky..."
❌ Using vague vocabulary
"nice scene"

Performance Optimization

Streaming Processing Best Practices

import sys

response = client.chat.completions.create(
    model="veo-3.1",
    messages=[...],
    stream=True
)

# Real-time output, no buffering
for chunk in response:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end='', flush=True)
        sys.stdout.flush()

Timeout Handling

from openai import OpenAI
import httpx

client = OpenAI(
    api_key="sk-YOUR_API_KEY",
    base_url="https://api.laozhang.ai/v1",
    http_client=httpx.Client(
        timeout=httpx.Timeout(
            connect=10.0,  # Connection timeout
            read=300.0,    # Read timeout (5 minutes)
            write=10.0,    # Write timeout
            pool=10.0      # Pool timeout
        )
    )
)

Next Steps