Skip to main content
YouRouter supports multimodal model calls in addition to plain text chat. Use this page when your integration needs images, visual understanding, provider-native multimodal formats, or video generation tasks.

Which API Should I Use?

For most chat and vision integrations, start with https://api.yourouter.ai/v1 and the OpenAI-compatible Chat Completions format.

Image Input with Chat Completions

Use messages[].content as an array of content blocks. Include one text block and one or more image_url blocks.
Read the generated answer from:

Base64 Image Input

For private images, send a data URL.
Keep payload size reasonable. For large images, use a temporary HTTPS URL when possible.

Python Example

PDF / Document Input

PDF support depends on the target model and upstream provider. Before sending a request, confirm that the model you selected supports document or vision understanding. Models that do not support PDFs will return an upstream error. For models that support OpenAI-compatible file content blocks, add a file block to messages[].content. The file_data value is the base64-encoded raw PDF bytes; do not include a data:application/pdf;base64, prefix.
If your use case depends on a specific upstream provider’s document features, use the provider-native format:
PDFs usually consume more context window and request body size. In production, limit file size and page count. Split large files, or use an upload-based flow only after confirming that the target upstream file API is available for your integration.

Gemini Native Multimodal

Use Google’s generateContent format when your integration depends on Gemini-native request fields.
See Google Generate Content for the reference page.

Claude Native Messages

Use Anthropic’s Messages format when you need Claude-native request behavior.
See Anthropic Messages for the reference page.

Video Generation Tasks

Video generation is task-based: create a task, then poll until the task is finished.
The create call returns a task id. Query that task until it is complete:
See Ark Text-to-Video for the full task flow.

Integration Tips

  • Keep model IDs configurable so you can switch vision and multimodal models without code changes.
  • Use vendor only when you need a provider-specific format or behavior.
  • Prefer HTTPS URLs or split processing for large files; use base64 for private/local test images and small PDFs.
  • PDF support changes by model and upstream capability. Run a real-file test with the target model before shipping.
  • Preserve request IDs from responses when troubleshooting provider-specific multimodal issues.