Skip to main content
Mesh API uses POST /v1/chat/completions for image input, and accepts image generation there too. For reference images, edit operations and streaming, use POST /v1/images/generations and POST /v1/images/edits; see Image Generation. Use this guide for two common workflows:
  • Send image input to a multimodal model
  • Generate images from a text prompt

Find image-capable models

Call GET /v1/models and inspect:
  • input_modalities for image input support
  • output_modalities for image output support

Send image input

You can send images to multimodal models (like GPT-4o or Claude Sonnet 4.5) by passing an array of content parts in the message. Mesh API supports two ways to provide images:
  1. Base64 encoded data: Use data:image/jpeg;base64,... URLs.
  2. Public HTTP URLs: Use standard https://... URLs.
Not all providers accept images by public URL. Requests routed to Google Vertex AI silently drop http(s) image URLs: the request still runs and is billed, but the model never sees the image. AWS Bedrock rejects http(s) image URLs with 422. Use base64 data: URLs for maximum compatibility.
Here is an example request sending an image via URL:
To send a base64 encoded image, replace the url value with the data URL: "url": "data:image/jpeg;base64,iVBORw0KGgo..."

Generate images

Use the same chat completions endpoint with image-generation-capable models.
The exact assistant payload may vary by model. Build against the documented response fields for the model you choose and the media format you request.

Request tips

  • Use detail: "low" for lower-cost image understanding when supported.
  • Use hosted HTTPS URLs or data: URLs for image input.

SDK coverage

  • Node: client.chat.completions.create(...)
  • Python: client.chat.completions.create(...)
  • Go: client.Chat.Completions.Create(...)
  • Java: client.chat().completions().create(...)