API Guide
JoyToken exposes OpenAI-compatible and Anthropic-compatible model endpoints for developers.
Common API
Use JOY_TOKEN_API_BASE_URL from Environments.
Model descriptions are localized with the optional locale query parameter. Use locale=en for English or locale=zh for Chinese. When omitted, JoyToken defaults to English.
Choose a Protocol
OpenAI
Anthropic
Responses is available at POST /openai/v1/responses. Send input as a string or message input items; non-streaming text is returned in output[0].content[0].text.
Image generation is available at POST /openai/v1/images/generations. model must be auto and prompt is required. Image options such as n, size, quality, style, and response_format are forwarded to the selected provider; omit provider-specific options unless every eligible image model supports them.
Image generation is non-streaming. Do not send stream: true or consume this endpoint as SSE: keep the request open until JoyToken returns one complete application/json response. Generated images are returned in data; use data[0].url or data[0].b64_json according to response_format.
Do not send both Authorization and X-API-Key on the same request. If both are present, the current gateway reads X-API-Key first.
Video Generation & Video Editing
The video endpoints use an asynchronous three-stage task model for Doubao-Seedance-2.5 (omit model to use auto and let the gateway route within the video model pool):
The generation endpoint supports three modes: text-to-video (prompt only, required), image-to-video (input_reference as a single image or array, prompt optional), and first-and-last-frame (first_frame / last_frame, prompt optional). The generation endpoint does not accept input_video; use the editing endpoint for multi-video stitching. Editing requests must include at least one media input (input_reference / first_frame / last_frame / input_video).
Task creation returns {task_id, status, progress, model, created}. Key parameters:
duration: video length in seconds, continuous range of 2~30, default 8, out-of-range values are clamped to the nearest bound; stitch longer videos through the editing endpointsize:480p/720p/1080porWIDTHxHEIGHT(e.g.1280x720); aspect ratios support 16:9 and 9:16, useparameters.aspect_ratiofor othersinput_reference/first_frame/last_frame: public image URLs, up to 30 images per request (combined), otherwise 400parameters: native upstream parameter passthrough (snake_case preferred, camelCase accepted), such asaspect_ratio/resolution/duration_seconds/generate_audio/seed;fps,sample_count, and 4K resolutions are not supported
Once completed, the response includes result_url (time-limited, download promptly or use /content), duration, and completed_at.
