PhotoGPT Developers

Upload, list, inspect, and delete model images.

Images

Images can be uploaded for model training or reference-image workflows. The same upload endpoint handles both, but the type value changes how the image is used.

TypeUse for
modelInputTraining images attached to a trained model.
auxiliaryTypeReference images used by generation prompts and workflows.

Limits

PropertyValue
Supported image typesmodelInput, auxiliaryType
Supported formatsjpg, jpeg, webp, png, heic
Maximum request size20MB
Maximum images20 images of each type per model

Upload an image

Upload requests use multipart/form-data with:

PartValue
fileBinary image file.
dataJSON string with modelID and type.
const modelId = '<MODEL_ID>'
const file = document.querySelector('input[type="file"]').files?.[0]

if (!file) {
  throw new Error('Select an image file before uploading.')
}

const payload = {
  modelID: modelId,
  type: 'modelInput',
}

const formData = new FormData()
formData.append('file', file)
formData.append('data', JSON.stringify(payload))

const response = await fetch(`${BASE_URL}/images/upload`, {
  method: 'POST',
  headers,
  body: formData,
})

if (!response.ok) {
  throw new Error(await response.text())
}

const body = await response.json()
const image = body.result
import json

model_id = "<MODEL_ID>"

payload = {
    "modelID": model_id,
    "type": "modelInput",
}

with open("example/image.jpg", "rb") as image_file:
    files = {
        "file": image_file,
        "data": (None, json.dumps(payload), "application/json"),
    }
    response = requests.post(f"{BASE_URL}/images/upload", headers=headers, files=files)

response.raise_for_status()
image = response.json()["result"]

The response includes the uploaded image id, url, modelID, and type.

List model images

Use GET /models/{modelID}/images to list images for a model. The imageType filter supports all, input, output, and auxiliaryType.

const modelId = '<MODEL_ID>'
const params = new URLSearchParams({
  imageType: 'all',
  pageNum: '1',
  pageSize: '20',
})

const response = await fetch(`${BASE_URL}/models/${modelId}/images?${params}`, {
  headers,
})

if (!response.ok) {
  throw new Error(await response.text())
}

const body = await response.json()
const images = body.result
model_id = "<MODEL_ID>"

response = requests.get(
    f"{BASE_URL}/models/{model_id}/images",
    headers=headers,
    params={"imageType": "all", "pageNum": 1, "pageSize": 20},
)
response.raise_for_status()

images = response.json()["result"]

Get image metadata

const imageId = '<IMAGE_ID>'

const response = await fetch(`${BASE_URL}/images/${imageId}`, {
  headers,
})

if (!response.ok) {
  throw new Error(await response.text())
}

const body = await response.json()
const image = body.result
image_id = "<IMAGE_ID>"

response = requests.get(f"{BASE_URL}/images/{image_id}", headers=headers)
response.raise_for_status()

image = response.json()["result"]

Delete an image

const imageId = '<IMAGE_ID>'

const response = await fetch(`${BASE_URL}/images/${imageId}`, {
  method: 'DELETE',
  headers,
})

if (!response.ok) {
  throw new Error(await response.text())
}
image_id = "<IMAGE_ID>"

response = requests.delete(f"{BASE_URL}/images/{image_id}", headers=headers)
response.raise_for_status()

API reference

On this page