This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Veotools is a Python SDK and MCP server for generating and extending videos with Google Veo. It provides:
- Video generation from text, image seed, or continuation from existing video
- Veo 3.1 helpers for reference images, interpolation, and video extension
- Seamless video stitching with overlap trimming
- MCP (Model Context Protocol) server integration for AI assistants
- Progress tracking and caching support
# Install in development mode with all dependencies
pip install -e ".[dev,mcp]"
# Install production only
pip install -e .# Run all tests
pytest
# Run specific test categories
pytest -m unit # Fast unit tests only
pytest -m integration # Integration tests
pytest -m "not slow" # Skip slow tests
# Coverage
pytest --cov=veotools --cov-report=html
# Using Make commands
make test # Run all tests
make test-unit # Run unit tests only
make test-coverage # Generate coverage report
make test-parallel # Run tests in parallel# Build distributions for PyPI
python -m build
# Clean build artifacts
make clean
# Check version consistency before release
python scripts/check_version.py# Main CLI entry point
veo --help
# MCP server (when installed with [mcp])
veo-mcpVeoClient (src/veotools/core.py): Singleton client managing Google GenAI API connection. Initialized with GEMINI_API_KEY from environment.
StorageManager (src/veotools/core.py): Manages output directories with resolution order:
VEO_OUTPUT_DIRenvironment variable./outputin current working directory- Package-adjacent directory as fallback
VideoResult (src/veotools/models.py): Web-ready result objects with metadata, JSON serialization, and progress tracking. All generation functions return these objects.
Bridge (src/veotools/api/bridge.py): Workflow orchestration for chaining operations (add_media → generate → stitch → save).
src/veotools/
├── core.py - Core client and storage management
├── models.py - Data models and result objects
├── cli.py - Command-line interface
├── api/
│ ├── bridge.py - Workflow orchestration API
│ └── mcp_api.py - MCP-friendly wrapper functions
├── generate/
│ └── video.py - Video generation from text/image/video
├── process/
│ └── extractor.py - Frame extraction and video metadata
├── stitch/
│ └── seamless.py - Video stitching with transitions
└── server/
└── mcp_server.py - MCP server implementation
- Progress Tracking: All long-running operations accept
on_progresscallbacks - Async Job Management: Non-blocking generation via
generate_start/get/cancel - Model Configuration: Dynamic model discovery with local registry + remote listing
- Safety Settings: Pass-through support for Google's safety configuration
- Context Caching: Helper functions for creating and managing cached content
GEMINI_API_KEY: Required for Google GenAI API accessVEO_OUTPUT_DIR: Optional override for output directory location
Person generation varies by Veo model and mode:
- Veo 3.1: text/extension allows
allow_all; image/interpolation/reference allowsallow_adult - Veo 3.0: text→video allows
allow_all; image/video-seeded allowsallow_adult - Veo 2.0: text→video allows
allow_all,allow_adult,dont_allow; image/video-seeded allowsallow_adult,dont_allow
Test Organization
- Tests mirror source structure in
tests/directory - Shared fixtures in
tests/conftest.py - Mock all external dependencies (API calls, ffmpeg)
- Use pytest markers:
@pytest.mark.unit,@pytest.mark.integration,@pytest.mark.slow
Test Patterns
- Follow AAA pattern (Arrange-Act-Assert)
- Name tests descriptively:
test_<what_is_being_tested> - Group related tests in classes:
TestClassName - Use parametrized tests for multiple scenarios
- Mock Google GenAI client to avoid real API calls
Key Fixtures (in conftest.py)
mock_api_key- Auto-sets test API keymock_veo_client- Mocked VeoClienttemp_output_dir- Temporary directory for test outputsmock_video_file- Fake video file for testingmock_genai_response- Mocked API responses
Core dependencies managed in pyproject.toml:
google-genai>=1.56.0- Google's generative AI clientopencv-python>=4.8.0- Video processingpython-dotenv>=1.0.0- Environment configurationmcp[cli]>=1.25.0(optional) - MCP server support
Development dependencies:
pytest>=7.4.0- Testing frameworkpytest-asyncio>=0.21.0- Async test supportpytest-cov>=4.1.0- Coverage reportingpytest-mock>=3.11.0- Mocking utilitiespytest-xdist>=3.3.0- Parallel test execution