Skip to content

Provider Support

The SDK covers five providers for multimodal input. Each provider has its own wire format; LLMClient abstracts that away — the developer just passes Image / PDF and the SDK rewrites for the active provider.

Capability matrix

Provider Image PDF text PDF vision (rendered) PDF native Tool returns image
OpenAI gpt-4o / 4.1 / 5 Yes Yes Yes Yes Yes (auto-split)
OpenAI gpt-6 Yes Yes Yes — Yes (auto-split)
Azure gpt-4o Yes Yes Yes Yes Yes (auto-split)
Anthropic 3.5+, 4.x, 5.x Yes Yes Yes Yes Yes (block)
Bedrock (Claude) Yes Yes Yes Yes Yes (block)
Ollama (vision) Yes Yes Yes — Yes (auto-split)
Gemini Yes — — Yes Yes (inline)

OpenAI/Azure native PDF covers the vision models that accept a file content part — gpt-4o, gpt-4.1, gpt-5, and the o-series. Older image-only models (gpt-4-turbo, gpt-4-vision) fall back to vision.

Gemini reads images and PDFs natively via inlineData (base64) — the model extracts a PDF's embedded text for free, so there is no local rendering and pdf_mode does not apply. Very large PDFs would need the Gemini File API (not yet wired). Bedrock-hosted Claude uses a native Converse document block. Mistral has no inline-PDF chat path (use document_url/OCR upstream), so it renders pages like other vision models.

Vision-capable model registry

The SDK keeps a small prefix-based registry of vision-capable models:

from fastaiagent.multimodal import is_vision_capable, supports_native_pdf

is_vision_capable("openai", "gpt-4o-mini")              # True
is_vision_capable("openai", "gpt-3.5-turbo")             # False
is_vision_capable("anthropic", "claude-sonnet-4-6")      # True
supports_native_pdf("anthropic", "claude-sonnet-4-6")    # True
supports_native_pdf("openai", "gpt-4o")                  # True

Sending an Image (or a PDF in vision mode) to a non-vision model raises NonVisionModelError before any HTTP request — the SDK fails early with a clear message rather than letting the provider 4xx.

Fixed in 1.91.0

The registry predated the current lineups, so it refused images for every Claude 5.x model (claude-opus-5-5, claude-sonnet-5-5, claude-haiku-5-5, claude-fable-5-1, …) and every GPT-6 model (gpt-6-astra, gpt-6.1-sol, gpt-6-luna) — NonVisionModelError before any request — and sent a PDF to Claude 5.x as extracted text. Claude 5.x now takes images and native PDFs (Anthropic's Models API reports both for every model); GPT-6 takes images, and its PDFs are rendered as page images (its model pages list text and image input only). Bedrock's cross-region ids (us.anthropic.claude-…, eu.…, global.…) are recognised too. The same answers are on LLMClient(...).model_info.supports_vision / .supports_pdf.

Auto-detection rules (pdf_mode="auto")

  1. If the model supports native PDF (Anthropic Sonnet/Opus 3.5+, Bedrock-hosted Claude 3.5+, or OpenAI/Azure gpt-4o/4.1/5 + o-series) → forward the raw PDF (a document block for Anthropic, a file part for OpenAI/Azure). No local rendering, so max_pdf_pages does not apply.
  2. Else if the model is vision-capable → render pages locally and emit per-page image blocks.
  3. Else → extract text locally and emit a single text block.

You can always override with pdf_mode="text" | "vision" | "native" on the LLMClient (which wins) or process-wide via fa.config.pdf_mode / FASTAIAGENT_PDF_MODE. Custom OpenAI-compatible endpoints are not auto-detected as native (their capabilities vary); pass pdf_mode="native" explicitly to opt in.

OpenAI quirk: tool messages can't carry images

OpenAI rejects image_url blocks inside role="tool" messages. When a tool returns Image or PDF and the active provider is OpenAI/Azure/ Custom, the SDK transparently splits the tool result into:

  • tool message with the textual summary
  • a follow-up user message carrying the multimodal payload

Anthropic, Bedrock, and Ollama accept images directly inside tool-result blocks, so no split happens there.