Skip to main content
Chat completions accept rich content blocks: text, images, audio, files. You can pass them inline (URL or base64) or by reference to a Files API file_id.

When to inline vs. upload

Inline content blocks

messages[i].content can be an array of typed blocks:

Image (URL or base64)

detail (optional): "low" (faster, cheaper, ~85 tokens) or "high" (default for most models).

Audio (inline base64 only)

format: wav, mp3, pcm16, webm. The model must support audio input — check supportsAudioInput on GET /v1/models.

File — inline

File — by file_id

The gateway resolves the id to bytes server-side, injects them into the provider call, and returns 400 if the id doesn’t exist or belongs to another workspace.

PDFs

Models with supportsPdf: true (Anthropic Claude, Google Gemini, OpenAI gpt-4o) read PDFs natively. For others, the gateway transparently converts each page to an image and prepends the extracted text — you don’t change a thing, you just see a small pdf_processing line item on the next invoice.

Vision

Models with supportsVision: true accept arbitrary images. URL fetches happen on the gateway with a 10-second timeout — if your URL is slow or behind auth, prefer base64 or upload.

Quick recipes

Multi-image diff

python

Reusable contract

python
The same file_id is referenced from many calls; you upload once.

Limits

  • Per-call inline payload: 20 MB (sum of all base64 blocks)
  • Per-file upload: plan-based (see Plans)
  • Image dimensions: rescaled by the provider — no need to pre-resize
  • PDF pages: practical cap ~100 (model context window limits dominate)
See Files API for upload, list, delete, download, and quotas.