Quick start
- Sign up
- Top up CNY
- Create a key. The secret is shown once.
- Set the Base URL to the address below
Base URL
https://api.yuanxingspace.com/v1
Example
curl https://api.yuanxingspace.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-v4.1-flash","messages":[{"role":"user","content":"hello"}]}'Error codes
Codes stay in English. Callers depend only on the code.
Chat and async jobs use only these codes. The message follows the language. The code is not translated.
insufficient_quotaInsufficient balanceinvalid_api_keyInvalid API keyinvalid_requestInvalid requestmodel_not_foundModel not foundrate_limitedToo many requestsupstream_unavailableUpstream unavailable
Chat
Generate a text reply.
POST https://api.yuanxingspace.com/v1/chat/completions
The body needs model and messages. Each message role is system, user, or assistant. stream, temperature, and max_tokens are optional.
When stream is true, the response is text/event-stream in the OpenAI chat.completion.chunk shape.
curl https://api.yuanxingspace.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-v4.1-flash","messages":[{"role":"user","content":"hello"}]}'Async jobs
Images, video, and audio run as async jobs: submit, keep the job id, read the status, then download the result from result_url.
Models and billing
| model | Type | Billing |
|---|---|---|
seedream-5.5seedream-5.0-pro | Image | Per image. Output up to 2.61 MP (for example 1K or 1600x1600) is one tier; larger (for example the default 2K) is another. Each reference image is extra (the first one is free on 5.0 Pro). One image per job. |
seedance-2.0seedance-2.5 | Video | Per video token, as reported by the upstream. Tiers by resolution (480p and 720p, 1080p, 4K) and by whether there is a reference video. |
Video tokens are about width × height × fps × seconds ÷ 1024. At 16:9 and 24 fps, per second: 480p 9,700, 720p 21,600, 1080p 48,600, 4K 194,400.
See the home page for the price of each tier.
Examples
POST https://api.yuanxingspace.com/v1/jobs
The body needs model and modality. modality is image, video, audio, or 3d. input is the modality payload and is not written to the usage stream.
input is the upstream request body, with the field names of the Volcano Engine docs; leave model out of input. Pass reference images, video, and audio as URLs. The body is at most 1 MiB.
Image (Seedream)
curl https://api.yuanxingspace.com/v1/jobs \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"seedream-5.5","modality":"image","input":{"prompt":"一只在雪地里奔跑的柴犬","size":"2K","watermark":false}}'Video (Seedance); duration is required
curl https://api.yuanxingspace.com/v1/jobs \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"seedance-2.0","modality":"video","input":{"content":[{"type":"text","text":"柴犬在雪地里奔跑,镜头跟随"}],"duration":5,"resolution":"720p","ratio":"16:9"}}'An accepted job returns 202 and an id.
GET https://api.yuanxingspace.com/v1/jobs
GET https://api.yuanxingspace.com/v1/jobs/{id}
GET /v1/jobs lists jobs for the current caller. GET /v1/jobs/{id} reads one job. Both are read-only and do not freeze or charge.
status is queued, running, succeeded, failed, or cancelled.
curl https://api.yuanxingspace.com/v1/jobs \
-H "Authorization: Bearer YOUR_API_KEY"curl https://api.yuanxingspace.com/v1/jobs/job_1 \
-H "Authorization: Bearer YOUR_API_KEY"Freeze and charge
Submitting freezes the most the job can cost: the larger image tier plus reference images; for video, duration × the token cap per second at that resolution (15 seconds per reference video, 30 seconds for duration -1); 120 seconds for audio. A succeeded job is charged for what it used and the rest of the freeze comes back at once. Without enough balance to freeze, the answer is 402 insufficient_quota.
Failed, moderated, and timed-out jobs are not charged; the whole freeze comes back and the error code is upstream_unavailable.
Unsupported parameters
These return 400 invalid_request at submit, with nothing frozen: more than one image per job (n other than 1, sequential_image_generation, layer_decomposition) and stream; video without duration, duration outside 1–30 seconds (-1 lets the model choose), resolution other than 480p, 720p, 1080p, or 4k, and draft, return_last_frame, callback_url, frames, service_tier, tools; audio over 3,000 characters and enable_subtitle.
Results and notifications
A succeeded job has result_url, a signed download link valid for 15 minutes; read the job again for a fresh one. Result files are kept for 7 days and then deleted, so download them in time.
Add webhook_url when you submit: when the job ends we POST it one JSON body with the job id, status, and result link. Confirm with GET /v1/jobs/{id} when it arrives.
Signed in on the website, the Jobs page lists your latest 50 jobs with previews and downloads.