Skip to main content
Moxus AI supports image-related capabilities depending on the selected model:
  1. Vision understanding: read and analyze images.
  2. Image generation: create images from text prompts.
  3. Image editing: modify an existing image.
Check the model catalog before calling a model, because capabilities vary by provider and model version.

Vision understanding

Use a vision-capable chat model and include both text and image content in messages.

Image URL

{
  "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"
          }
        }
      ]
    }
  ]
}

Base64 image data

For local files, encode the image and pass a data: URI:
{
  "model": "gpt-4o",
  "messages": [
    {
      "role": "user",
      "content": [
        {"type": "text", "text": "What is shown in this picture?"},
        {
          "type": "image_url",
          "image_url": {
            "url": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQ..."
          }
        }
      ]
    }
  ]
}

Python example

import base64
from openai import OpenAI

client = OpenAI(api_key="sk-your-key", base_url="https://moxus.ai/v1")

with open("photo.jpg", "rb") as image_file:
    encoded = base64.b64encode(image_file.read()).decode("utf-8")

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "What is in this image?"},
                {
                    "type": "image_url",
                    "image_url": {"url": f"data:image/jpeg;base64,{encoded}"},
                },
            ],
        }
    ],
)

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

Image generation

Use /v1/images/generations with a supported image model:
{
  "model": "gpt-image-1",
  "prompt": "A clean product mockup of a smart desk lamp on a white table, soft studio lighting",
  "n": 1,
  "size": "1024x1024"
}
curl https://moxus.ai/v1/images/generations \
  -H "Authorization: Bearer sk-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-1",
    "prompt": "A clean product mockup of a smart desk lamp on a white table, soft studio lighting",
    "n": 1,
    "size": "1024x1024"
  }'
Responses usually contain either a hosted image URL or Base64 image data, depending on response_format and model support.

Image editing

Use /v1/images/edits when a model supports image-to-image editing. These requests usually use multipart/form-data:
curl https://moxus.ai/v1/images/edits \
  -H "Authorization: Bearer sk-your-key" \
  -F model="gpt-image-1" \
  -F image="@original.png" \
  -F prompt="Replace the background with a clean office desk."
Editing parameters vary by model. Check the model detail page before building the request.

Prompting tips

  • Describe subject, style, composition, lighting, color palette, and background.
  • State important constraints directly.
  • For analysis tasks, ask for the exact format you need.
  • Combine vision with structured output when downstream code needs fields.

Billing notes

  • Vision understanding usually counts image input as tokens.
  • Image generation and editing may be priced per image, by size, or by model-specific units.
  • Review current prices in models and pricing.

Next steps