API Reference

Image Generation and Editing

Generate or edit images with OpenAI-compatible image APIs.

Image APIs support generation and editing. Exact sizes, quality values, formats and streaming support depend on the model and upstream channel.

Endpoints

MethodPathDescription
POST/v1/images/generationsGenerate images
POST/v1/images/editsEdit images, with JSON or multipart form input
POST/v1/editsCompatibility path. Prefer /v1/images/edits

Request Fields

FieldTypeRequiredDescription
modelstringYesImage model ID
promptstringRequired for generationImage prompt
nintegerNoNumber of images, default 1
sizestringNoImage size such as 1024x1024. Do not use the multiplication sign ×
qualitystringNoQuality such as standard, hd or auto
response_formatstringNoResponse format such as url or b64_json, depending on model
styleanyNoOpenAI image extension field
background, moderationanyNoNewer image model extension fields
output_format, output_compressionanyNoOutput format and compression options
partial_images, streamanyNoUsed by image models that support streaming
image, imagesfile/string/arrayRequired for editsImages to edit. Multipart accepts image, image[] or image[n]
maskfile/stringNoEdit mask
input_fidelityanyNoInput fidelity, depending on model
watermarkbooleanNoWatermark switch, depending on channel support

Generate an Image

curl https://api.tensoraxis.ai/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TENSORAXIS_API_KEY" \
  -d '{
    "model": "gpt-image-1",
    "prompt": "A minimalist poster of a futuristic city",
    "size": "1024x1024"
  }'

Edit an Image

Use multipart form data when uploading local files:

curl https://api.tensoraxis.ai/v1/images/edits \
  -H "Authorization: Bearer $TENSORAXIS_API_KEY" \
  -F model="gpt-image-1" \
  -F prompt="Change the background to a night city" \
  -F image="@input.png"

When the selected model supports it, JSON image URLs can also be used:

{
  "model": "gpt-image-1",
  "prompt": "Change the background to a night city",
  "image": "https://example.com/input.png"
}

Response Shape

{
  "created": 1710000000,
  "data": [
    {
      "url": "https://example.com/result.png",
      "b64_json": "",
      "revised_prompt": "..."
    }
  ]
}

Video generation is not an image API. For Seedance / Doubao video models, use the async task body in Video Generation.