---
title: "OpenAI-compatible image generation and edit"
method: POST
path: "/api/v1/images/generations"
---

# OpenAI-compatible image generation and edit

`POST /api/v1/images/generations`

## Request

- Base URL: `https://genmagic.co`
- URL: `https://genmagic.co/api/v1/images/generations`
- Auth: HTTP bearer

Generate an image from a prompt, or transform a reference image (image-to-image) by passing image. Set type=logo to steer as a brand mark. On-brand automatically when personalization is on.

## Request body

- object
  - `prompt` string, required: Description of the image (or the edit to make when image is given).
  - `model` string: Model id. Omit for the recommended default.
  - `size` '1024x1024' | '1792x1024' | '1024x1792': Output size.
  - `image` string: Reference image to transform: an https URL or a data:image URL.
  - `type` 'image' | 'logo': logo steers a brand mark; image is a picture.
  - `response_format` 'url' | 'b64_json': Return a hosted url (default) or base64.
  - `n` integer: Number of images (1-4).

## Response `200`

Success.

## Other responses

- `401`: authentication_error: missing or invalid API key.
- `402`: insufficient_quota: credit balance would go negative.
- `429`: rate_limit_error: over 300 requests/minute for this key.

---

[API](https://skmtc.dev/genmagic/apis/genmagic-api.md) · [All operations](https://skmtc.dev/genmagic/apis/genmagic-api/llms.txt) · [OpenAPI document](https://skmtc.dev/genmagic/apis/genmagic-api/revisions/c75319e568f6?raw)
