Image Edits
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.
身份验证
Use Authorization: Bearer $JOY_TOKEN_API_KEY.
请求头
请求
Text instruction describing how to edit the source image(s).
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.
Use auto to let the gateway pick the image model, or pass a concrete modelName from the model catalog to pin that model. Both ways are available to every account.
Provider-supported output dimensions, for example 1024x1024.
Optional end-user identifier.
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.
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.
