For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
DocsAPI ReferenceSDKs
DocsAPI ReferenceSDKs
  • Introduction
    • Product Overview
    • Pricing
    • Model Explanation
    • Available Models
  • Guides
    • Quickstart
    • Authentication
    • BYOK
    • Dashboard Guide
    • Prompt Templates
    • Embeddings
    • RAG (Files & Search)
    • Audio
    • Images & Vision
    • Image Generation
    • Compare
    • Batch API
    • Auto Routing
    • Realtime Audio
  • SDKs
    • Node.js (TypeScript)
    • Python
    • Go
  • Infrastructure
    • Architecture
LogoLogo
On this page
  • Find image-capable models
  • Send image input
  • Generate images
  • Request tips
  • SDK coverage
Guides

Images & Vision

||View as Markdown|
Was this page helpful?
Edit this page
Previous

Audio

Next

Image Generation

Built with

Mesh API uses POST /v1/chat/completions for image input and 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 3.5 Sonnet) 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.

[!WARNING] Not all models support passing images via public URL. Some models (especially from certain providers) require images to be base64 encoded. Check the provider documentation or use base64 encoding to ensure maximum compatibility.

Here is an example request sending an image via URL:

$curl https://api.meshapi.ai/v1/chat/completions \
> -H "Authorization: Bearer <YOUR_RSK_KEY>" \
> -H "Content-Type: application/json" \
> -d '{
> "model": "openai/gpt-4o",
> "messages": [
> {
> "role": "user",
> "content": [
> {
> "type": "text",
> "text": "What is in this image?"
> },
> {
> "type": "image_url",
> "image_url": {
> "url": "https://example.com/image.jpg",
> "detail": "auto"
> }
> }
> ]
> }
> ]
> }'

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.

$curl https://api.meshapi.ai/v1/chat/completions \
> -H "Authorization: Bearer <YOUR_RSK_KEY>" \
> -H "Content-Type: application/json" \
> -d '{
> "model": "openai/gpt-image-1",
> "image": {
> "size": "1024x1024",
> "quality": "high",
> "response_format": "url"
> },
> "messages": [
> {
> "role": "user",
> "content": "Generate a watercolor of a fox in a snowy forest."
> }
> ]
> }'

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(...)