CoreViz
API

Image Editing & Generation

POST /api/ai/edit and /api/ai/generate — edit or generate images with AI

Image Editing & Generation

SDK equivalent: sdk.edit() + sdk.generate() — see Vision SDK


Edit Image

Edit an existing image using a natural language prompt.

Endpoint

POST /api/ai/edit

Request

curl -X POST https://lab.coreviz.io/api/ai/edit \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "image": "https://example.com/photo.jpg",
    "prompt": "Make it look like a vintage film photograph",
    "aspectRatio": "1:1"
  }'

Request Body

FieldTypeRequiredDescription
imagestringYesImage URL or base64 data URI
promptstringYesEdit instruction
aspectRatiostringNo"match_input_image", "1:1", "16:9", "9:16", "4:3", "3:4"
outputFormatstringNo"jpg" or "png"
modelstringNoModel override (default: "flux-kontext-max")

Response

{ "url": "https://..." }

Generate Image

Generate a new image from a text description.

Endpoint

POST /api/ai/generate

Request

curl -X POST https://lab.coreviz.io/api/ai/generate \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "prompt": "A product photo of running shoes on a white background",
    "aspectRatio": "1:1"
  }'

Request Body

FieldTypeRequiredDescription
promptstringYesText description of the image to generate
referenceImagesstring[]NoReference image URLs for style/structure guidance
aspectRatiostringNoTarget aspect ratio
modelstringNoModel override

Response

{ "url": "https://..." }