API Reference

Edit Image

Edits an existing image based on a prompt and optional mask. Compatible with the OpenAI Images Edits API (multipart/form-data). Only OpenAI-compatible upstream providers serve this endpoint; Anthropic and Gemini providers are skipped automatically. Streaming (Server-Sent Events) is supported only for `gpt-image-*` models when `stream=true` is set. No image editing models are currently online — check `GET /v1/models` for current availability before relying on this endpoint.

POST
/v1/images/edits

Authorization

ApiKeyAuth
AuthorizationBearer <token>

Your Yolo Router API key. Format: Authorization: Bearer sk-...

In: header

Request Body

multipart/form-data

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://api.yolorouter.com/v1/images/edits" \  -F model="<image-model-id>" \  -F prompt="Replace the sky with a dramatic sunset" \  -F image="string"
{
  "created": 0,
  "data": [
    {
      "url": "string",
      "b64_json": "string",
      "revised_prompt": "string"
    }
  ],
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0,
    "total_tokens": 0,
    "input_tokens_details": {
      "text_tokens": 0,
      "image_tokens": 0
    },
    "output_tokens_details": {
      "text_tokens": 0,
      "image_tokens": 0
    }
  },
  "background": "string",
  "output_format": "string",
  "quality": "string",
  "size": "string"
}
Empty
{
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_api_key",
    "message": "Invalid API key"
  }
}
{
  "error": {
    "type": "insufficient_quota",
    "code": "insufficient_quota",
    "message": "Quota exceeded"
  }
}
Empty
{
  "error": {
    "type": "string",
    "code": "string",
    "message": "string"
  }
}
Empty