Edits one or more source images according to a text prompt using an OpenAI-compatible request. Unlike the OpenAI edits endpoint, JoyToken accepts a JSON body (not multipart/form-data): prompt and image are required, where image is either a single string or an array of strings. Each image may be an http(s) URL or a base64 data URI (data:<mime>;base64,<data>). When a URL is provided, JoyToken downloads it and converts it to a data URI before forwarding to the selected provider. JoyToken forwards supported image options and appends routing and billing details under metadata. This endpoint is non-streaming: do not send stream: true. JoyToken returns one application/json response after editing completes and never emits SSE events or [DONE].
Output format: by default JoyToken returns each edited image as a base64 payload in `data[].b64_json`. To render it, prefix it as a data URI, e.g. `img.src = "data:image/png;base64," + resp.data[0].b64_json`. If you prefer a hosted image URL instead of base64, send `response_format: url`; JoyToken then returns `data[].url` when every eligible image model supports URL output, and otherwise falls back to `b64_json`. There is no built-in base64-to-URL conversion: if you must have a URL, either request `response_format: url` (subject to model support) or upload the returned base64 to your own object storage and use that URL.
请求
This endpoint expects an object.
promptstring必需>=1 character
Text instruction describing how to edit the source image(s).
imagestring or list of strings必需
Source image(s) to edit. A single string edits one image; an array of strings edits multiple images. Each value is either an http(s) URL or a base64 data URI (data:<mime>;base64,<data>). Empty string, empty array, and null are treated as missing and return 400.
modelenum可选
Must be auto. Concrete image model IDs are not accepted.
ninteger可选>=1
Number of images to generate. Provider limits vary.
sizestring可选
Provider-supported output dimensions, for example 1024x1024.
userstring可选
Optional end-user identifier.
response_formatenum可选
Output mode. Defaults to b64_json (base64 in data[].b64_json). Set url to receive a hosted image URL in data[].url instead; this only works when every eligible image model supports URL output, otherwise JoyToken falls back to b64_json. Omit unless you specifically need URL output.
响应
Successful non-streaming image edit result returned as one application/json document.
createdlong可选
Unix timestamp for the generation result.
metadataobject可选
JoyToken routing and billing metadata appended by the gateway when available. In orchestration (multi-task planning) mode this object also carries per-task identifiers, and the response returns one metadata object per task.