Multimodal LLM Patterns
Integrate vision, audio, and video generation capabilities from leading multimodal models. Covers image analysis, document understanding, real-time voice agents, speech-to-text, text-to-speech, and AI video generation (Kling 3.0, Sora 2, Veo 3.1, Runway Gen-4.5).
Quick Reference
| Category |
Rules |
Impact |
When to Use |
| Vision: Image Analysis |
1 |
HIGH |
Image captioning, VQA, multi-image comparison, object detection |
| Vision: Document Understanding |
1 |
HIGH |
OCR, chart/diagram analysis, PDF processing, table extraction |
| Vision: Model Selection |
1 |
MEDIUM |
Choosing provider, cost optimization, image size limits |
| Audio: Speech-to-Text |
1 |
HIGH |
Transcription, speaker diarization, long-form audio |
| Audio: Text-to-Speech |
1 |
MEDIUM |
Voice synthesis, expressive TTS, multi-speaker dialogue |
| Audio: Model Selection |
1 |
MEDIUM |
Real-time voice agents, provider comparison, pricing |
| Video: Model Selection |
1 |
HIGH |
Choosing video gen provider (Kling, Sora, Veo, Runway) |
| Video: API Patterns |
1 |
HIGH |
Async task polling, SDK integration, webhook callbacks |
| Video: Multi-Shot |
1 |
HIGH |
Storyboarding, character elements, scene consistency |
Total: 9 rules across 3 categories (Vision, Audio, Video Generation)
Vision: Image Analysis
Send images to multimodal LLMs for captioning, visual QA, and object detection. Always set max_tokens and resize images before encoding.
| Rule |
File |
Key Pattern |
| Image Analysis |
rules/vision-image-analysis.md |
Base64 encoding, multi-image, bounding boxes |
Vision: Document Understanding
Extract structured data from documents, charts, and PDFs using vision models.
| Rule |
File |
Key Pattern |
| Document Vision |
rules/vision-document.md |
PDF page ranges, detail levels, OCR strategies |
Vision: Model Selection
Choose the right vision provider based on accuracy, cost, and context window needs.
| Rule |
File |
Key Pattern |
| Vision Models |
rules/vision-models.md |
Provider comparison, token costs, image limits |
Audio: Speech-to-Text
Convert audio to text with speaker diarization, timestamps, and sentiment analysis.
| Rule |
File |
Key Pattern |
| Speech-to-Text |
rules/audio-speech-to-text.md |
Gemini long-form, GPT-4o-Transcribe, AssemblyAI features |
Audio: Text-to-Speech
Generate natural speech from text with voice selection and expressive cues.
| Rule |
File |
Key Pattern |
| Text-to-Speech |
rules/audio-text-to-speech.md |
Gemini TTS, voice config, auditory cues |
Audio: Model Selection
Select the right audio/voice provider for real-time, transcription, or TTS use cases.
| Rule |
File |
Key Pattern |
| Audio Models |
rules/audio-models.md |
Real-time voice comparison, STT benchmarks, pricing |
Video: Model Selection
Choose the right video generation provider based on use case, duration, and budget.
| Rule |
File |
Key Pattern |
| Video Models |
rules/video-generation-models.md |
Kling vs Sora vs Veo vs Runway, pricing, capabilities |
Video: API Patterns
Integrate video generation APIs with proper async polling, SDKs, and webhook callbacks.
| Rule |
File |
Key Pattern |
| API Integration |
rules/video-generation-patterns.md |
Kling REST, fal.ai SDK, Vercel AI SDK, task polling |
Video: Multi-Shot
Generate multi-scene videos with consistent characters using storyboarding and character elements.
| Rule |
File |
Key Pattern |
| Multi-Shot |
rules/video-multi-shot.md |
Kling 3.0 character elements, 6-shot storyboards, identity binding |
Key Decisions
| Decision |
Recommendation |
| High accuracy vision |
Claude Opus 4.6 or GPT-5 |
| Long documents |
Gemini 2.5 Pro (1M context) |
| Cost-efficient vision |
Gemini 2.5 Flash ($0.15/M tokens) |
| Video analysis |
Gemini 2.5/3 Pro (native video) |
| Voice assistant |
Grok Voice Agent (fastest, <1s) |
| Emotional voice AI |
Gemini Live API |
| Long audio transcription |
Gemini 2.5 Pro (9.5hr) |
| Speaker diarization |
AssemblyAI or Gemini |
| Self-hosted STT |
Whisper Large V3 |
| Character-consistent video |
Kling 3.0 (Character Elements 3.0) |
| Narrative video / storytelling |
Sora 2 (best cause-and-effect coherence) |
| Cinematic B-roll |
Veo 3.1 (camera control + polished motion) |
| Professional VFX |
Runway Gen-4.5 (Act-Two motion transfer) |
| High-volume social video |
Kling 3.0 Standard ($0.20/video) |
| Open-source video gen |
Wan 2.6 or LTX-2 |
| Lip-sync / avatar video |
Kling 3.0 (native lip-sync API) |
Example
import anthropic, base64
client = anthropic.Anthropic()
with open("image.png", "rb") as f:
b64 = base64.standard_b64encode(f.read()).decode("utf-8")
response = client.messages.create(
model="claude-opus-4-6",
max_tokens=1024,
messages=[{"role": "user", "content": [
{"type": "image", "source": {"type": "base64", "media_type": "image/png", "data": b64}},
{"type": "text", "text": "Describe this image"}
]}]
)
Common Mistakes
- Not setting
max_tokens on vision requests (responses truncated)
- Sending oversized images without resizing (>2048px)
- Using
high detail level for simple yes/no classification
- Using STT+LLM+TTS pipeline instead of native speech-to-speech
- Not leveraging barge-in support for natural voice conversations
- Using deprecated models (GPT-4V, Whisper-1)
- Ignoring rate limits on vision and audio endpoints
- Calling video generation APIs synchronously (they're async — poll or use callbacks)
- Generating separate clips without character elements (characters look different each time)
- Using Sora for high-volume social content (expensive, slow — use Kling Standard instead)
Related Skills
ork:rag-retrieval - Multimodal RAG with image + text retrieval
ork:llm-integration - General LLM function calling patterns
streaming-api-patterns - WebSocket patterns for real-time audio
ork:demo-producer - Terminal demo videos (VHS, asciinema) — not AI video gen
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: multimodal-llm3description: Vision, audio, video generation, and multimodal LLM integration patterns. Use when processing images, transcribing audio, generating speech, generating AI video (Kling, Sora, Veo, Runway), or building multimodal AI pipelines. Use when this capability is needed.4---56# Multimodal LLM Patterns78Integrate vision, audio, and video generation capabilities from leading multimodal models. Covers image analysis, document understanding, real-time voice agents, speech-to-text, text-to-speech, and AI video generation (Kling 3.0, Sora 2, Veo 3.1, Runway Gen-4.5).910## Quick Reference1112| Category | Rules | Impact | When to Use |13|----------|-------|--------|-------------|14| [Vision: Image Analysis](#vision-image-analysis) | 1 | HIGH | Image captioning, VQA, multi-image comparison, object detection |15| [Vision: Document Understanding](#vision-document-understanding) | 1 | HIGH | OCR, chart/diagram analysis, PDF processing, table extraction |16| [Vision: Model Selection](#vision-model-selection) | 1 | MEDIUM | Choosing provider, cost optimization, image size limits |17| [Audio: Speech-to-Text](#audio-speech-to-text) | 1 | HIGH | Transcription, speaker diarization, long-form audio |18| [Audio: Text-to-Speech](#audio-text-to-speech) | 1 | MEDIUM | Voice synthesis, expressive TTS, multi-speaker dialogue |19| [Audio: Model Selection](#audio-model-selection) | 1 | MEDIUM | Real-time voice agents, provider comparison, pricing |20| [Video: Model Selection](#video-model-selection) | 1 | HIGH | Choosing video gen provider (Kling, Sora, Veo, Runway) |21| [Video: API Patterns](#video-api-patterns) | 1 | HIGH | Async task polling, SDK integration, webhook callbacks |22| [Video: Multi-Shot](#video-multi-shot) | 1 | HIGH | Storyboarding, character elements, scene consistency |2324**Total: 9 rules across 3 categories (Vision, Audio, Video Generation)**2526## Vision: Image Analysis2728Send images to multimodal LLMs for captioning, visual QA, and object detection. Always set `max_tokens` and resize images before encoding.2930| Rule | File | Key Pattern |31|------|------|-------------|32| Image Analysis | `rules/vision-image-analysis.md` | Base64 encoding, multi-image, bounding boxes |3334## Vision: Document Understanding3536Extract structured data from documents, charts, and PDFs using vision models.3738| Rule | File | Key Pattern |39|------|------|-------------|40| Document Vision | `rules/vision-document.md` | PDF page ranges, detail levels, OCR strategies |4142## Vision: Model Selection4344Choose the right vision provider based on accuracy, cost, and context window needs.4546| Rule | File | Key Pattern |47|------|------|-------------|48| Vision Models | `rules/vision-models.md` | Provider comparison, token costs, image limits |4950## Audio: Speech-to-Text5152Convert audio to text with speaker diarization, timestamps, and sentiment analysis.5354| Rule | File | Key Pattern |55|------|------|-------------|56| Speech-to-Text | `rules/audio-speech-to-text.md` | Gemini long-form, GPT-4o-Transcribe, AssemblyAI features |5758## Audio: Text-to-Speech5960Generate natural speech from text with voice selection and expressive cues.6162| Rule | File | Key Pattern |63|------|------|-------------|64| Text-to-Speech | `rules/audio-text-to-speech.md` | Gemini TTS, voice config, auditory cues |6566## Audio: Model Selection6768Select the right audio/voice provider for real-time, transcription, or TTS use cases.6970| Rule | File | Key Pattern |71|------|------|-------------|72| Audio Models | `rules/audio-models.md` | Real-time voice comparison, STT benchmarks, pricing |7374## Video: Model Selection7576Choose the right video generation provider based on use case, duration, and budget.7778| Rule | File | Key Pattern |79|------|------|-------------|80| Video Models | `rules/video-generation-models.md` | Kling vs Sora vs Veo vs Runway, pricing, capabilities |8182## Video: API Patterns8384Integrate video generation APIs with proper async polling, SDKs, and webhook callbacks.8586| Rule | File | Key Pattern |87|------|------|-------------|88| API Integration | `rules/video-generation-patterns.md` | Kling REST, fal.ai SDK, Vercel AI SDK, task polling |8990## Video: Multi-Shot9192Generate multi-scene videos with consistent characters using storyboarding and character elements.9394| Rule | File | Key Pattern |95|------|------|-------------|96| Multi-Shot | `rules/video-multi-shot.md` | Kling 3.0 character elements, 6-shot storyboards, identity binding |9798## Key Decisions99100| Decision | Recommendation |101|----------|----------------|102| High accuracy vision | Claude Opus 4.6 or GPT-5 |103| Long documents | Gemini 2.5 Pro (1M context) |104| Cost-efficient vision | Gemini 2.5 Flash ($0.15/M tokens) |105| Video analysis | Gemini 2.5/3 Pro (native video) |106| Voice assistant | Grok Voice Agent (fastest, <1s) |107| Emotional voice AI | Gemini Live API |108| Long audio transcription | Gemini 2.5 Pro (9.5hr) |109| Speaker diarization | AssemblyAI or Gemini |110| Self-hosted STT | Whisper Large V3 |111| Character-consistent video | Kling 3.0 (Character Elements 3.0) |112| Narrative video / storytelling | Sora 2 (best cause-and-effect coherence) |113| Cinematic B-roll | Veo 3.1 (camera control + polished motion) |114| Professional VFX | Runway Gen-4.5 (Act-Two motion transfer) |115| High-volume social video | Kling 3.0 Standard ($0.20/video) |116| Open-source video gen | Wan 2.6 or LTX-2 |117| Lip-sync / avatar video | Kling 3.0 (native lip-sync API) |118119## Example120121```python122import anthropic, base64123124client = anthropic.Anthropic()125with open("image.png", "rb") as f:126 b64 = base64.standard_b64encode(f.read()).decode("utf-8")127128response = client.messages.create(129 model="claude-opus-4-6",130 max_tokens=1024,131 messages=[{"role": "user", "content": [132 {"type": "image", "source": {"type": "base64", "media_type": "image/png", "data": b64}},133 {"type": "text", "text": "Describe this image"}134 ]}]135)136```137138## Common Mistakes1391401. Not setting `max_tokens` on vision requests (responses truncated)1412. Sending oversized images without resizing (>2048px)1423. Using `high` detail level for simple yes/no classification1434. Using STT+LLM+TTS pipeline instead of native speech-to-speech1445. Not leveraging barge-in support for natural voice conversations1456. Using deprecated models (GPT-4V, Whisper-1)1467. Ignoring rate limits on vision and audio endpoints1478. Calling video generation APIs synchronously (they're async — poll or use callbacks)1489. Generating separate clips without character elements (characters look different each time)14910. Using Sora for high-volume social content (expensive, slow — use Kling Standard instead)150151## Related Skills152153- `ork:rag-retrieval` - Multimodal RAG with image + text retrieval154- `ork:llm-integration` - General LLM function calling patterns155- `streaming-api-patterns` - WebSocket patterns for real-time audio156- `ork:demo-producer` - Terminal demo videos (VHS, asciinema) — not AI video gen157158---159> Converted and distributed by [TomeVault](https://tomevault.io/claim/yonatangross) — claim your Tome and manage your conversions.160<!-- tomevault:4.0:skill_md:2026-04-11 -->