Skip to main content
Moxus AI supports image understanding, image generation, and image editing. Input formats, sizes, output counts, and response formats vary by model. This page uses gpt-5.4 for image understanding and grok-imagine-image for image generation.

Image understanding

Send a public image URL or read a local file and pass it as Base64 data.

Image generation

Generate an image from a prompt and save the returned Base64 data locally.

Image editing

Edit an existing image when the selected model supports it.

Prompting tips

Describe the subject, style, composition, and constraints.
If you are still tuning a prompt, choose an image generation model in the web Conversation page and generate a test image there first. After the model and prompt are confirmed, use the API examples on this page from external code.

Image understanding

Image understanding uses the OpenAI-compatible chat/completions endpoint. You can pass a public image URL or encode a local image as Base64 and send it as a data: URI. The examples use gpt-5.4.

Use a local image

Local-image examples read the file, convert it to Base64, then send it in the request. In the Python example, IMAGE_PATH = "photo.jpg" means that the image is in the same project folder as the Python file and its name must match exactly, including extension and letter case. Use a full local path when the image is elsewhere. The Node.js example uses const IMAGE_PATH = "photo.png"; put the image in the same project folder as the .mjs file and run the command from that folder. Change both IMAGE_PATH and IMAGE_MIME_TYPE when the filename or format differs.
For Python and Node.js dependency installation, running examples, and environment troubleshooting, see FAQ.

Image generation

Image generation uses the OpenAI-compatible /v1/images/generations endpoint. The examples use grok-imagine-image. Support for size, output count, and response format varies by model, so confirm the model name and pricing in Model Square before integrating.

Image editing

Use image editing to modify an existing image, such as replacing a background, changing a local area, or adjusting the overall style. The endpoint, file upload format, and parameters depend on the selected model. Confirm that the model supports image editing in Model Square before calling it.

Prompting tips

  • Describe the subject, style, composition, lighting, color palette, and background.
  • State the intended use and constraints, such as aspect ratio or elements to keep or avoid.
  • Combine image understanding with structured output when downstream code needs stable fields.

Billing notes

  • Image understanding usually counts image input as tokens. Larger or more detailed images consume more tokens.
  • Image generation and editing may be billed per image, by size, or by model-specific units.
See models and pricing for current prices.

Notes

  • Use only models marked as supporting the required capability in Model Square.
  • Large images can consume more tokens or be rejected; compress them when necessary.
  • Image URLs must be publicly accessible.

Next steps