Vision

Image input (vision)

Send images alongside text prompts using the image_url content block. Supported on gpt-4o, azure-swc/gpt-4.1, and claude-opus-4-8.

Python

import meridian

client = meridian.Client(api_key="mrdn_...")

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Describe this image in detail."
                },
                {
                    "type": "image_url",
                    "image_url": {
                        "url": "https://example.com/photo.jpg",
                        "detail": "high"
                    }
                }
            ]
        }
    ]
)

print(response.choices[0].message.content)

TypeScript

import Meridian from "meridian";

const client = new Meridian({ apiKey: "mrdn_..." });

const response = await client.chat.completions.create({
  model: "gpt-4o",
  messages: [
    {
      role: "user",
      content: [
        {
          type: "text",
          text: "Describe this image in detail.",
        },
        {
          type: "image_url",
          image_url: {
            url: "https://example.com/photo.jpg",
            detail: "high",
          },
        },
      ],
    },
  ],
});

console.log(response.choices[0].message.content);

Supported models

  • gpt-4o — OpenAI vision, base64 or URL
  • azure-swc/gpt-4.1 — Azure deployment, identical schema
  • claude-opus-4-8 — Anthropic vision, detail field ignored

Use detail: "low" for faster responses with reduced token cost. Omit the field to default to "auto".