Skip to main content
Vision-language models (VLMs) process both text and images in a single request, enabling image captioning, visual question answering, document analysis, chart interpretation, OCR, and content moderation. Use VLMs via serverless inference or dedicated deployments. Browse available vision models →

Chat Completions API

Provide images via URL or base64 encoding. The request structure is identical to OpenAI’s vision API.
You can also use the OpenAI SDK with Fireworks by changing the base URL and API key.

Using base64-encoded images

For local files, encode them as base64 with the appropriate MIME type prefix:

Working with images

Vision-language models support prompt caching to improve performance for requests with repeated content. Both text and image portions can benefit from caching to reduce time to first token by up to 80%. Tips for optimal performance:
  • Use URLs for long conversations – Reduces latency compared to base64 encoding
  • Downsize images – Smaller images use fewer tokens and process faster
  • Structure prompts for caching – Place static instructions at the beginning, variable content at the end
  • Include metadata in prompts – Add context about the image directly in your text prompt

Images that require authentication

Fireworks downloads image URLs on your behalf, so anything in the URL, including credentials in its query string, travels with the request. If an image isn’t public:
  • Use a short-lived signed URL. Generate a pre-signed URL (S3, GCS, Azure Blob, OSS) that grants read-only access to that one object and expires within minutes.
  • Never put long-lived credentials in an image URL, such as API keys, session tokens or permanent access keys.
  • Send private images as base64 when you’d rather not share a URL at all. Base64 images must total less than 10MB per request, so downsize large images first. See Using base64-encoded images and Known limitations.

Working with PDFs and Word documents

VLMs do not natively accept PDF or Word (.docx) files as input. Convert them on your side before sending the request:
  • PDF: render each page to an image and pass the images to the model using base64 encoding.
  • DOCX: extract the text, and pass any embedded images alongside it.
Remember the 120-image limit per request. The count includes images in earlier messages of the conversation that you resend with each request. For long documents, process pages in batches or select only the relevant pages.
Install pypdfium2, Pillow, and python-docx:

Advanced capabilities

Vision training

Train VLMs for specialized visual tasks

LoRA adapters

Deploy custom LoRA adapters for vision models

Dedicated deployments

Deploy VLMs on dedicated GPUs for better performance

Video & audio inputs

Process video and audio content with multimodal models

Alternative query methods

For the Completions API, manually insert the image token <image> in your prompt and supply images as an ordered list:

Known limitations

  1. Maximum images per request: 120 images maximum, including images in earlier messages of the conversation, regardless of format (base64 or URL)
  2. Base64 size limit: Total base64-encoded images must be less than 10MB
  3. URL size and timeout: Each image URL must be smaller than 5MB and download within 1.5 seconds
  4. Supported formats: .png, .jpg, .jpeg, .gif, .bmp, .tiff, .ppm
  5. Llama 3.2 Vision models: Pass images before text in the content field to avoid refusals (temporary limitation)