Published
Multimodal AI for Business: Working with Documents, Images and Audio
How vision-language and speech models read scanned documents, photos and calls: architecture, pipeline code and ways to keep image and audio costs down.
- Written by
- Ali ÖzdurmuşFounder, Veni AI
- Updated
- Reading time
- 6 min read

Multimodal AI systems understand more than text: scanned invoices, product photos, technical drawings, recorded calls and video. Current frontier chat models from OpenAI, Anthropic and Google accept images as input, and dedicated speech models handle transcription and voice. For companies, this unlocks the large share of information that never lived in a database.
Code samples are illustrative Python.
clientis an initialized SDK client;MODEL,TRANSCRIBE_MODEL,TTS_MODELandVOICEare placeholders for the models you choose.
Multimodal AI Fundamentals
Modality Types
- Text: Natural language, code, structured data
- Vision: Photo, diagram, screenshot
- Audio: Speech, music, environmental sounds
- Video: Combination of moving image + audio
Why Multimodal?
- Human communication is inherently multimodal
- Context information missed with single modality
- Richer meaning extraction
- Suitability for real-world applications
Vision-Language Models
Architectural Approaches
1. Contrastive Learning (CLIP style)
Image Encoder → Image Embedding
Text Encoder → Text Embedding
Contrastive Loss: Match(image, text)2. Generative (vision-language model style)
Image → Vision Encoder → Visual Tokens
Visual Tokens + Text Tokens → LLM → Response3. Cross-Attention Fusion
Image Features ←Cross-Attention→ Text FeaturesVision Encoder Types
| Encoder | Architecture | Resolution | Feature |
|---|---|---|---|
| ViT | Transformer | 224-1024 | Patch-based |
| CLIP ViT | Transformer | 336 | Contrastive |
| SigLIP | Transformer | 384 | Sigmoid loss |
| ConvNeXt | CNN | Flexible | Efficient |
Image Tokenization
Patch Embedding:
224×224 image → 14×14 patch grid → 196 visual tokens
Each patch: 16×16 pixel → Linear projection → EmbeddingVariable Resolution:
Anyres approach:
1. Divide image into tiles
2. Encode each tile separately
3. Add global thumbnail
4. Concatenate all tokensMultimodal LLM Implementation
Image Input (OpenAI-style API)
from openai import OpenAI
import base64
client = OpenAI()
MODEL = "your-model-id"
def encode_image(image_path):
with open(image_path, "rb") as f:
return base64.b64encode(f.read()).decode('utf-8')
response = client.chat.completions.create(
model=MODEL,
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Analyze this image"},
{
"type": "image_url",
"image_url": {
"url": f"data:image/jpeg;base64,{encode_image('image.webp')}",
"detail": "high" # low, high, auto
}
}
]
}
],
max_tokens=1000
)Image Input (Anthropic API)
from anthropic import Anthropic
import base64
client = Anthropic()
with open("image.webp", "rb") as f:
image_data = base64.standard_b64encode(f.read()).decode("utf-8")
message = client.messages.create(
model=MODEL,
max_tokens=1024,
messages=[
{
"role": "user",
"content": [
{
"type": "image",
"source": {
"type": "base64",
"media_type": "image/jpeg",
"data": image_data
}
},
{"type": "text", "text": "What is in this image?"}
]
}
]
)Audio Processing
Speech-to-Text (STT)
Hosted transcription API:
from openai import OpenAI
client = OpenAI()
with open("audio.mp3", "rb") as audio_file:
transcript = client.audio.transcriptions.create(
model=TRANSCRIBE_MODEL,
file=audio_file,
language="tr"
)
print(transcript.text)Current speech-to-text options include GPT-Transcribe, ElevenLabs Scribe v2, Mistral Voxtral Mini Transcribe V2 and the open-weights Qwen3-ASR, which you can run on your own servers when recordings must stay in-house.
Text-to-Speech (TTS)
response = client.audio.speech.create(
model=TTS_MODEL,
voice=VOICE,
input="Hello, I am an AI assistant."
)
response.stream_to_file("output.mp3")Current text-to-speech options include Eleven v4, Gemini 3.8 Flash TTS, Voxtral TTS and the open-weights Qwen3-TTS.
Real-time Audio Pipeline
Microphone → VAD → Chunking → STT → LLM → TTS → Speaker
↓
Voice Activity
DetectionVideo Understanding
Frame Sampling Strategies
1. Uniform Sampling:
def uniform_sample(video_path, num_frames=8):
cap = cv2.VideoCapture(video_path)
total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
indices = np.linspace(0, total_frames-1, num_frames, dtype=int)
frames = []
for idx in indices:
cap.set(cv2.CAP_PROP_POS_FRAMES, idx)
ret, frame = cap.read()
if ret:
frames.append(frame)
return frames2. Keyframe Extraction:
def extract_keyframes(video_path, threshold=30):
# Finding keyframes with Scene change detection
passVideo-LLM Pipeline
Video → Frame Sampling → Per-frame Encoding → Temporal Aggregation → LLM
↓
Audio Extraction → STT → TextModality Fusion
Early Fusion
Combining modalities at model input:
[CLS] [IMG_1] ... [IMG_N] [SEP] [TXT_1] ... [TXT_M] [SEP]Late Fusion
Processing each modality separately and combining results:
Image → Image Model → Image Features ─┐
├→ Fusion Layer → Output
Text → Text Model → Text Features ────┘Cross-Modal Attention
Attention between modalities:
Q = Text Features
K, V = Image Features
Cross_Attention(Q, K, V) = softmax(QK^T/√d)VOCR and Document Understanding
Document AI Pipeline
def process_document(image_path):
# 1. Layout Detection
layout = detect_layout(image) # Headings, paragraphs, tables
# 2. OCR
text_regions = ocr_extract(image)
# 3. Structure Understanding
structured_doc = parse_structure(layout, text_regions)
# 4. LLM Analysis
analysis = llm_analyze(structured_doc)
return analysisTable Extraction
response = client.chat.completions.create(
model=MODEL,
messages=[{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": table_image_url}},
{"type": "text", "text": "Extract this table in JSON format"}
]
}]
)Enterprise Multimodal Applications
1. Document Processing
- Invoice/receipt OCR
- Contract analysis
- Form data extraction
2. Visual Search
- Search from product image
- Similar image finding
- Visual Q&A
3. Content Moderation
- Inappropriate image detection
- Brand logo check
- Text + image consistency
4. Customer Support
- Screenshot analysis
- Visual troubleshooting
- Voice support
Performance Optimization
Image Preprocessing
def optimize_image(image_path, max_size=1024, quality=85):
img = Image.open(image_path)
# Resize
if max(img.size) > max_size:
ratio = max_size / max(img.size)
new_size = tuple(int(d * ratio) for d in img.size)
img = img.resize(new_size, Image.LANCZOS)
# Compress
buffer = io.BytesIO()
img.save(buffer, format="JPEG", quality=quality)
return buffer.getvalue()Batch Processing
async def batch_image_analysis(images, batch_size=5):
results = []
for i in range(0, len(images), batch_size):
batch = images[i:i+batch_size]
tasks = [analyze_image(img) for img in batch]
batch_results = await asyncio.gather(*tasks)
results.extend(batch_results)
return resultsCost Management
Token Calculation (Vision)
Images are converted into tokens before the model reads them. Each provider documents its own formula, and the count grows with resolution and detail level. Measure the token usage of your typical documents (a one-page invoice, a multi-page contract scan) before you estimate volume costs.
Optimization Strategies
- Adjust detail level: Do not use "high" unless necessary
- Reduce image size: Reduces token count
- Caching: Do not re-analyze the same image
- Batch operations: Reduce API call count
Conclusion
Much of a company's knowledge sits in scans, photos, drawings and recordings. Multimodal models make that content searchable and usable, as long as the pipeline is sound: good preprocessing, the right model per modality, validation of extracted data and cost control on image and audio tokens.
Veni AI builds document, image and audio pipelines that feed directly into companies' existing systems. See our services or talk to us about your documents.


