# Create an avatar from text URL: https://docs.shixux.com/en/api/generation/avatar-from-text/ Create speech and an avatar video from text in one asynchronous job. This endpoint accepts API Keys only. POST /v1/avatar/from-text {"requestBody":{"content":{"application/json":{"schema":{"description":"One call: text -> (service indextts-2) -> the avatar video service.","properties":{"image_ref_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Ref Key","description":"可选的人物图像资源引用。"},"prompt":{"default":"","maxLength":2000,"description":"可选的视频提示词,最多 2000 个字符。","title":"Prompt","type":"string"},"resolution":{"enum":["480p","720p"],"title":"Resolution","type":"string"},"text":{"maxLength":5000,"minLength":1,"description":"要合成的台词,1–5000 个字符。","title":"Text","type":"string"},"voice_ref_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Ref Key","description":"可选的声音参考资源引用。"},"webhook_endpoint_id":{"anyOf":[{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},{"type":"null"}],"description":"Registered webhook endpoint to notify when the job succeeds or fails.","title":"Webhook Endpoint Id"}},"required":["text"],"title":"AvatarFromTextRequest","type":"object"}}},"required":true},"parameters":[{"in":"header","name":"Idempotency-Key","schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}}],"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}},"description":"Successful Response"},"409":{"description":"Idempotency-Key was already used for a different request","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Selected voice reference has expired","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}},"429":{"description":"Concurrent job limit (MAX_CONCURRENT_JOBS) or request rate limit (RATE_LIMITED) reached.","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"content":{"application/json":{"schema":{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"}}},"description":"Feature Temporarily Unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} text Text to synthesize. It must not be all whitespace. In speech synthesis, indextts-2 accepts up to 2048 characters, and indextts-2.5 accepts up to 2000 characters that include a letter or digit. Audio composition scripts are limited to 5000 characters in total. voice_ref_key Voice reference value, mutually exclusive with voice_preset_id and voice_asset_id. For voice references registered through the upload endpoints, use voice_asset_id. webhook_endpoint_id ID of the webhook endpoint notified when the job ends. It must belong to your account and be enabled. image_ref_key Completed portrait reference owned by the current user. resolution Video resolution. minmax-h3-flash and minmax-h3-pro accept 768p or 2k (2k output is automatically enhanced). For other models, use the resolutions returned by GET /v1/video/config. ```curl curl -X POST 'https://shixux.com/api/v1/avatar/from-text' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"text":"example"}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/avatar/from-text", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "your-unique-business-action-id" }, body: JSON.stringify({ "text": "example" }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/avatar/from-text", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json","Idempotency-Key":"your-unique-business-action-id"}, data="{\"text\":\"example\"}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/avatar/from-text", strings.NewReader("{\"text\":\"example\"}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", "your-unique-business-action-id") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 文本直达数字人视频 URL: https://docs.shixux.com/zh/api/generation/avatar-from-text/ 在同一异步任务中根据文本生成语音和数字人视频。接口仅支持 API Key。 POST /v1/avatar/from-text {"requestBody":{"content":{"application/json":{"schema":{"description":"One call: text -> (service indextts-2) -> the avatar video service.","properties":{"image_ref_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Ref Key","description":"可选的人物图像资源引用。"},"prompt":{"default":"","maxLength":2000,"description":"可选的视频提示词,最多 2000 个字符。","title":"Prompt","type":"string"},"resolution":{"enum":["480p","720p"],"title":"Resolution","type":"string"},"text":{"maxLength":5000,"minLength":1,"description":"要合成的台词,1–5000 个字符。","title":"Text","type":"string"},"voice_ref_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Ref Key","description":"可选的声音参考资源引用。"},"webhook_endpoint_id":{"anyOf":[{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},{"type":"null"}],"description":"Registered webhook endpoint to notify when the job succeeds or fails.","title":"Webhook Endpoint Id"}},"required":["text"],"title":"AvatarFromTextRequest","type":"object"}}},"required":true},"parameters":[{"in":"header","name":"Idempotency-Key","schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}}],"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}},"description":"Successful Response"},"409":{"description":"Idempotency-Key was already used for a different request","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Selected voice reference has expired","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}},"429":{"description":"Concurrent job limit (MAX_CONCURRENT_JOBS) or request rate limit (RATE_LIMITED) reached.","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"content":{"application/json":{"schema":{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"}}},"description":"Feature Temporarily Unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} text 要合成的文本,不能全为空白。语音合成中,indextts-2 最多 2048 个字符,indextts-2.5 最多 2000 个字符且须包含文字或数字;音频编排的台词合计最多 5000 个字符。 voice_ref_key 声音参考的引用值,与 voice_preset_id、voice_asset_id 互斥。通过上传接口登记的声音参考请使用 voice_asset_id。 webhook_endpoint_id 任务结束时接收通知的 Webhook 端点 ID,须属于当前账号且已启用。 image_ref_key 属于当前用户且已确认上传的人物图像引用。 resolution 视频清晰度。minmax-h3-flash 和 minmax-h3-pro 支持 768p 和 2k(2k 输出会自动增强画质);其他模型的可用清晰度以 GET /v1/video/config 的返回为准。 ```curl curl -X POST 'https://shixux.com/api/v1/avatar/from-text' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"text":"example"}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/avatar/from-text", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "your-unique-business-action-id" }, body: JSON.stringify({ "text": "example" }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/avatar/from-text", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json","Idempotency-Key":"your-unique-business-action-id"}, data="{\"text\":\"example\"}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/avatar/from-text", strings.NewReader("{\"text\":\"example\"}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", "your-unique-business-action-id") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Create an audio-driven avatar URL: https://docs.shixux.com/en/api/generation/avatar/ Create an asynchronous avatar video from a confirmed driving audio and optional portrait. This endpoint accepts API Keys only. POST /v1/avatar {"requestBody":{"content":{"application/json":{"schema":{"properties":{"audio_ref_key":{"description":"Driving audio asset references","title":"Audio Ref Key","type":"string"},"image_ref_key":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Reference portrait image asset references","title":"Image Ref Key"},"prompt":{"default":"","maxLength":2000,"description":"可选的视频提示词,最多 2000 个字符。","title":"Prompt","type":"string"},"resolution":{"enum":["480p","720p"],"title":"Resolution","type":"string"},"webhook_endpoint_id":{"anyOf":[{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},{"type":"null"}],"description":"Registered webhook endpoint to notify when the job succeeds or fails.","title":"Webhook Endpoint Id"}},"required":["audio_ref_key"],"title":"AvatarRequest","type":"object"}}},"required":true},"parameters":[{"in":"header","name":"Idempotency-Key","schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}}],"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}},"description":"Successful Response"},"409":{"description":"Idempotency-Key was already used for a different request","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}},"429":{"description":"Concurrent job limit (MAX_CONCURRENT_JOBS) or request rate limit (RATE_LIMITED) reached.","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"content":{"application/json":{"schema":{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"}}},"description":"Feature Temporarily Unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} webhook_endpoint_id ID of the webhook endpoint notified when the job ends. It must belong to your account and be enabled. audio_ref_key Completed driver-audio reference owned by the current user. image_ref_key Completed portrait reference owned by the current user. resolution Video resolution. minmax-h3-flash and minmax-h3-pro accept 768p or 2k (2k output is automatically enhanced). For other models, use the resolutions returned by GET /v1/video/config. ```curl curl -X POST 'https://shixux.com/api/v1/avatar' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"audio_ref_key":"example"}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/avatar", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "your-unique-business-action-id" }, body: JSON.stringify({ "audio_ref_key": "example" }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/avatar", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json","Idempotency-Key":"your-unique-business-action-id"}, data="{\"audio_ref_key\":\"example\"}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/avatar", strings.NewReader("{\"audio_ref_key\":\"example\"}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", "your-unique-business-action-id") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 音频驱动数字人 URL: https://docs.shixux.com/zh/api/generation/avatar/ 使用当前用户已确认上传的驱动音频和可选人物图像,异步生成数字人视频。接口仅支持 API Key。 POST /v1/avatar {"requestBody":{"content":{"application/json":{"schema":{"properties":{"audio_ref_key":{"description":"Driving audio asset references","title":"Audio Ref Key","type":"string"},"image_ref_key":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Reference portrait image asset references","title":"Image Ref Key"},"prompt":{"default":"","maxLength":2000,"description":"可选的视频提示词,最多 2000 个字符。","title":"Prompt","type":"string"},"resolution":{"enum":["480p","720p"],"title":"Resolution","type":"string"},"webhook_endpoint_id":{"anyOf":[{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},{"type":"null"}],"description":"Registered webhook endpoint to notify when the job succeeds or fails.","title":"Webhook Endpoint Id"}},"required":["audio_ref_key"],"title":"AvatarRequest","type":"object"}}},"required":true},"parameters":[{"in":"header","name":"Idempotency-Key","schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}}],"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}},"description":"Successful Response"},"409":{"description":"Idempotency-Key was already used for a different request","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}},"429":{"description":"Concurrent job limit (MAX_CONCURRENT_JOBS) or request rate limit (RATE_LIMITED) reached.","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"content":{"application/json":{"schema":{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"}}},"description":"Feature Temporarily Unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} webhook_endpoint_id 任务结束时接收通知的 Webhook 端点 ID,须属于当前账号且已启用。 audio_ref_key 属于当前用户且已确认上传的驱动音频引用。 image_ref_key 属于当前用户且已确认上传的人物图像引用。 resolution 视频清晰度。minmax-h3-flash 和 minmax-h3-pro 支持 768p 和 2k(2k 输出会自动增强画质);其他模型的可用清晰度以 GET /v1/video/config 的返回为准。 ```curl curl -X POST 'https://shixux.com/api/v1/avatar' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"audio_ref_key":"example"}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/avatar", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "your-unique-business-action-id" }, body: JSON.stringify({ "audio_ref_key": "example" }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/avatar", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json","Idempotency-Key":"your-unique-business-action-id"}, data="{\"audio_ref_key\":\"example\"}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/avatar", strings.NewReader("{\"audio_ref_key\":\"example\"}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", "your-unique-business-action-id") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Get video upscaling availability URL: https://docs.shixux.com/en/api/generation/video-upscale-config/ Read enabled 1080p, 2K and 4K tiers, per-second credit rates and live readiness. Disabled or unavailable services do not accept new work. GET /v1/video/upscale/config {"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["available","presets","reason"],"properties":{"available":{"type":"boolean"},"reason":{"type":"string"},"presets":{"type":"array","items":{"type":"object","required":["id","credits_per_second"],"properties":{"id":{"type":"string","enum":["1080p","2k","4k"]},"credits_per_second":{"type":"number"}}}}}}}}},"503":{"content":{"application/json":{"schema":{"properties":{"detail":{"title":"Detail","type":"string"}},"required":["detail"],"title":"ErrorDetail","type":"object"}}},"description":"Feature Configuration Unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X GET 'https://shixux.com/api/v1/video/upscale/config' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/video/upscale/config", { method: "GET", headers: {}, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/video/upscale/config", method="GET", headers={}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/video/upscale/config", nil) if err != nil { panic(err) } resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 查询视频超分能力 URL: https://docs.shixux.com/zh/api/generation/video-upscale-config/ 读取已启用的 1080p、2K、4K 档位、每秒费率及服务就绪状态。未启用或服务不可用时不创建任务。 GET /v1/video/upscale/config {"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["available","presets","reason"],"properties":{"available":{"type":"boolean"},"reason":{"type":"string"},"presets":{"type":"array","items":{"type":"object","required":["id","credits_per_second"],"properties":{"id":{"type":"string","enum":["1080p","2k","4k"]},"credits_per_second":{"type":"number"}}}}}}}}},"503":{"content":{"application/json":{"schema":{"properties":{"detail":{"title":"Detail","type":"string"}},"required":["detail"],"title":"ErrorDetail","type":"object"}}},"description":"Feature Configuration Unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X GET 'https://shixux.com/api/v1/video/upscale/config' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/video/upscale/config", { method: "GET", headers: {}, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/video/upscale/config", method="GET", headers={}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/video/upscale/config", nil) if err != nil { panic(err) } resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Upscale a video URL: https://docs.shixux.com/en/api/generation/video-upscale/ Create an independent upscale job from an owned generated video or uploaded MP4, freezing the source version. Supply a stable Idempotency-Key; use the same key to recover a missing submission receipt. The reservation is returned after 30 minutes without progress. Reserve credits for measured duration, settle after media validation, and return the reservation on failure. Use the existing job status and result endpoints; the original remains available. Inputs are at most 256 MiB and 30 seconds, with at least 5 frames and 1–60 fps. Cancellation is unavailable. POST /v1/video/upscale {"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["preset"],"properties":{"source_job_id":{"type":"string"},"source_asset_id":{"type":"string"},"preset":{"type":"string","enum":["1080p","2k","4k"]}},"description":"Exactly one owned generated job or uploaded MP4 source; immutable source and tier are bound to Idempotency-Key."}}}},"parameters":[{"in":"header","name":"Idempotency-Key","schema":{"type":"string","minLength":1,"maxLength":128},"required":true}],"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}},"description":"Successful Response"},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"Idempotency-Key was already used for a different request (IDEMPOTENCY_CONFLICT).","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Reference asset expired; upload the reference again.","content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"},{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}]}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}},"429":{"description":"Concurrent job limit (MAX_CONCURRENT_JOBS) or request rate limit (RATE_LIMITED) reached.","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"},{"properties":{"code":{"title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"}},"required":["code","detail"],"title":"ServiceUnavailableResponse","type":"object"}]}}},"description":"Feature disabled or service temporarily unavailable; try again later","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X POST 'https://shixux.com/api/v1/video/upscale' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"preset":"1080p"}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/video/upscale", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "your-unique-business-action-id" }, body: JSON.stringify({ "preset": "1080p" }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/video/upscale", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json","Idempotency-Key":"your-unique-business-action-id"}, data="{\"preset\":\"1080p\"}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/video/upscale", strings.NewReader("{\"preset\":\"1080p\"}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", "your-unique-business-action-id") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 创建视频超分任务 URL: https://docs.shixux.com/zh/api/generation/video-upscale/ 从本人已生成的视频或已上传 MP4 发起独立超分,固定源版本。必须提供稳定的 Idempotency-Key;用同一幂等键恢复提交回执。连续 30 分钟无进展后退回预扣。按实测时长预扣,校验成片后结算,失败退回。结果沿用任务查询与下载接口;原片保留。输入最大 256 MiB、30 秒,至少 5 帧,支持 1–60 fps。当前不支持撤销。 POST /v1/video/upscale {"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["preset"],"properties":{"source_job_id":{"type":"string"},"source_asset_id":{"type":"string"},"preset":{"type":"string","enum":["1080p","2k","4k"]}},"description":"Exactly one owned generated job or uploaded MP4 source; immutable source and tier are bound to Idempotency-Key."}}}},"parameters":[{"in":"header","name":"Idempotency-Key","schema":{"type":"string","minLength":1,"maxLength":128},"required":true}],"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}},"description":"Successful Response"},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"Idempotency-Key was already used for a different request (IDEMPOTENCY_CONFLICT).","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Reference asset expired; upload the reference again.","content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"},{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}]}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}},"429":{"description":"Concurrent job limit (MAX_CONCURRENT_JOBS) or request rate limit (RATE_LIMITED) reached.","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"},{"properties":{"code":{"title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"}},"required":["code","detail"],"title":"ServiceUnavailableResponse","type":"object"}]}}},"description":"Feature disabled or service temporarily unavailable; try again later","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X POST 'https://shixux.com/api/v1/video/upscale' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"preset":"1080p"}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/video/upscale", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "your-unique-business-action-id" }, body: JSON.stringify({ "preset": "1080p" }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/video/upscale", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json","Idempotency-Key":"your-unique-business-action-id"}, data="{\"preset\":\"1080p\"}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/video/upscale", strings.NewReader("{\"preset\":\"1080p\"}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", "your-unique-business-action-id") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Quote an audio composition URL: https://docs.shixux.com/en/audio/api/audio-composition-quote/ Parse the script, timeline, voices, sound effects and music references in prompt_document, and return the number of speech segments and the estimated credits. Quoting does not create a job or charge credits. When prompt_document is omitted, text is parsed as a simple timeline. POST /v1/audio/compositions/quote {"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","enum":["indextts-2","indextts-2.5"],"default":"indextts-2","description":"语音模型 ID。省略时使用 indextts-2。indextts-2.5 需要同时提供 language,使用 voice_preset_id 或 voice_asset_id 选择音色,并用 emo_text 控制情绪。"},"speed":{"type":"number","minimum":0.5,"maximum":2,"default":1,"description":"语速倍率,仅 model 为 indextts-2.5 时可用,范围 0.5–2。"},"prompt_document":{"type":"object","properties":{"version":{"type":"integer","const":1},"parts":{"type":"array","maxItems":2048,"items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"text"},"text":{"type":"string"}},"additionalProperties":false,"required":["type","text"]},{"type":"object","properties":{"type":{"type":"string","const":"reference"},"reference_id":{"type":"string","format":"uuid"},"label":{"type":"string","maxLength":240}},"additionalProperties":false,"required":["type","reference_id","label"]}]}}},"additionalProperties":false,"required":["version","parts"]},"text":{"type":"string","description":"台词文本。使用 prompt_document 时,建议同时提供与文档一致的文本。"},"voice_preset_id":{"type":"string","description":"默认人声音色预置 ID,与 voice_asset_id、voice_ref_key 互斥。"},"voice_asset_id":{"type":"string","description":"默认人声音色资产 ID,与 voice_preset_id、voice_ref_key 互斥。"},"emo_asset_id":{"type":"string","description":"默认情绪参考素材 ID,与 emo_ref_key、emo_vector 互斥。"},"voice_ref_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Ref Key","description":"默认人声的声音参考引用值。model 为 indextts-2.5 时不支持该字段,请使用 voice_asset_id。"},"emo_ref_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Emo Ref Key","description":"默认人声的情绪参考 WAV 引用值,与 emo_asset_id、emo_vector 互斥。"},"emo_alpha":{"default":1,"maximum":1,"minimum":0,"description":"情绪参考或向量强度,范围 0–1。","title":"Emo Alpha","type":"number"},"emo_vector":{"anyOf":[{"items":{"type":"number","minimum":0,"maximum":1.4},"type":"array","minItems":8,"maxItems":8},{"type":"null"}],"description":"八维情绪向量,顺序为 happy、angry、sad、afraid、disgusted、melancholic、surprised、calm。","title":"Emo Vector"}},"additionalProperties":false,"required":["text"]}}}},"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"credits":{"type":"number"},"estimated":{"type":"boolean"},"segments":{"type":"integer"}},"additionalProperties":false,"required":["credits","estimated","segments"]}}}},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"The credentials do not match the account.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}}}}} speed Speaking-rate multiplier from 0.5 to 2, default 1. Available only with model indextts-2.5. prompt_document Structured script document (version 1) made of text and reference parts, describing the timeline, voices, sound effects and music. Recommended for audio composition; when omitted, text is parsed as a simple timeline. emo_asset_id Emotion reference asset ID: a WAV uploaded and confirmed with purpose emotion_reference, owned by your account and unexpired. Mutually exclusive with emo_ref_key. indextts-2 only. text Text to synthesize. It must not be all whitespace. In speech synthesis, indextts-2 accepts up to 2048 characters, and indextts-2.5 accepts up to 2000 characters that include a letter or digit. Audio composition scripts are limited to 5000 characters in total. voice_preset_id Preset voice ID from the preset voice catalog. Mutually exclusive with voice_asset_id and voice_ref_key. voice_asset_id Voice asset ID of your account, such as a saved designed voice or a voice reference uploaded and confirmed with purpose voice_reference. It must not be expired. voice_ref_key Voice reference value, mutually exclusive with voice_preset_id and voice_asset_id. For voice references registered through the upload endpoints, use voice_asset_id. emo_ref_key Emotion reference WAV value, up to 20 MiB. indextts-2 only. For emotion references registered through the upload endpoints, use emo_asset_id. emo_alpha Overall strength of the eight-dimensional emotion vector, from 0 to 1. Keep the default of 1 when using emotion reference audio. indextts-2 only. emo_vector Eight-dimensional emotion vector in the fixed order happy, angry, sad, afraid, disgusted, melancholic, surprised, calm. Exactly eight values, each from 0 to 1.4. Mutually exclusive with emotion reference audio. indextts-2 only. model Model ID. For image and video models, use the corresponding settings endpoint for current availability, resolutions and rates. Speech synthesis and audio composition accept indextts-2 (default) or indextts-2.5. ```curl curl -X POST 'https://shixux.com/api/v1/audio/compositions/quote' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"text":"[00:00] 欢迎回来。","prompt_document":{"version":1,"parts":[{"type":"text","text":"[00:00] 欢迎回来。"}]},"voice_preset_id":"vp_000000000000000000000001"}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/audio/compositions/quote", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json" }, body: JSON.stringify({ "text": "[00:00] 欢迎回来。", "prompt_document": { "version": 1, "parts": [ { "type": "text", "text": "[00:00] 欢迎回来。" } ] }, "voice_preset_id": "vp_000000000000000000000001" }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/audio/compositions/quote", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json"}, data="{\"text\":\"[00:00] 欢迎回来。\",\"prompt_document\":{\"version\":1,\"parts\":[{\"type\":\"text\",\"text\":\"[00:00] 欢迎回来。\"}]},\"voice_preset_id\":\"vp_000000000000000000000001\"}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/audio/compositions/quote", strings.NewReader("{\"text\":\"[00:00] 欢迎回来。\",\"prompt_document\":{\"version\":1,\"parts\":[{\"type\":\"text\",\"text\":\"[00:00] 欢迎回来。\"}]},\"voice_preset_id\":\"vp_000000000000000000000001\"}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 查询音频编排报价 URL: https://docs.shixux.com/zh/audio/api/audio-composition-quote/ 解析 prompt_document 中的台词、时间轴、音色、音效和配乐引用,返回人声片段数和预计消耗的积分。报价不会创建任务或扣费。省略 prompt_document 时,根据 text 解析简单时间轴。 POST /v1/audio/compositions/quote {"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","enum":["indextts-2","indextts-2.5"],"default":"indextts-2","description":"语音模型 ID。省略时使用 indextts-2。indextts-2.5 需要同时提供 language,使用 voice_preset_id 或 voice_asset_id 选择音色,并用 emo_text 控制情绪。"},"speed":{"type":"number","minimum":0.5,"maximum":2,"default":1,"description":"语速倍率,仅 model 为 indextts-2.5 时可用,范围 0.5–2。"},"prompt_document":{"type":"object","properties":{"version":{"type":"integer","const":1},"parts":{"type":"array","maxItems":2048,"items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"text"},"text":{"type":"string"}},"additionalProperties":false,"required":["type","text"]},{"type":"object","properties":{"type":{"type":"string","const":"reference"},"reference_id":{"type":"string","format":"uuid"},"label":{"type":"string","maxLength":240}},"additionalProperties":false,"required":["type","reference_id","label"]}]}}},"additionalProperties":false,"required":["version","parts"]},"text":{"type":"string","description":"台词文本。使用 prompt_document 时,建议同时提供与文档一致的文本。"},"voice_preset_id":{"type":"string","description":"默认人声音色预置 ID,与 voice_asset_id、voice_ref_key 互斥。"},"voice_asset_id":{"type":"string","description":"默认人声音色资产 ID,与 voice_preset_id、voice_ref_key 互斥。"},"emo_asset_id":{"type":"string","description":"默认情绪参考素材 ID,与 emo_ref_key、emo_vector 互斥。"},"voice_ref_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Ref Key","description":"默认人声的声音参考引用值。model 为 indextts-2.5 时不支持该字段,请使用 voice_asset_id。"},"emo_ref_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Emo Ref Key","description":"默认人声的情绪参考 WAV 引用值,与 emo_asset_id、emo_vector 互斥。"},"emo_alpha":{"default":1,"maximum":1,"minimum":0,"description":"情绪参考或向量强度,范围 0–1。","title":"Emo Alpha","type":"number"},"emo_vector":{"anyOf":[{"items":{"type":"number","minimum":0,"maximum":1.4},"type":"array","minItems":8,"maxItems":8},{"type":"null"}],"description":"八维情绪向量,顺序为 happy、angry、sad、afraid、disgusted、melancholic、surprised、calm。","title":"Emo Vector"}},"additionalProperties":false,"required":["text"]}}}},"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"credits":{"type":"number"},"estimated":{"type":"boolean"},"segments":{"type":"integer"}},"additionalProperties":false,"required":["credits","estimated","segments"]}}}},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"The credentials do not match the account.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}}}}} speed 语速倍率,范围 0.5–2,默认 1,仅 model 为 indextts-2.5 时可用。 prompt_document 结构化台词文档(version 为 1),由 text 片段和 reference 片段组成,用于描述时间轴、音色、音效和配乐。音频编排建议显式传入;省略时根据 text 解析简单时间轴。 emo_asset_id 情绪参考素材 ID:以 purpose 为 emotion_reference 上传并确认的 WAV,须属于当前账号且未过期。与 emo_ref_key 互斥,仅 indextts-2 支持。 text 要合成的文本,不能全为空白。语音合成中,indextts-2 最多 2048 个字符,indextts-2.5 最多 2000 个字符且须包含文字或数字;音频编排的台词合计最多 5000 个字符。 voice_preset_id 预置音色 ID,来自预置音色目录。与 voice_asset_id 和 voice_ref_key 互斥。 voice_asset_id 当前账号的音色资产 ID,例如已保存的设计音色,或以 purpose 为 voice_reference 上传并确认的声音参考,须未过期。 voice_ref_key 声音参考的引用值,与 voice_preset_id、voice_asset_id 互斥。通过上传接口登记的声音参考请使用 voice_asset_id。 emo_ref_key 情绪参考 WAV 的引用值,最大 20 MiB,仅 indextts-2 支持。通过上传接口登记的情绪参考请使用 emo_asset_id。 emo_alpha 八维情绪向量的整体强度,范围 0–1。使用情绪参考音频时保持默认值 1。仅 indextts-2 支持。 emo_vector 八维情绪向量,顺序固定为高兴、愤怒、悲伤、害怕、厌恶、忧郁、惊讶、平静。共 8 项,每项范围 0–1.4。与情绪参考音频互斥,仅 indextts-2 支持。 model 模型 ID。图片和视频模型的可用状态、清晰度和费率以对应配置接口的返回为准;语音合成和音频编排可选 indextts-2(默认)或 indextts-2.5。 ```curl curl -X POST 'https://shixux.com/api/v1/audio/compositions/quote' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"text":"[00:00] 欢迎回来。","prompt_document":{"version":1,"parts":[{"type":"text","text":"[00:00] 欢迎回来。"}]},"voice_preset_id":"vp_000000000000000000000001"}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/audio/compositions/quote", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json" }, body: JSON.stringify({ "text": "[00:00] 欢迎回来。", "prompt_document": { "version": 1, "parts": [ { "type": "text", "text": "[00:00] 欢迎回来。" } ] }, "voice_preset_id": "vp_000000000000000000000001" }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/audio/compositions/quote", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json"}, data="{\"text\":\"[00:00] 欢迎回来。\",\"prompt_document\":{\"version\":1,\"parts\":[{\"type\":\"text\",\"text\":\"[00:00] 欢迎回来。\"}]},\"voice_preset_id\":\"vp_000000000000000000000001\"}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/audio/compositions/quote", strings.NewReader("{\"text\":\"[00:00] 欢迎回来。\",\"prompt_document\":{\"version\":1,\"parts\":[{\"type\":\"text\",\"text\":\"[00:00] 欢迎回来。\"}]},\"voice_preset_id\":\"vp_000000000000000000000001\"}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Resume an audio composition URL: https://docs.shixux.com/en/audio/api/audio-composition-retry/ Resume a failed or stopped audio composition: completed segments are kept, and only unfinished segments are generated or the mix is redone. If any segment is still processing, wait for it to finish before resuming. POST /v1/audio/compositions/{job_id}/retry {"parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}}}}} ```curl curl -X POST 'https://shixux.com/api/v1/audio/compositions/job_id_example/retry' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/audio/compositions/job_id_example/retry", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/audio/compositions/job_id_example/retry", method="POST", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/audio/compositions/job_id_example/retry", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 恢复音频编排 URL: https://docs.shixux.com/zh/audio/api/audio-composition-retry/ 恢复失败或已停止的音频编排:保留已完成的片段,只生成未完成的片段或重新混音。仍有片段在处理中时,需等其结束后再恢复。 POST /v1/audio/compositions/{job_id}/retry {"parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}}}}} ```curl curl -X POST 'https://shixux.com/api/v1/audio/compositions/job_id_example/retry' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/audio/compositions/job_id_example/retry", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/audio/compositions/job_id_example/retry", method="POST", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/audio/compositions/job_id_example/retry", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Create an audio composition URL: https://docs.shixux.com/en/audio/api/audio-composition/ Create an audio composition job: each speech line is generated once, sound effects are trimmed to their ranges and music is looped along the timeline, then everything is mixed into one WAV. An Idempotency-Key is required, and an explicit prompt_document is recommended. Credits are reserved once for the whole composition, not again per segment. POST /v1/audio/compositions {"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","enum":["indextts-2","indextts-2.5"],"default":"indextts-2","description":"语音模型 ID。省略时使用 indextts-2。indextts-2.5 需要同时提供 language,使用 voice_preset_id 或 voice_asset_id 选择音色,并用 emo_text 控制情绪。"},"speed":{"type":"number","minimum":0.5,"maximum":2,"default":1,"description":"语速倍率,仅 model 为 indextts-2.5 时可用,范围 0.5–2。"},"prompt_document":{"type":"object","properties":{"version":{"type":"integer","const":1},"parts":{"type":"array","maxItems":2048,"items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"text"},"text":{"type":"string"}},"additionalProperties":false,"required":["type","text"]},{"type":"object","properties":{"type":{"type":"string","const":"reference"},"reference_id":{"type":"string","format":"uuid"},"label":{"type":"string","maxLength":240}},"additionalProperties":false,"required":["type","reference_id","label"]}]}}},"additionalProperties":false,"required":["version","parts"]},"text":{"type":"string","description":"台词文本。使用 prompt_document 时,建议同时提供与文档一致的文本。"},"voice_preset_id":{"type":"string","description":"默认人声音色预置 ID,与 voice_asset_id、voice_ref_key 互斥。"},"voice_asset_id":{"type":"string","description":"默认人声音色资产 ID,与 voice_preset_id、voice_ref_key 互斥。"},"emo_asset_id":{"type":"string","description":"默认情绪参考素材 ID,与 emo_ref_key、emo_vector 互斥。"},"voice_ref_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Ref Key","description":"默认人声的声音参考引用值。model 为 indextts-2.5 时不支持该字段,请使用 voice_asset_id。"},"emo_ref_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Emo Ref Key","description":"默认人声的情绪参考 WAV 引用值,与 emo_asset_id、emo_vector 互斥。"},"emo_alpha":{"default":1,"maximum":1,"minimum":0,"description":"情绪参考或向量强度,范围 0–1。","title":"Emo Alpha","type":"number"},"emo_vector":{"anyOf":[{"items":{"type":"number","minimum":0,"maximum":1.4},"type":"array","minItems":8,"maxItems":8},{"type":"null"}],"description":"八维情绪向量,顺序为 happy、angry、sad、afraid、disgusted、melancholic、surprised、calm。","title":"Emo Vector"}},"additionalProperties":false,"required":["text"]}}}},"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"description":"Stable key for retries of the same composition request. Reusing it with different content returns 409.","schema":{"type":"string","minLength":1,"maxLength":128}}],"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}}},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"The credentials do not match the account.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}}},"429":{"description":"UPLOAD_RATE_LIMITED (more than 30 upload requests per minute) or UPLOAD_QUOTA_EXCEEDED (more than 500 MiB in 24 hours). quota gives the current limit and usage.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."},"Retry-After":{"schema":{"type":"string"},"description":"Seconds until enough rolling quota expires for this request. Omitted when no retry time can be promised. Concurrent uploads may delay availability."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}}}} speed Speaking-rate multiplier from 0.5 to 2, default 1. Available only with model indextts-2.5. prompt_document Structured script document (version 1) made of text and reference parts, describing the timeline, voices, sound effects and music. Recommended for audio composition; when omitted, text is parsed as a simple timeline. emo_asset_id Emotion reference asset ID: a WAV uploaded and confirmed with purpose emotion_reference, owned by your account and unexpired. Mutually exclusive with emo_ref_key. indextts-2 only. text Text to synthesize. It must not be all whitespace. In speech synthesis, indextts-2 accepts up to 2048 characters, and indextts-2.5 accepts up to 2000 characters that include a letter or digit. Audio composition scripts are limited to 5000 characters in total. voice_preset_id Preset voice ID from the preset voice catalog. Mutually exclusive with voice_asset_id and voice_ref_key. voice_asset_id Voice asset ID of your account, such as a saved designed voice or a voice reference uploaded and confirmed with purpose voice_reference. It must not be expired. voice_ref_key Voice reference value, mutually exclusive with voice_preset_id and voice_asset_id. For voice references registered through the upload endpoints, use voice_asset_id. emo_ref_key Emotion reference WAV value, up to 20 MiB. indextts-2 only. For emotion references registered through the upload endpoints, use emo_asset_id. emo_alpha Overall strength of the eight-dimensional emotion vector, from 0 to 1. Keep the default of 1 when using emotion reference audio. indextts-2 only. emo_vector Eight-dimensional emotion vector in the fixed order happy, angry, sad, afraid, disgusted, melancholic, surprised, calm. Exactly eight values, each from 0 to 1.4. Mutually exclusive with emotion reference audio. indextts-2 only. model Model ID. For image and video models, use the corresponding settings endpoint for current availability, resolutions and rates. Speech synthesis and audio composition accept indextts-2 (default) or indextts-2.5. ```curl curl -X POST 'https://shixux.com/api/v1/audio/compositions' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"text":"[00:00] 欢迎回来。","prompt_document":{"version":1,"parts":[{"type":"text","text":"[00:00] 欢迎回来。"}]},"voice_preset_id":"vp_000000000000000000000001"}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/audio/compositions", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "your-unique-business-action-id" }, body: JSON.stringify({ "text": "[00:00] 欢迎回来。", "prompt_document": { "version": 1, "parts": [ { "type": "text", "text": "[00:00] 欢迎回来。" } ] }, "voice_preset_id": "vp_000000000000000000000001" }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/audio/compositions", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json","Idempotency-Key":"your-unique-business-action-id"}, data="{\"text\":\"[00:00] 欢迎回来。\",\"prompt_document\":{\"version\":1,\"parts\":[{\"type\":\"text\",\"text\":\"[00:00] 欢迎回来。\"}]},\"voice_preset_id\":\"vp_000000000000000000000001\"}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/audio/compositions", strings.NewReader("{\"text\":\"[00:00] 欢迎回来。\",\"prompt_document\":{\"version\":1,\"parts\":[{\"type\":\"text\",\"text\":\"[00:00] 欢迎回来。\"}]},\"voice_preset_id\":\"vp_000000000000000000000001\"}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", "your-unique-business-action-id") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 创建音频编排 URL: https://docs.shixux.com/zh/audio/api/audio-composition/ 创建音频编排任务:每段人声生成一次,音效按指定区间截取,配乐按时间轴循环铺满,最后混音为一个 WAV。必须携带 Idempotency-Key,建议显式传入 prompt_document。整个编排统一预扣积分,不会按片段重复预扣。 POST /v1/audio/compositions {"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","enum":["indextts-2","indextts-2.5"],"default":"indextts-2","description":"语音模型 ID。省略时使用 indextts-2。indextts-2.5 需要同时提供 language,使用 voice_preset_id 或 voice_asset_id 选择音色,并用 emo_text 控制情绪。"},"speed":{"type":"number","minimum":0.5,"maximum":2,"default":1,"description":"语速倍率,仅 model 为 indextts-2.5 时可用,范围 0.5–2。"},"prompt_document":{"type":"object","properties":{"version":{"type":"integer","const":1},"parts":{"type":"array","maxItems":2048,"items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"text"},"text":{"type":"string"}},"additionalProperties":false,"required":["type","text"]},{"type":"object","properties":{"type":{"type":"string","const":"reference"},"reference_id":{"type":"string","format":"uuid"},"label":{"type":"string","maxLength":240}},"additionalProperties":false,"required":["type","reference_id","label"]}]}}},"additionalProperties":false,"required":["version","parts"]},"text":{"type":"string","description":"台词文本。使用 prompt_document 时,建议同时提供与文档一致的文本。"},"voice_preset_id":{"type":"string","description":"默认人声音色预置 ID,与 voice_asset_id、voice_ref_key 互斥。"},"voice_asset_id":{"type":"string","description":"默认人声音色资产 ID,与 voice_preset_id、voice_ref_key 互斥。"},"emo_asset_id":{"type":"string","description":"默认情绪参考素材 ID,与 emo_ref_key、emo_vector 互斥。"},"voice_ref_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Ref Key","description":"默认人声的声音参考引用值。model 为 indextts-2.5 时不支持该字段,请使用 voice_asset_id。"},"emo_ref_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Emo Ref Key","description":"默认人声的情绪参考 WAV 引用值,与 emo_asset_id、emo_vector 互斥。"},"emo_alpha":{"default":1,"maximum":1,"minimum":0,"description":"情绪参考或向量强度,范围 0–1。","title":"Emo Alpha","type":"number"},"emo_vector":{"anyOf":[{"items":{"type":"number","minimum":0,"maximum":1.4},"type":"array","minItems":8,"maxItems":8},{"type":"null"}],"description":"八维情绪向量,顺序为 happy、angry、sad、afraid、disgusted、melancholic、surprised、calm。","title":"Emo Vector"}},"additionalProperties":false,"required":["text"]}}}},"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"description":"Stable key for retries of the same composition request. Reusing it with different content returns 409.","schema":{"type":"string","minLength":1,"maxLength":128}}],"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}}},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"The credentials do not match the account.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}}},"429":{"description":"UPLOAD_RATE_LIMITED (more than 30 upload requests per minute) or UPLOAD_QUOTA_EXCEEDED (more than 500 MiB in 24 hours). quota gives the current limit and usage.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."},"Retry-After":{"schema":{"type":"string"},"description":"Seconds until enough rolling quota expires for this request. Omitted when no retry time can be promised. Concurrent uploads may delay availability."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}}}} speed 语速倍率,范围 0.5–2,默认 1,仅 model 为 indextts-2.5 时可用。 prompt_document 结构化台词文档(version 为 1),由 text 片段和 reference 片段组成,用于描述时间轴、音色、音效和配乐。音频编排建议显式传入;省略时根据 text 解析简单时间轴。 emo_asset_id 情绪参考素材 ID:以 purpose 为 emotion_reference 上传并确认的 WAV,须属于当前账号且未过期。与 emo_ref_key 互斥,仅 indextts-2 支持。 text 要合成的文本,不能全为空白。语音合成中,indextts-2 最多 2048 个字符,indextts-2.5 最多 2000 个字符且须包含文字或数字;音频编排的台词合计最多 5000 个字符。 voice_preset_id 预置音色 ID,来自预置音色目录。与 voice_asset_id 和 voice_ref_key 互斥。 voice_asset_id 当前账号的音色资产 ID,例如已保存的设计音色,或以 purpose 为 voice_reference 上传并确认的声音参考,须未过期。 voice_ref_key 声音参考的引用值,与 voice_preset_id、voice_asset_id 互斥。通过上传接口登记的声音参考请使用 voice_asset_id。 emo_ref_key 情绪参考 WAV 的引用值,最大 20 MiB,仅 indextts-2 支持。通过上传接口登记的情绪参考请使用 emo_asset_id。 emo_alpha 八维情绪向量的整体强度,范围 0–1。使用情绪参考音频时保持默认值 1。仅 indextts-2 支持。 emo_vector 八维情绪向量,顺序固定为高兴、愤怒、悲伤、害怕、厌恶、忧郁、惊讶、平静。共 8 项,每项范围 0–1.4。与情绪参考音频互斥,仅 indextts-2 支持。 model 模型 ID。图片和视频模型的可用状态、清晰度和费率以对应配置接口的返回为准;语音合成和音频编排可选 indextts-2(默认)或 indextts-2.5。 ```curl curl -X POST 'https://shixux.com/api/v1/audio/compositions' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"text":"[00:00] 欢迎回来。","prompt_document":{"version":1,"parts":[{"type":"text","text":"[00:00] 欢迎回来。"}]},"voice_preset_id":"vp_000000000000000000000001"}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/audio/compositions", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "your-unique-business-action-id" }, body: JSON.stringify({ "text": "[00:00] 欢迎回来。", "prompt_document": { "version": 1, "parts": [ { "type": "text", "text": "[00:00] 欢迎回来。" } ] }, "voice_preset_id": "vp_000000000000000000000001" }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/audio/compositions", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json","Idempotency-Key":"your-unique-business-action-id"}, data="{\"text\":\"[00:00] 欢迎回来。\",\"prompt_document\":{\"version\":1,\"parts\":[{\"type\":\"text\",\"text\":\"[00:00] 欢迎回来。\"}]},\"voice_preset_id\":\"vp_000000000000000000000001\"}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/audio/compositions", strings.NewReader("{\"text\":\"[00:00] 欢迎回来。\",\"prompt_document\":{\"version\":1,\"parts\":[{\"type\":\"text\",\"text\":\"[00:00] 欢迎回来。\"}]},\"voice_preset_id\":\"vp_000000000000000000000001\"}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", "your-unique-business-action-id") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Create speech URL: https://docs.shixux.com/en/audio/api/tts/ Submit text and a voice to generate speech asynchronously. Select indextts-2 (default) or indextts-2.5 with model; voice_preset_id, voice_asset_id and voice_ref_key are mutually exclusive. indextts-2 supports emotion reference audio or an eight-dimensional emotion vector, with up to 2048 characters of text. indextts-2.5 requires language, supports speed and emo_text, and accepts up to 2000 characters. POST /v1/tts {"requestBody":{"content":{"application/json":{"schema":{"properties":{"emo_alpha":{"default":1,"maximum":1,"minimum":0,"description":"情绪参考或情绪向量的强度,范围 0–1。当前只有情绪向量允许使用非 1 值。","title":"Emo Alpha","type":"number"},"emo_ref_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Emo Ref Key","description":"情绪参考 WAV 的引用值,与 emo_asset_id、emo_vector 互斥。通过上传接口登记的情绪参考请使用 emo_asset_id。"},"model":{"type":"string","enum":["indextts-2","indextts-2.5"],"default":"indextts-2","description":"语音模型 ID。省略时使用 indextts-2。indextts-2.5 需要同时提供 language,并用 emo_text 控制情绪。","title":"Model"},"language":{"type":"string","enum":["ZH","EN","JA"],"description":"文本语言,仅 model 为 indextts-2.5 时可用,且必须提供。","title":"Language"},"speed":{"type":"number","minimum":0.5,"maximum":2,"default":1,"description":"语速倍率,仅 model 为 indextts-2.5 时可用,范围 0.5–2。","title":"Speed"},"emo_vector":{"anyOf":[{"items":{"type":"number","minimum":0,"maximum":1.4},"type":"array","minItems":8,"maxItems":8},{"type":"null"}],"description":"八维情绪向量,顺序为 happy、angry、sad、afraid、disgusted、melancholic、surprised、calm,每项范围 0–1.4。","title":"Emo Vector"},"text":{"maxLength":2048,"minLength":1,"description":"要合成的文本。indextts-2 最多 2048 个字符,indextts-2.5 最多 2000 个字符,且必须包含文字或数字。","title":"Text","type":"string"},"voice_asset_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Asset Id","description":"当前账号拥有的音色资产 ID。与 voice_preset_id、voice_ref_key 互斥。"},"voice_preset_id":{"anyOf":[{"type":"string","pattern":"^vp_[a-f0-9]{24}$"},{"type":"null"}],"description":"Preset voice ID from GET /voice-presets. Mutually exclusive with voice_asset_id and voice_ref_key.","title":"Voice Preset Id"},"voice_ref_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Ref Key","description":"声音参考 WAV 的引用值,与 voice_preset_id、voice_asset_id 互斥。通过上传接口登记的声音参考请使用 voice_asset_id。"},"webhook_endpoint_id":{"anyOf":[{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},{"type":"null"}],"description":"Registered webhook endpoint to notify when the job succeeds or fails.","title":"Webhook Endpoint Id"},"emo_asset_id":{"type":"string","format":"uuid","description":"Emotion reference asset ID, uploaded with purpose emotion_reference. Mutually exclusive with emo_ref_key."}},"required":["text"],"title":"TTSRequest","type":"object"}}},"required":true},"parameters":[{"in":"header","name":"Idempotency-Key","schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}}],"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}},"description":"Successful Response"},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"404":{"description":"Selected voice preset was not found","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"Idempotency-Key was already used for a different request (IDEMPOTENCY_CONFLICT).","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Selected user voice asset has expired","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}},"429":{"description":"Concurrent job limit (MAX_CONCURRENT_JOBS) or request rate limit (RATE_LIMITED) reached.","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"},{"properties":{"code":{"title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"}},"required":["code","detail"],"title":"ServiceUnavailableResponse","type":"object"}]}}},"description":"Feature disabled or service temporarily unavailable; try again later","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} language Language. Speech synthesis and audio composition use it only with model indextts-2.5, where it is required and must be ZH, EN or JA. Voice design uses the language codes its configuration allows. speed Speaking-rate multiplier from 0.5 to 2, default 1. Available only with model indextts-2.5. emo_asset_id Emotion reference asset ID: a WAV uploaded and confirmed with purpose emotion_reference, owned by your account and unexpired. Mutually exclusive with emo_ref_key. indextts-2 only. text Text to synthesize. It must not be all whitespace. In speech synthesis, indextts-2 accepts up to 2048 characters, and indextts-2.5 accepts up to 2000 characters that include a letter or digit. Audio composition scripts are limited to 5000 characters in total. voice_preset_id Preset voice ID from the preset voice catalog. Mutually exclusive with voice_asset_id and voice_ref_key. voice_asset_id Voice asset ID of your account, such as a saved designed voice or a voice reference uploaded and confirmed with purpose voice_reference. It must not be expired. voice_ref_key Voice reference value, mutually exclusive with voice_preset_id and voice_asset_id. For voice references registered through the upload endpoints, use voice_asset_id. emo_ref_key Emotion reference WAV value, up to 20 MiB. indextts-2 only. For emotion references registered through the upload endpoints, use emo_asset_id. emo_alpha Overall strength of the eight-dimensional emotion vector, from 0 to 1. Keep the default of 1 when using emotion reference audio. indextts-2 only. emo_vector Eight-dimensional emotion vector in the fixed order happy, angry, sad, afraid, disgusted, melancholic, surprised, calm. Exactly eight values, each from 0 to 1.4. Mutually exclusive with emotion reference audio. indextts-2 only. webhook_endpoint_id ID of the webhook endpoint notified when the job ends. It must belong to your account and be enabled. model Model ID. For image and video models, use the corresponding settings endpoint for current availability, resolutions and rates. Speech synthesis and audio composition accept indextts-2 (default) or indextts-2.5. ```curl curl -X POST 'https://shixux.com/api/v1/tts' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"text":"Hello from Shixu.","voice_preset_id":"vp_000000000000000000000001","emo_vector":[0,0,0,0,0,0,0,1]}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/tts", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "your-unique-business-action-id" }, body: JSON.stringify({ "text": "Hello from Shixu.", "voice_preset_id": "vp_000000000000000000000001", "emo_vector": [ 0, 0, 0, 0, 0, 0, 0, 1 ] }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/tts", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json","Idempotency-Key":"your-unique-business-action-id"}, data="{\"text\":\"Hello from Shixu.\",\"voice_preset_id\":\"vp_000000000000000000000001\",\"emo_vector\":[0,0,0,0,0,0,0,1]}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/tts", strings.NewReader("{\"text\":\"Hello from Shixu.\",\"voice_preset_id\":\"vp_000000000000000000000001\",\"emo_vector\":[0,0,0,0,0,0,0,1]}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", "your-unique-business-action-id") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 创建语音任务 URL: https://docs.shixux.com/zh/audio/api/tts/ 提交文本和音色,异步生成语音。通过 model 选择 indextts-2(默认)或 indextts-2.5;voice_preset_id、voice_asset_id 和 voice_ref_key 互斥。indextts-2 支持情绪参考音频或八维情绪向量,文本最多 2048 个字符;indextts-2.5 须指定 language,支持 speed 和 emo_text,文本最多 2000 个字符。 POST /v1/tts {"requestBody":{"content":{"application/json":{"schema":{"properties":{"emo_alpha":{"default":1,"maximum":1,"minimum":0,"description":"情绪参考或情绪向量的强度,范围 0–1。当前只有情绪向量允许使用非 1 值。","title":"Emo Alpha","type":"number"},"emo_ref_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Emo Ref Key","description":"情绪参考 WAV 的引用值,与 emo_asset_id、emo_vector 互斥。通过上传接口登记的情绪参考请使用 emo_asset_id。"},"model":{"type":"string","enum":["indextts-2","indextts-2.5"],"default":"indextts-2","description":"语音模型 ID。省略时使用 indextts-2。indextts-2.5 需要同时提供 language,并用 emo_text 控制情绪。","title":"Model"},"language":{"type":"string","enum":["ZH","EN","JA"],"description":"文本语言,仅 model 为 indextts-2.5 时可用,且必须提供。","title":"Language"},"speed":{"type":"number","minimum":0.5,"maximum":2,"default":1,"description":"语速倍率,仅 model 为 indextts-2.5 时可用,范围 0.5–2。","title":"Speed"},"emo_vector":{"anyOf":[{"items":{"type":"number","minimum":0,"maximum":1.4},"type":"array","minItems":8,"maxItems":8},{"type":"null"}],"description":"八维情绪向量,顺序为 happy、angry、sad、afraid、disgusted、melancholic、surprised、calm,每项范围 0–1.4。","title":"Emo Vector"},"text":{"maxLength":2048,"minLength":1,"description":"要合成的文本。indextts-2 最多 2048 个字符,indextts-2.5 最多 2000 个字符,且必须包含文字或数字。","title":"Text","type":"string"},"voice_asset_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Asset Id","description":"当前账号拥有的音色资产 ID。与 voice_preset_id、voice_ref_key 互斥。"},"voice_preset_id":{"anyOf":[{"type":"string","pattern":"^vp_[a-f0-9]{24}$"},{"type":"null"}],"description":"Preset voice ID from GET /voice-presets. Mutually exclusive with voice_asset_id and voice_ref_key.","title":"Voice Preset Id"},"voice_ref_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Ref Key","description":"声音参考 WAV 的引用值,与 voice_preset_id、voice_asset_id 互斥。通过上传接口登记的声音参考请使用 voice_asset_id。"},"webhook_endpoint_id":{"anyOf":[{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},{"type":"null"}],"description":"Registered webhook endpoint to notify when the job succeeds or fails.","title":"Webhook Endpoint Id"},"emo_asset_id":{"type":"string","format":"uuid","description":"Emotion reference asset ID, uploaded with purpose emotion_reference. Mutually exclusive with emo_ref_key."}},"required":["text"],"title":"TTSRequest","type":"object"}}},"required":true},"parameters":[{"in":"header","name":"Idempotency-Key","schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}}],"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}},"description":"Successful Response"},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"404":{"description":"Selected voice preset was not found","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"Idempotency-Key was already used for a different request (IDEMPOTENCY_CONFLICT).","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Selected user voice asset has expired","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}},"429":{"description":"Concurrent job limit (MAX_CONCURRENT_JOBS) or request rate limit (RATE_LIMITED) reached.","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"},{"properties":{"code":{"title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"}},"required":["code","detail"],"title":"ServiceUnavailableResponse","type":"object"}]}}},"description":"Feature disabled or service temporarily unavailable; try again later","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} language 语言。语音合成和音频编排仅在 model 为 indextts-2.5 时使用,且必须提供,取值为 ZH、EN 或 JA;音色设计使用其配置接口允许的语言代码。 speed 语速倍率,范围 0.5–2,默认 1,仅 model 为 indextts-2.5 时可用。 emo_asset_id 情绪参考素材 ID:以 purpose 为 emotion_reference 上传并确认的 WAV,须属于当前账号且未过期。与 emo_ref_key 互斥,仅 indextts-2 支持。 text 要合成的文本,不能全为空白。语音合成中,indextts-2 最多 2048 个字符,indextts-2.5 最多 2000 个字符且须包含文字或数字;音频编排的台词合计最多 5000 个字符。 voice_preset_id 预置音色 ID,来自预置音色目录。与 voice_asset_id 和 voice_ref_key 互斥。 voice_asset_id 当前账号的音色资产 ID,例如已保存的设计音色,或以 purpose 为 voice_reference 上传并确认的声音参考,须未过期。 voice_ref_key 声音参考的引用值,与 voice_preset_id、voice_asset_id 互斥。通过上传接口登记的声音参考请使用 voice_asset_id。 emo_ref_key 情绪参考 WAV 的引用值,最大 20 MiB,仅 indextts-2 支持。通过上传接口登记的情绪参考请使用 emo_asset_id。 emo_alpha 八维情绪向量的整体强度,范围 0–1。使用情绪参考音频时保持默认值 1。仅 indextts-2 支持。 emo_vector 八维情绪向量,顺序固定为高兴、愤怒、悲伤、害怕、厌恶、忧郁、惊讶、平静。共 8 项,每项范围 0–1.4。与情绪参考音频互斥,仅 indextts-2 支持。 webhook_endpoint_id 任务结束时接收通知的 Webhook 端点 ID,须属于当前账号且已启用。 model 模型 ID。图片和视频模型的可用状态、清晰度和费率以对应配置接口的返回为准;语音合成和音频编排可选 indextts-2(默认)或 indextts-2.5。 ```curl curl -X POST 'https://shixux.com/api/v1/tts' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"text":"Hello from Shixu.","voice_preset_id":"vp_000000000000000000000001","emo_vector":[0,0,0,0,0,0,0,1]}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/tts", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "your-unique-business-action-id" }, body: JSON.stringify({ "text": "Hello from Shixu.", "voice_preset_id": "vp_000000000000000000000001", "emo_vector": [ 0, 0, 0, 0, 0, 0, 0, 1 ] }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/tts", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json","Idempotency-Key":"your-unique-business-action-id"}, data="{\"text\":\"Hello from Shixu.\",\"voice_preset_id\":\"vp_000000000000000000000001\",\"emo_vector\":[0,0,0,0,0,0,0,1]}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/tts", strings.NewReader("{\"text\":\"Hello from Shixu.\",\"voice_preset_id\":\"vp_000000000000000000000001\",\"emo_vector\":[0,0,0,0,0,0,0,1]}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", "your-unique-business-action-id") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Get voice design configuration URL: https://docs.shixux.com/en/audio/api/voice-design-config/ Get whether voice design is available, the current model and the rate per generation. No authentication is required. GET /v1/voice-design/config {"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"available":{"type":"boolean"},"model":{"type":"string","description":"百炼音色设计和试听合成使用的模型。"},"languages":{"type":"array","items":{"type":"string","enum":["zh","en","ja","ko"]},"description":"当前已配置并可连接的音色设计语种。提交前同时检查 available。"},"message":{"type":"string"},"billing":{"type":"object","properties":{"credits":{"anyOf":[{"type":"number"},{"type":"null"}]},"version":{"type":"integer","format":"int64"},"updated_at":{"type":"string","format":"date-time"}},"required":["credits","version","updated_at"]}},"required":["enabled","available","model","billing"]}}},"description":"Successful Response"},"503":{"content":{"application/json":{"schema":{"properties":{"detail":{"title":"Detail","type":"string"}},"required":["detail"],"title":"ErrorDetail","type":"object"}}},"description":"Feature Configuration Unavailable","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}}}} model Model ID. For image and video models, use the corresponding settings endpoint for current availability, resolutions and rates. Speech synthesis and audio composition accept indextts-2 (default) or indextts-2.5. ```curl curl -X GET 'https://shixux.com/api/v1/voice-design/config' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/voice-design/config", { method: "GET", headers: {}, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/voice-design/config", method="GET", headers={}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/voice-design/config", nil) if err != nil { panic(err) } resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 查询音色设计配置 URL: https://docs.shixux.com/zh/audio/api/voice-design-config/ 查询音色设计是否可用,以及当前使用的模型和每次生成的费率。无需认证。 GET /v1/voice-design/config {"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"available":{"type":"boolean"},"model":{"type":"string","description":"百炼音色设计和试听合成使用的模型。"},"languages":{"type":"array","items":{"type":"string","enum":["zh","en","ja","ko"]},"description":"当前已配置并可连接的音色设计语种。提交前同时检查 available。"},"message":{"type":"string"},"billing":{"type":"object","properties":{"credits":{"anyOf":[{"type":"number"},{"type":"null"}]},"version":{"type":"integer","format":"int64"},"updated_at":{"type":"string","format":"date-time"}},"required":["credits","version","updated_at"]}},"required":["enabled","available","model","billing"]}}},"description":"Successful Response"},"503":{"content":{"application/json":{"schema":{"properties":{"detail":{"title":"Detail","type":"string"}},"required":["detail"],"title":"ErrorDetail","type":"object"}}},"description":"Feature Configuration Unavailable","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}}}} model 模型 ID。图片和视频模型的可用状态、清晰度和费率以对应配置接口的返回为准;语音合成和音频编排可选 indextts-2(默认)或 indextts-2.5。 ```curl curl -X GET 'https://shixux.com/api/v1/voice-design/config' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/voice-design/config", { method: "GET", headers: {}, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/voice-design/config", method="GET", headers={}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/voice-design/config", nil) if err != nil { panic(err) } resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Save a designed voice URL: https://docs.shixux.com/en/audio/api/voice-design-save/ Save a successfully designed voice of your account to the voice library. Saving again returns the same voice without another charge. Once saved, use it through voice_asset_id for speech synthesis or as a video reference. POST /v1/voice-designs/{job_id}/save {"parameters":[{"in":"path","name":"job_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Saved voice","content":{"application/json":{"schema":{"properties":{"id":{"title":"Id","type":"string"},"display_name":{"title":"Display Name","type":"string"},"original_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Filename"},"size_bytes":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}],"title":"Size Bytes"},"uploaded_at":{"format":"date-time","title":"Uploaded At","type":"string"},"retained_until":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"description":"Media retention deadline, or null for permanent retention. Signed URL lifetime is independent."},"permanent":{"type":"boolean"},"source":{"type":"string","enum":["uploaded","designed","preset"]},"preset_id":{"type":"string","description":"ID of the preset voice this voice comes from, when applicable."},"description":{"type":"string"},"duration_seconds":{"type":"number"}},"required":["id","display_name","original_filename","size_bytes","uploaded_at","retained_until"],"title":"VoiceAssetRecord","type":"object"}}}},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}},"description":"Idempotency-Key was already used for a different request, or the rate has changed; read the current rate before submitting again.","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}},"410":{"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}},"description":"Reference asset expired; upload the reference again."},"422":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"},{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}]}}},"description":"Validation Error","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}},"429":{"description":"Concurrent job limit (MAX_CONCURRENT_JOBS), request rate limit (RATE_LIMITED) or upload allowance (UPLOAD_RATE_LIMITED, UPLOAD_QUOTA_EXCEEDED) reached.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."},"Retry-After":{"schema":{"type":"string"},"description":"Seconds until enough rolling quota expires for this request. Omitted when no retry time can be promised. Concurrent uploads may delay availability."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"},{"properties":{"code":{"title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"}},"required":["code","detail"],"title":"ServiceUnavailableResponse","type":"object"}]}}},"description":"Feature disabled or service temporarily unavailable; try again later","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}}}} size_bytes Actual file size in bytes. Voice references, emotion references and images: up to 20 MiB; reference videos: up to 50 MiB; video reference audio: up to 15 MiB; other audio: up to 100 MiB. retained_until When the asset or result file stops being retained. Request a new download URL after one expires. ```curl curl -X POST 'https://shixux.com/api/v1/voice-designs/job_id_example/save' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/voice-designs/job_id_example/save", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/voice-designs/job_id_example/save", method="POST", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/voice-designs/job_id_example/save", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 保存设计音色 URL: https://docs.shixux.com/zh/audio/api/voice-design-save/ 将当前账号已成功生成的音色保存到音色库。重复保存返回同一音色,不重复扣费。保存后可通过 voice_asset_id 用于语音合成,也可用作视频参考。 POST /v1/voice-designs/{job_id}/save {"parameters":[{"in":"path","name":"job_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Saved voice","content":{"application/json":{"schema":{"properties":{"id":{"title":"Id","type":"string"},"display_name":{"title":"Display Name","type":"string"},"original_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Filename"},"size_bytes":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}],"title":"Size Bytes"},"uploaded_at":{"format":"date-time","title":"Uploaded At","type":"string"},"retained_until":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"description":"Media retention deadline, or null for permanent retention. Signed URL lifetime is independent."},"permanent":{"type":"boolean"},"source":{"type":"string","enum":["uploaded","designed","preset"]},"preset_id":{"type":"string","description":"ID of the preset voice this voice comes from, when applicable."},"description":{"type":"string"},"duration_seconds":{"type":"number"}},"required":["id","display_name","original_filename","size_bytes","uploaded_at","retained_until"],"title":"VoiceAssetRecord","type":"object"}}}},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}},"description":"Idempotency-Key was already used for a different request, or the rate has changed; read the current rate before submitting again.","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}},"410":{"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}},"description":"Reference asset expired; upload the reference again."},"422":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"},{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}]}}},"description":"Validation Error","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}},"429":{"description":"Concurrent job limit (MAX_CONCURRENT_JOBS), request rate limit (RATE_LIMITED) or upload allowance (UPLOAD_RATE_LIMITED, UPLOAD_QUOTA_EXCEEDED) reached.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."},"Retry-After":{"schema":{"type":"string"},"description":"Seconds until enough rolling quota expires for this request. Omitted when no retry time can be promised. Concurrent uploads may delay availability."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"},{"properties":{"code":{"title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"}},"required":["code","detail"],"title":"ServiceUnavailableResponse","type":"object"}]}}},"description":"Feature disabled or service temporarily unavailable; try again later","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}}}} size_bytes 文件的实际字节数。声音参考、情绪参考和图片最大 20 MiB,参考视频最大 50 MiB,视频参考音频最大 15 MiB,其他音频最大 100 MiB。 retained_until 素材或结果文件的保留截止时间。下载地址过期后可重新获取。 ```curl curl -X POST 'https://shixux.com/api/v1/voice-designs/job_id_example/save' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/voice-designs/job_id_example/save", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/voice-designs/job_id_example/save", method="POST", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/voice-designs/job_id_example/save", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Design a voice from a description URL: https://docs.shixux.com/en/audio/api/voice-design/ Generate a new voice from a voice description and preview text, without uploading recordings. Credits are reserved at the per-generation rate and refunded automatically if no result is produced. POST /v1/voice-designs {"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80,"description":"候选音色名称,1–80 个字符。"},"description":{"type":"string","minLength":1,"maxLength":500,"description":"声音特征描述,1–500 个字符。"},"preview_text":{"type":"string","minLength":15,"maxLength":200,"description":"用于试听候选音色的文本,15–200 个字符。"},"language":{"type":"string","enum":["zh","en","ja","ko"],"description":"候选音色语言。可用语种以音色设计配置返回的 languages 为准。"},"quote_version":{"type":"integer","format":"int64","description":"Billing version from GET /v1/voice-design/config. A mismatch returns 409 before any credits are reserved."}},"required":["name","description","preview_text","language"]}}},"required":true},"parameters":[{"in":"header","name":"Idempotency-Key","schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}}],"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}},"description":"Successful Response"},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}},"description":"Idempotency-Key was already used for a different request, or the rate has changed; read the current rate before submitting again.","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}},"410":{"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}},"description":"Reference asset expired; upload the reference again."},"422":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"},{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}]}}},"description":"Validation Error","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}},"429":{"description":"Concurrent job limit (MAX_CONCURRENT_JOBS) or request rate limit (RATE_LIMITED) reached.","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"},{"properties":{"code":{"title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"}},"required":["code","detail"],"title":"ServiceUnavailableResponse","type":"object"}]}}},"description":"Feature disabled or service temporarily unavailable; try again later","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}}}} language Language. Speech synthesis and audio composition use it only with model indextts-2.5, where it is required and must be ZH, EN or JA. Voice design uses the language codes its configuration allows. quote_version The rate_version from the quote response. If the rate has changed, the submission is rejected and a new quote is required. ```curl curl -X POST 'https://shixux.com/api/v1/voice-designs' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"name":"沉稳旁白","description":"低沉温暖的中年男性声音,语速自然,普通话清晰。","preview_text":"你好,今天的故事就从这里开始,让我们一起走进远方的山谷。","language":"zh","quote_version":1}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/voice-designs", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "your-unique-business-action-id" }, body: JSON.stringify({ "name": "沉稳旁白", "description": "低沉温暖的中年男性声音,语速自然,普通话清晰。", "preview_text": "你好,今天的故事就从这里开始,让我们一起走进远方的山谷。", "language": "zh", "quote_version": 1 }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/voice-designs", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json","Idempotency-Key":"your-unique-business-action-id"}, data="{\"name\":\"沉稳旁白\",\"description\":\"低沉温暖的中年男性声音,语速自然,普通话清晰。\",\"preview_text\":\"你好,今天的故事就从这里开始,让我们一起走进远方的山谷。\",\"language\":\"zh\",\"quote_version\":1}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/voice-designs", strings.NewReader("{\"name\":\"沉稳旁白\",\"description\":\"低沉温暖的中年男性声音,语速自然,普通话清晰。\",\"preview_text\":\"你好,今天的故事就从这里开始,让我们一起走进远方的山谷。\",\"language\":\"zh\",\"quote_version\":1}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", "your-unique-business-action-id") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 根据描述设计音色 URL: https://docs.shixux.com/zh/audio/api/voice-design/ 根据声音描述和试听文本生成一个全新的音色,无需上传录音。按单次费率预扣积分,未生成结果时自动退回。 POST /v1/voice-designs {"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80,"description":"候选音色名称,1–80 个字符。"},"description":{"type":"string","minLength":1,"maxLength":500,"description":"声音特征描述,1–500 个字符。"},"preview_text":{"type":"string","minLength":15,"maxLength":200,"description":"用于试听候选音色的文本,15–200 个字符。"},"language":{"type":"string","enum":["zh","en","ja","ko"],"description":"候选音色语言。可用语种以音色设计配置返回的 languages 为准。"},"quote_version":{"type":"integer","format":"int64","description":"Billing version from GET /v1/voice-design/config. A mismatch returns 409 before any credits are reserved."}},"required":["name","description","preview_text","language"]}}},"required":true},"parameters":[{"in":"header","name":"Idempotency-Key","schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}}],"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}},"description":"Successful Response"},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}},"description":"Idempotency-Key was already used for a different request, or the rate has changed; read the current rate before submitting again.","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}},"410":{"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}},"description":"Reference asset expired; upload the reference again."},"422":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"},{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}]}}},"description":"Validation Error","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}},"429":{"description":"Concurrent job limit (MAX_CONCURRENT_JOBS) or request rate limit (RATE_LIMITED) reached.","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"},{"properties":{"code":{"title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"}},"required":["code","detail"],"title":"ServiceUnavailableResponse","type":"object"}]}}},"description":"Feature disabled or service temporarily unavailable; try again later","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}}}} language 语言。语音合成和音频编排仅在 model 为 indextts-2.5 时使用,且必须提供,取值为 ZH、EN 或 JA;音色设计使用其配置接口允许的语言代码。 quote_version 报价响应中的 rate_version。费率变化后提交会被拒绝,需重新报价。 ```curl curl -X POST 'https://shixux.com/api/v1/voice-designs' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"name":"沉稳旁白","description":"低沉温暖的中年男性声音,语速自然,普通话清晰。","preview_text":"你好,今天的故事就从这里开始,让我们一起走进远方的山谷。","language":"zh","quote_version":1}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/voice-designs", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "your-unique-business-action-id" }, body: JSON.stringify({ "name": "沉稳旁白", "description": "低沉温暖的中年男性声音,语速自然,普通话清晰。", "preview_text": "你好,今天的故事就从这里开始,让我们一起走进远方的山谷。", "language": "zh", "quote_version": 1 }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/voice-designs", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json","Idempotency-Key":"your-unique-business-action-id"}, data="{\"name\":\"沉稳旁白\",\"description\":\"低沉温暖的中年男性声音,语速自然,普通话清晰。\",\"preview_text\":\"你好,今天的故事就从这里开始,让我们一起走进远方的山谷。\",\"language\":\"zh\",\"quote_version\":1}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/voice-designs", strings.NewReader("{\"name\":\"沉稳旁白\",\"description\":\"低沉温暖的中年男性声音,语速自然,普通话清晰。\",\"preview_text\":\"你好,今天的故事就从这里开始,让我们一起走进远方的山谷。\",\"language\":\"zh\",\"quote_version\":1}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", "your-unique-business-action-id") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Preview a voice asset URL: https://docs.shixux.com/en/audio/api/voices/asset-playback/ Get a short-lived preview URL for a voice in your account. This endpoint accepts console login credentials only. GET /voice-assets/{asset_id}/playback {"parameters":[{"in":"path","name":"asset_id","required":true,"schema":{"title":"Asset Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"url":{"title":"Url","type":"string"},"expires_in":{"title":"Expires In","type":"integer"}},"required":["url","expires_in"],"title":"VoiceAssetPlaybackResponse","type":"object"}}},"description":"Successful Response"},"404":{"description":"Voice asset not found","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Voice asset expired","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}}}} ```curl curl -X GET 'https://shixux.com/api/voice-assets/asset_id_example/playback' \ -H 'Authorization: Bearer login_credential_placeholder' ``` ```javascript const response = await fetch("https://shixux.com/api/voice-assets/asset_id_example/playback", { method: "GET", headers: { "Authorization": "Bearer login_credential_placeholder" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/voice-assets/asset_id_example/playback", method="GET", headers={"Authorization":"Bearer login_credential_placeholder"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/voice-assets/asset_id_example/playback", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer login_credential_placeholder") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 试听我的音色 URL: https://docs.shixux.com/zh/audio/api/voices/asset-playback/ 获取当前账号音色的短时试听地址。此接口只接受控制台登录凭证。 GET /voice-assets/{asset_id}/playback {"parameters":[{"in":"path","name":"asset_id","required":true,"schema":{"title":"Asset Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"url":{"title":"Url","type":"string"},"expires_in":{"title":"Expires In","type":"integer"}},"required":["url","expires_in"],"title":"VoiceAssetPlaybackResponse","type":"object"}}},"description":"Successful Response"},"404":{"description":"Voice asset not found","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Voice asset expired","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}}}} ```curl curl -X GET 'https://shixux.com/api/voice-assets/asset_id_example/playback' \ -H 'Authorization: Bearer login_credential_placeholder' ``` ```javascript const response = await fetch("https://shixux.com/api/voice-assets/asset_id_example/playback", { method: "GET", headers: { "Authorization": "Bearer login_credential_placeholder" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/voice-assets/asset_id_example/playback", method="GET", headers={"Authorization":"Bearer login_credential_placeholder"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/voice-assets/asset_id_example/playback", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer login_credential_placeholder") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Retrieve a voice asset URL: https://docs.shixux.com/en/audio/api/voices/asset/ Retrieve one voice of your account. This endpoint accepts console login credentials only. GET /voice-assets/{asset_id} {"parameters":[{"in":"path","name":"asset_id","required":true,"schema":{"title":"Asset Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"id":{"title":"Id","type":"string"},"display_name":{"title":"Display Name","type":"string"},"original_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Filename"},"size_bytes":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}],"title":"Size Bytes"},"uploaded_at":{"format":"date-time","title":"Uploaded At","type":"string"},"retained_until":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"description":"Media retention deadline, or null for permanent retention. Signed URL lifetime is independent."},"permanent":{"type":"boolean"},"source":{"type":"string","enum":["uploaded","designed","preset"]},"preset_id":{"type":"string","description":"ID of the preset voice this voice comes from, when applicable."},"description":{"type":"string"},"duration_seconds":{"type":"number"}},"required":["id","display_name","original_filename","size_bytes","uploaded_at","retained_until"],"title":"VoiceAssetRecord","type":"object"}}},"description":"Successful Response"},"404":{"description":"Voice asset not found","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Voice asset expired","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}}}} size_bytes Actual file size in bytes. Voice references, emotion references and images: up to 20 MiB; reference videos: up to 50 MiB; video reference audio: up to 15 MiB; other audio: up to 100 MiB. retained_until When the asset or result file stops being retained. Request a new download URL after one expires. ```curl curl -X GET 'https://shixux.com/api/voice-assets/asset_id_example' \ -H 'Authorization: Bearer login_credential_placeholder' ``` ```javascript const response = await fetch("https://shixux.com/api/voice-assets/asset_id_example", { method: "GET", headers: { "Authorization": "Bearer login_credential_placeholder" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/voice-assets/asset_id_example", method="GET", headers={"Authorization":"Bearer login_credential_placeholder"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/voice-assets/asset_id_example", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer login_credential_placeholder") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 查询音色资产 URL: https://docs.shixux.com/zh/audio/api/voices/asset/ 查询当前账号的一个音色。此接口只接受控制台登录凭证。 GET /voice-assets/{asset_id} {"parameters":[{"in":"path","name":"asset_id","required":true,"schema":{"title":"Asset Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"id":{"title":"Id","type":"string"},"display_name":{"title":"Display Name","type":"string"},"original_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Filename"},"size_bytes":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}],"title":"Size Bytes"},"uploaded_at":{"format":"date-time","title":"Uploaded At","type":"string"},"retained_until":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"description":"Media retention deadline, or null for permanent retention. Signed URL lifetime is independent."},"permanent":{"type":"boolean"},"source":{"type":"string","enum":["uploaded","designed","preset"]},"preset_id":{"type":"string","description":"ID of the preset voice this voice comes from, when applicable."},"description":{"type":"string"},"duration_seconds":{"type":"number"}},"required":["id","display_name","original_filename","size_bytes","uploaded_at","retained_until"],"title":"VoiceAssetRecord","type":"object"}}},"description":"Successful Response"},"404":{"description":"Voice asset not found","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Voice asset expired","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}}}} size_bytes 文件的实际字节数。声音参考、情绪参考和图片最大 20 MiB,参考视频最大 50 MiB,视频参考音频最大 15 MiB,其他音频最大 100 MiB。 retained_until 素材或结果文件的保留截止时间。下载地址过期后可重新获取。 ```curl curl -X GET 'https://shixux.com/api/voice-assets/asset_id_example' \ -H 'Authorization: Bearer login_credential_placeholder' ``` ```javascript const response = await fetch("https://shixux.com/api/voice-assets/asset_id_example", { method: "GET", headers: { "Authorization": "Bearer login_credential_placeholder" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/voice-assets/asset_id_example", method="GET", headers={"Authorization":"Bearer login_credential_placeholder"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/voice-assets/asset_id_example", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer login_credential_placeholder") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # List voice assets URL: https://docs.shixux.com/en/audio/api/voices/assets/ List the voices saved or uploaded by your account. This endpoint accepts console login credentials only, not API Keys. GET /voice-assets {"parameters":[{"in":"query","name":"search","schema":{"maxLength":100,"title":"Search","type":"string"}},{"in":"query","name":"limit","schema":{"default":18,"maximum":100,"minimum":1,"title":"Limit","type":"integer"}},{"in":"query","name":"offset","schema":{"default":0,"minimum":0,"title":"Offset","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"items":{"items":{"properties":{"id":{"title":"Id","type":"string"},"display_name":{"title":"Display Name","type":"string"},"original_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Filename"},"size_bytes":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}],"title":"Size Bytes"},"uploaded_at":{"format":"date-time","title":"Uploaded At","type":"string"},"retained_until":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"description":"Media retention deadline, or null for permanent retention. Signed URL lifetime is independent."},"permanent":{"type":"boolean"},"source":{"type":"string","enum":["uploaded","designed","preset"]},"preset_id":{"type":"string","description":"ID of the preset voice this voice comes from, when applicable."},"description":{"type":"string"},"duration_seconds":{"type":"number"}},"required":["id","display_name","original_filename","size_bytes","uploaded_at","retained_until"],"title":"VoiceAssetRecord","type":"object"},"title":"Items","type":"array"},"total":{"title":"Total","type":"integer"},"limit":{"title":"Limit","type":"integer"},"offset":{"title":"Offset","type":"integer"}},"required":["items","total","limit","offset"],"title":"VoiceAssetListResponse","type":"object"}}},"description":"Successful Response"},"422":{"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}}}}} size_bytes Actual file size in bytes. Voice references, emotion references and images: up to 20 MiB; reference videos: up to 50 MiB; video reference audio: up to 15 MiB; other audio: up to 100 MiB. retained_until When the asset or result file stops being retained. Request a new download URL after one expires. ```curl curl -X GET 'https://shixux.com/api/voice-assets' \ -H 'Authorization: Bearer login_credential_placeholder' ``` ```javascript const response = await fetch("https://shixux.com/api/voice-assets", { method: "GET", headers: { "Authorization": "Bearer login_credential_placeholder" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/voice-assets", method="GET", headers={"Authorization":"Bearer login_credential_placeholder"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/voice-assets", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer login_credential_placeholder") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 列出我的音色 URL: https://docs.shixux.com/zh/audio/api/voices/assets/ 列出当前账号已保存和已上传的音色。此接口只接受控制台登录凭证,不接受 API Key。 GET /voice-assets {"parameters":[{"in":"query","name":"search","schema":{"maxLength":100,"title":"Search","type":"string"}},{"in":"query","name":"limit","schema":{"default":18,"maximum":100,"minimum":1,"title":"Limit","type":"integer"}},{"in":"query","name":"offset","schema":{"default":0,"minimum":0,"title":"Offset","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"items":{"items":{"properties":{"id":{"title":"Id","type":"string"},"display_name":{"title":"Display Name","type":"string"},"original_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Filename"},"size_bytes":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}],"title":"Size Bytes"},"uploaded_at":{"format":"date-time","title":"Uploaded At","type":"string"},"retained_until":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"description":"Media retention deadline, or null for permanent retention. Signed URL lifetime is independent."},"permanent":{"type":"boolean"},"source":{"type":"string","enum":["uploaded","designed","preset"]},"preset_id":{"type":"string","description":"ID of the preset voice this voice comes from, when applicable."},"description":{"type":"string"},"duration_seconds":{"type":"number"}},"required":["id","display_name","original_filename","size_bytes","uploaded_at","retained_until"],"title":"VoiceAssetRecord","type":"object"},"title":"Items","type":"array"},"total":{"title":"Total","type":"integer"},"limit":{"title":"Limit","type":"integer"},"offset":{"title":"Offset","type":"integer"}},"required":["items","total","limit","offset"],"title":"VoiceAssetListResponse","type":"object"}}},"description":"Successful Response"},"422":{"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}}}}} size_bytes 文件的实际字节数。声音参考、情绪参考和图片最大 20 MiB,参考视频最大 50 MiB,视频参考音频最大 15 MiB,其他音频最大 100 MiB。 retained_until 素材或结果文件的保留截止时间。下载地址过期后可重新获取。 ```curl curl -X GET 'https://shixux.com/api/voice-assets' \ -H 'Authorization: Bearer login_credential_placeholder' ``` ```javascript const response = await fetch("https://shixux.com/api/voice-assets", { method: "GET", headers: { "Authorization": "Bearer login_credential_placeholder" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/voice-assets", method="GET", headers={"Authorization":"Bearer login_credential_placeholder"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/voice-assets", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer login_credential_placeholder") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Delete a voice asset URL: https://docs.shixux.com/en/audio/api/voices/delete/ Delete a voice from your account. A deleted voice can no longer be used for new generation jobs; a voice in use returns 409. This endpoint accepts console login credentials only. DELETE /voice-assets/{asset_id} {"parameters":[{"in":"path","name":"asset_id","required":true,"schema":{"title":"Asset Id","type":"string"}}],"responses":{"204":{"description":"Successful Response"},"404":{"description":"Voice asset not found","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"Voice asset is in use","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Voice asset expired","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}}}} ```curl curl -X DELETE 'https://shixux.com/api/voice-assets/asset_id_example' \ -H 'Authorization: Bearer login_credential_placeholder' ``` ```javascript const response = await fetch("https://shixux.com/api/voice-assets/asset_id_example", { method: "DELETE", headers: { "Authorization": "Bearer login_credential_placeholder" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/voice-assets/asset_id_example", method="DELETE", headers={"Authorization":"Bearer login_credential_placeholder"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("DELETE", "https://shixux.com/api/voice-assets/asset_id_example", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer login_credential_placeholder") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 删除音色 URL: https://docs.shixux.com/zh/audio/api/voices/delete/ 删除当前账号的音色。删除后该音色不能用于新的生成任务;音色正在使用时返回 409。此接口只接受控制台登录凭证。 DELETE /voice-assets/{asset_id} {"parameters":[{"in":"path","name":"asset_id","required":true,"schema":{"title":"Asset Id","type":"string"}}],"responses":{"204":{"description":"Successful Response"},"404":{"description":"Voice asset not found","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"Voice asset is in use","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Voice asset expired","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}}}} ```curl curl -X DELETE 'https://shixux.com/api/voice-assets/asset_id_example' \ -H 'Authorization: Bearer login_credential_placeholder' ``` ```javascript const response = await fetch("https://shixux.com/api/voice-assets/asset_id_example", { method: "DELETE", headers: { "Authorization": "Bearer login_credential_placeholder" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/voice-assets/asset_id_example", method="DELETE", headers={"Authorization":"Bearer login_credential_placeholder"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("DELETE", "https://shixux.com/api/voice-assets/asset_id_example", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer login_credential_placeholder") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Get a preset voice icon URL: https://docs.shixux.com/en/audio/api/voices/preset-icon/ Redirect to the icon image of a preset voice. No authentication is required. GET /voice-presets/{preset_id}/icon {"parameters":[{"in":"path","name":"preset_id","required":true,"schema":{"pattern":"^vp_[a-f0-9]{24}$","type":"string"}}],"responses":{"302":{"description":"Redirect to a 96px WebP thumbnail URL that is valid for 15 minutes","headers":{"Location":{"description":"Temporary thumbnail URL","schema":{"type":"string","format":"uri"}},"Cache-Control":{"schema":{"type":"string"}}}},"404":{"description":"Voice preset icon not found","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}}},"503":{"description":"Voice preset icon temporarily unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}}}} ```curl curl -X GET 'https://shixux.com/api/voice-presets/preset_id_example/icon' ``` ```javascript const response = await fetch("https://shixux.com/api/voice-presets/preset_id_example/icon", { method: "GET", headers: {}, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/voice-presets/preset_id_example/icon", method="GET", headers={}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/voice-presets/preset_id_example/icon", nil) if err != nil { panic(err) } resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 获取预置音色图标 URL: https://docs.shixux.com/zh/audio/api/voices/preset-icon/ 重定向到预置音色的图标图片。无需认证。 GET /voice-presets/{preset_id}/icon {"parameters":[{"in":"path","name":"preset_id","required":true,"schema":{"pattern":"^vp_[a-f0-9]{24}$","type":"string"}}],"responses":{"302":{"description":"Redirect to a 96px WebP thumbnail URL that is valid for 15 minutes","headers":{"Location":{"description":"Temporary thumbnail URL","schema":{"type":"string","format":"uri"}},"Cache-Control":{"schema":{"type":"string"}}}},"404":{"description":"Voice preset icon not found","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}}},"503":{"description":"Voice preset icon temporarily unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}}}} ```curl curl -X GET 'https://shixux.com/api/voice-presets/preset_id_example/icon' ``` ```javascript const response = await fetch("https://shixux.com/api/voice-presets/preset_id_example/icon", { method: "GET", headers: {}, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/voice-presets/preset_id_example/icon", method="GET", headers={}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/voice-presets/preset_id_example/icon", nil) if err != nil { panic(err) } resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Preview a preset voice URL: https://docs.shixux.com/en/audio/api/voices/preset-playback/ Get a preview audio URL for a preset voice. Previews do not create generation jobs and are free. GET /voice-presets/{preset_id}/playback {"parameters":[{"in":"path","name":"preset_id","required":true,"schema":{"pattern":"^vp_[a-f0-9]{24}$","title":"Preset Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"url":{"title":"Url","type":"string"},"expires_in":{"title":"Expires In","type":"integer"}},"required":["url","expires_in"],"title":"VoiceAssetPlaybackResponse","type":"object"}}},"description":"Successful Response"},"404":{"description":"Voice preset not found","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}}},"503":{"description":"Voice preset audio temporarily unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}}}} ```curl curl -X GET 'https://shixux.com/api/voice-presets/preset_id_example/playback' ``` ```javascript const response = await fetch("https://shixux.com/api/voice-presets/preset_id_example/playback", { method: "GET", headers: {}, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/voice-presets/preset_id_example/playback", method="GET", headers={}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/voice-presets/preset_id_example/playback", nil) if err != nil { panic(err) } resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 试听预置音色 URL: https://docs.shixux.com/zh/audio/api/voices/preset-playback/ 获取预置音色的试听音频地址。试听不会创建生成任务,也不收费。 GET /voice-presets/{preset_id}/playback {"parameters":[{"in":"path","name":"preset_id","required":true,"schema":{"pattern":"^vp_[a-f0-9]{24}$","title":"Preset Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"url":{"title":"Url","type":"string"},"expires_in":{"title":"Expires In","type":"integer"}},"required":["url","expires_in"],"title":"VoiceAssetPlaybackResponse","type":"object"}}},"description":"Successful Response"},"404":{"description":"Voice preset not found","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}}},"503":{"description":"Voice preset audio temporarily unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}}}} ```curl curl -X GET 'https://shixux.com/api/voice-presets/preset_id_example/playback' ``` ```javascript const response = await fetch("https://shixux.com/api/voice-presets/preset_id_example/playback", { method: "GET", headers: {}, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/voice-presets/preset_id_example/playback", method="GET", headers={}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/voice-presets/preset_id_example/playback", nil) if err != nil { panic(err) } resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Use a preset voice URL: https://docs.shixux.com/en/audio/api/voices/preset-use/ Return the voice asset for a preset voice in your account, which generation requests can reference through voice_asset_id. Repeated calls for the same preset version return the same voice asset at no charge. POST /voice-presets/{preset_id}/use {"parameters":[{"in":"path","name":"preset_id","required":true,"schema":{"type":"string","pattern":"^vp_[a-f0-9]{24}$"}}],"responses":{"200":{"description":"Voice sample ready for use","content":{"application/json":{"schema":{"properties":{"id":{"title":"Id","type":"string"},"display_name":{"title":"Display Name","type":"string"},"original_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Filename"},"size_bytes":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}],"title":"Size Bytes"},"uploaded_at":{"format":"date-time","title":"Uploaded At","type":"string"},"retained_until":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"description":"Media retention deadline, or null for permanent retention. Signed URL lifetime is independent."},"permanent":{"type":"boolean"},"source":{"type":"string","enum":["uploaded","designed","preset"]},"preset_id":{"type":"string","description":"ID of the preset voice this voice comes from, when applicable."},"description":{"type":"string"},"duration_seconds":{"type":"number"}},"required":["id","display_name","original_filename","size_bytes","uploaded_at","retained_until"],"title":"VoiceAssetRecord","type":"object"}}}},"401":{"description":"Authentication required","headers":{}},"404":{"description":"Voice preset not found"},"409":{"description":"Credentials do not match the account"},"410":{"description":"Voice asset preparation expired; call this endpoint again"},"422":{"description":"Invalid voice preset identifier"},"503":{"description":"Service temporarily unavailable; try again later"}}} size_bytes Actual file size in bytes. Voice references, emotion references and images: up to 20 MiB; reference videos: up to 50 MiB; video reference audio: up to 15 MiB; other audio: up to 100 MiB. retained_until When the asset or result file stops being retained. Request a new download URL after one expires. ```curl curl -X POST 'https://shixux.com/api/voice-presets/preset_id_example/use' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/voice-presets/preset_id_example/use", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/voice-presets/preset_id_example/use", method="POST", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/voice-presets/preset_id_example/use", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 选用预置音色 URL: https://docs.shixux.com/zh/audio/api/voices/preset-use/ 返回预置音色在当前账号下对应的音色资产,可在生成请求中通过 voice_asset_id 引用。同一预置音色版本重复调用返回同一音色资产,不收费。 POST /voice-presets/{preset_id}/use {"parameters":[{"in":"path","name":"preset_id","required":true,"schema":{"type":"string","pattern":"^vp_[a-f0-9]{24}$"}}],"responses":{"200":{"description":"Voice sample ready for use","content":{"application/json":{"schema":{"properties":{"id":{"title":"Id","type":"string"},"display_name":{"title":"Display Name","type":"string"},"original_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Filename"},"size_bytes":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}],"title":"Size Bytes"},"uploaded_at":{"format":"date-time","title":"Uploaded At","type":"string"},"retained_until":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"description":"Media retention deadline, or null for permanent retention. Signed URL lifetime is independent."},"permanent":{"type":"boolean"},"source":{"type":"string","enum":["uploaded","designed","preset"]},"preset_id":{"type":"string","description":"ID of the preset voice this voice comes from, when applicable."},"description":{"type":"string"},"duration_seconds":{"type":"number"}},"required":["id","display_name","original_filename","size_bytes","uploaded_at","retained_until"],"title":"VoiceAssetRecord","type":"object"}}}},"401":{"description":"Authentication required","headers":{}},"404":{"description":"Voice preset not found"},"409":{"description":"Credentials do not match the account"},"410":{"description":"Voice asset preparation expired; call this endpoint again"},"422":{"description":"Invalid voice preset identifier"},"503":{"description":"Service temporarily unavailable; try again later"}}} size_bytes 文件的实际字节数。声音参考、情绪参考和图片最大 20 MiB,参考视频最大 50 MiB,视频参考音频最大 15 MiB,其他音频最大 100 MiB。 retained_until 素材或结果文件的保留截止时间。下载地址过期后可重新获取。 ```curl curl -X POST 'https://shixux.com/api/voice-presets/preset_id_example/use' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/voice-presets/preset_id_example/use", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/voice-presets/preset_id_example/use", method="POST", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/voice-presets/preset_id_example/use", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # List preset voices URL: https://docs.shixux.com/en/audio/api/voices/presets/ List the available preset voices with their IDs, names and preview information. No authentication is required. Use a voice ID as voice_preset_id for speech synthesis. GET /voice-presets {"parameters":[{"in":"query","name":"search","schema":{"maxLength":100,"title":"Search","type":"string"}},{"in":"query","name":"language","schema":{"maxLength":40,"title":"Language","type":"string"}},{"in":"query","name":"limit","schema":{"default":100,"maximum":500,"minimum":1,"title":"Limit","type":"integer"}},{"in":"query","name":"offset","schema":{"default":0,"minimum":0,"title":"Offset","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"catalog_version":{"title":"Catalog Version","type":"string"},"generated_at":{"format":"date-time","title":"Generated At","type":"string"},"items":{"items":{"properties":{"icon_url":{"description":"Icon path relative to the API Base URL. Requesting it redirects to a temporary thumbnail URL, so it can be loaded lazily.","type":"string"},"id":{"title":"Id","type":"string","pattern":"^vp_[a-f0-9]{24}$"},"display_name":{"title":"Display Name","type":"string"},"language":{"title":"Language","type":"string"},"locale":{"title":"Locale","type":"string"},"duration_ms":{"title":"Duration Ms","type":"integer","minimum":1},"size_bytes":{"title":"Size Bytes","type":"integer","minimum":1},"usage_count":{"description":"Number of speech synthesis jobs completed successfully with this preset.","minimum":0,"title":"Usage Count","type":"integer"}},"required":["id","display_name","language","locale","duration_ms","size_bytes","usage_count"],"title":"VoicePresetRecord","type":"object"},"title":"Items","type":"array"},"total":{"title":"Total","type":"integer"},"limit":{"title":"Limit","type":"integer"},"offset":{"title":"Offset","type":"integer"}},"required":["catalog_version","generated_at","items","total","limit","offset"],"title":"VoicePresetListResponse","type":"object"}}},"description":"Successful Response"},"422":{"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}}},"503":{"description":"Voice preset catalog unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}}}} language Language. Speech synthesis and audio composition use it only with model indextts-2.5, where it is required and must be ZH, EN or JA. Voice design uses the language codes its configuration allows. size_bytes Actual file size in bytes. Voice references, emotion references and images: up to 20 MiB; reference videos: up to 50 MiB; video reference audio: up to 15 MiB; other audio: up to 100 MiB. ```curl curl -X GET 'https://shixux.com/api/voice-presets' ``` ```javascript const response = await fetch("https://shixux.com/api/voice-presets", { method: "GET", headers: {}, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/voice-presets", method="GET", headers={}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/voice-presets", nil) if err != nil { panic(err) } resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 列出预置音色 URL: https://docs.shixux.com/zh/audio/api/voices/presets/ 列出可用的预置音色,包括音色 ID、名称和试听信息。无需认证。将音色 ID 作为 voice_preset_id 用于语音合成。 GET /voice-presets {"parameters":[{"in":"query","name":"search","schema":{"maxLength":100,"title":"Search","type":"string"}},{"in":"query","name":"language","schema":{"maxLength":40,"title":"Language","type":"string"}},{"in":"query","name":"limit","schema":{"default":100,"maximum":500,"minimum":1,"title":"Limit","type":"integer"}},{"in":"query","name":"offset","schema":{"default":0,"minimum":0,"title":"Offset","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"catalog_version":{"title":"Catalog Version","type":"string"},"generated_at":{"format":"date-time","title":"Generated At","type":"string"},"items":{"items":{"properties":{"icon_url":{"description":"Icon path relative to the API Base URL. Requesting it redirects to a temporary thumbnail URL, so it can be loaded lazily.","type":"string"},"id":{"title":"Id","type":"string","pattern":"^vp_[a-f0-9]{24}$"},"display_name":{"title":"Display Name","type":"string"},"language":{"title":"Language","type":"string"},"locale":{"title":"Locale","type":"string"},"duration_ms":{"title":"Duration Ms","type":"integer","minimum":1},"size_bytes":{"title":"Size Bytes","type":"integer","minimum":1},"usage_count":{"description":"Number of speech synthesis jobs completed successfully with this preset.","minimum":0,"title":"Usage Count","type":"integer"}},"required":["id","display_name","language","locale","duration_ms","size_bytes","usage_count"],"title":"VoicePresetRecord","type":"object"},"title":"Items","type":"array"},"total":{"title":"Total","type":"integer"},"limit":{"title":"Limit","type":"integer"},"offset":{"title":"Offset","type":"integer"}},"required":["catalog_version","generated_at","items","total","limit","offset"],"title":"VoicePresetListResponse","type":"object"}}},"description":"Successful Response"},"422":{"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}}},"503":{"description":"Voice preset catalog unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}}}} language 语言。语音合成和音频编排仅在 model 为 indextts-2.5 时使用,且必须提供,取值为 ZH、EN 或 JA;音色设计使用其配置接口允许的语言代码。 size_bytes 文件的实际字节数。声音参考、情绪参考和图片最大 20 MiB,参考视频最大 50 MiB,视频参考音频最大 15 MiB,其他音频最大 100 MiB。 ```curl curl -X GET 'https://shixux.com/api/voice-presets' ``` ```javascript const response = await fetch("https://shixux.com/api/voice-presets", { method: "GET", headers: {}, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/voice-presets", method="GET", headers={}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/voice-presets", nil) if err != nil { panic(err) } resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Rename a voice asset URL: https://docs.shixux.com/en/audio/api/voices/rename/ Change the display name of a voice in your account. This endpoint accepts console login credentials only. PATCH /voice-assets/{asset_id} {"requestBody":{"content":{"application/json":{"schema":{"properties":{"display_name":{"maxLength":80,"minLength":1,"title":"Display Name","type":"string"}},"required":["display_name"],"title":"RenameVoiceAssetRequest","type":"object"}}},"required":true},"parameters":[{"in":"path","name":"asset_id","required":true,"schema":{"title":"Asset Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"id":{"title":"Id","type":"string"},"display_name":{"title":"Display Name","type":"string"},"original_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Filename"},"size_bytes":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}],"title":"Size Bytes"},"uploaded_at":{"format":"date-time","title":"Uploaded At","type":"string"},"retained_until":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"description":"Media retention deadline, or null for permanent retention. Signed URL lifetime is independent."},"permanent":{"type":"boolean"},"source":{"type":"string","enum":["uploaded","designed","preset"]},"preset_id":{"type":"string","description":"ID of the preset voice this voice comes from, when applicable."},"description":{"type":"string"},"duration_seconds":{"type":"number"}},"required":["id","display_name","original_filename","size_bytes","uploaded_at","retained_until"],"title":"VoiceAssetRecord","type":"object"}}},"description":"Successful Response"},"404":{"description":"Voice asset not found","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Voice asset expired","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}}}}} size_bytes Actual file size in bytes. Voice references, emotion references and images: up to 20 MiB; reference videos: up to 50 MiB; video reference audio: up to 15 MiB; other audio: up to 100 MiB. retained_until When the asset or result file stops being retained. Request a new download URL after one expires. ```curl curl -X PATCH 'https://shixux.com/api/voice-assets/asset_id_example' \ -H 'Authorization: Bearer login_credential_placeholder' \ -H 'Content-Type: application/json' \ -d '{"display_name":"example"}' ``` ```javascript const response = await fetch("https://shixux.com/api/voice-assets/asset_id_example", { method: "PATCH", headers: { "Authorization": "Bearer login_credential_placeholder", "Content-Type": "application/json" }, body: JSON.stringify({ "display_name": "example" }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/voice-assets/asset_id_example", method="PATCH", headers={"Authorization":"Bearer login_credential_placeholder","Content-Type":"application/json"}, data="{\"display_name\":\"example\"}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("PATCH", "https://shixux.com/api/voice-assets/asset_id_example", strings.NewReader("{\"display_name\":\"example\"}")) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer login_credential_placeholder") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 重命名音色 URL: https://docs.shixux.com/zh/audio/api/voices/rename/ 修改当前账号音色的显示名称。此接口只接受控制台登录凭证。 PATCH /voice-assets/{asset_id} {"requestBody":{"content":{"application/json":{"schema":{"properties":{"display_name":{"maxLength":80,"minLength":1,"title":"Display Name","type":"string"}},"required":["display_name"],"title":"RenameVoiceAssetRequest","type":"object"}}},"required":true},"parameters":[{"in":"path","name":"asset_id","required":true,"schema":{"title":"Asset Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"id":{"title":"Id","type":"string"},"display_name":{"title":"Display Name","type":"string"},"original_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Filename"},"size_bytes":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}],"title":"Size Bytes"},"uploaded_at":{"format":"date-time","title":"Uploaded At","type":"string"},"retained_until":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"description":"Media retention deadline, or null for permanent retention. Signed URL lifetime is independent."},"permanent":{"type":"boolean"},"source":{"type":"string","enum":["uploaded","designed","preset"]},"preset_id":{"type":"string","description":"ID of the preset voice this voice comes from, when applicable."},"description":{"type":"string"},"duration_seconds":{"type":"number"}},"required":["id","display_name","original_filename","size_bytes","uploaded_at","retained_until"],"title":"VoiceAssetRecord","type":"object"}}},"description":"Successful Response"},"404":{"description":"Voice asset not found","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Voice asset expired","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}}}}} size_bytes 文件的实际字节数。声音参考、情绪参考和图片最大 20 MiB,参考视频最大 50 MiB,视频参考音频最大 15 MiB,其他音频最大 100 MiB。 retained_until 素材或结果文件的保留截止时间。下载地址过期后可重新获取。 ```curl curl -X PATCH 'https://shixux.com/api/voice-assets/asset_id_example' \ -H 'Authorization: Bearer login_credential_placeholder' \ -H 'Content-Type: application/json' \ -d '{"display_name":"example"}' ``` ```javascript const response = await fetch("https://shixux.com/api/voice-assets/asset_id_example", { method: "PATCH", headers: { "Authorization": "Bearer login_credential_placeholder", "Content-Type": "application/json" }, body: JSON.stringify({ "display_name": "example" }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/voice-assets/asset_id_example", method="PATCH", headers={"Authorization":"Bearer login_credential_placeholder","Content-Type":"application/json"}, data="{\"display_name\":\"example\"}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("PATCH", "https://shixux.com/api/voice-assets/asset_id_example", strings.NewReader("{\"display_name\":\"example\"}")) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer login_credential_placeholder") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Audio guide URL: https://docs.shixux.com/en/audio/guide/ ## Integration steps 1. [Get an API Key](https://docs.shixux.com/en/getting-started/keys/). See [Authentication](https://docs.shixux.com/en/common/authentication/) for how to send it. 2. Choose a voice: use a [preset voice](https://docs.shixux.com/en/audio/api/voices/presets/), or upload your own voice reference by following [Uploads](https://docs.shixux.com/en/common/uploads/). 3. Submit a job: speech synthesis, audio composition and voice design are asynchronous jobs that return `202` with a job ID. Send a unique `Idempotency-Key` with every generation request. 4. Learn when the job ends through [Retrieve a job](https://docs.shixux.com/en/common/api/jobs/retrieve/) or a [webhook](https://docs.shixux.com/en/common/webhooks/), then call [Retrieve a job result](https://docs.shixux.com/en/common/api/jobs/result/) for the download URL. For a comparison of the three capabilities' endpoints, inputs and billing, see [Audio model overview](https://docs.shixux.com/en/audio/). ## Speech synthesis Call [POST /v1/tts](https://docs.shixux.com/en/audio/api/tts/). Select a speech model with `model`, then specify a voice and optional emotion control. ### Choose a model | `model` | Best for | Required fields | Text limit | | --- | --- | --- | --- | | `indextts-2` (default) | Fine emotion control with reference audio or an eight-dimensional vector | `text`, one voice | 2048 characters | | `indextts-2.5` | Chinese, English or Japanese voice-over, speed control, emotion described in words | `text`, `language` (`ZH`, `EN` or `JA`) | 2000 characters, including at least one letter or digit | `model` defaults to `indextts-2`. `language`, `speed` and `emo_text` can only be used with `indextts-2.5`; `emo_asset_id`, `emo_ref_key`, `emo_vector` and `emo_alpha` can only be used with `indextts-2`. An unsupported model or field combination returns `422`. ### Choose a voice The voice fields below are mutually exclusive; use at most one per request. `indextts-2` requires a voice. `indextts-2.5` uses a default voice when none is given, but we recommend specifying one. | Field | Where the value comes from | | --- | --- | | `voice_preset_id` | A voice ID from the [preset voice catalog](https://docs.shixux.com/en/audio/api/voices/presets/) | | `voice_asset_id` | A voice asset ID of your account: a voice reference [uploaded](https://docs.shixux.com/en/common/uploads/) and confirmed with `purpose: "voice_reference"`, or a saved [designed voice](#voice-design) | | `voice_ref_key` | A voice reference value. For voice references registered through the upload endpoints, use `voice_asset_id` | Voice references must be WAV files of up to 20 MiB. When `indextts-2.5` uses an uploaded voice reference, the recording must be 0.5–15 seconds long. Only unexpired assets of your own account can be referenced. Make sure you have the right to use any voice you upload. You can send `rights_confirmed: true` when uploading to record your confirmation, but this does not replace obtaining permission. The [voice asset endpoints](https://docs.shixux.com/en/audio/api/voices/assets/) for listing, renaming, deleting and previewing saved voices accept only console login credentials. With an API Key, reference your own voices directly in generation requests through `voice_asset_id`. ### Emotion control By default the emotion follows the voice itself. To adjust it, use the method for your model below. See the [speech synthesis endpoint](https://docs.shixux.com/en/audio/api/tts/) for field types and value ranges. **`indextts-2`**: use either emotion reference audio or an emotion vector. | Method | Field | Description | | --- | --- | --- | | Emotion reference audio | `emo_asset_id` or `emo_ref_key` | A WAV of up to 20 MiB uploaded and confirmed with `purpose: "emotion_reference"`; pass its `asset_id` as `emo_asset_id`. The two fields are mutually exclusive | | Emotion vector | `emo_vector` | Eight weights in a fixed order, each 0–1.4; 0–1 is recommended | `emo_alpha` sets the overall strength of the emotion vector, from 0 to 1, default 1. `indextts-2` does not support emotion descriptions; `emo_text` returns `422`. The eight vector dimensions are, in order: happy, angry, sad, afraid, disgusted, melancholic, surprised and calm. For example, a calm tone: ```json {"text":"Hello from Shixu.","voice_preset_id":"vp_000000000000000000000001","emo_vector":[0,0,0,0,0,0,0,1]} ``` **`indextts-2.5`**: describe the emotion in one sentence with `emo_text`, up to 200 characters, such as "a lowered voice with a hint of a smile". When omitted, the model infers the emotion from the text. Adjust speed with `speed`, from 0.5 to 2, default 1. ```json {"model":"indextts-2.5","language":"EN","text":"Hello from Shixu.","speed":1.1,"emo_text":"Warm and relaxed, like chatting with a friend"} ``` ### Request examples With `indextts-2`: ```bash curl -X POST 'https://shixux.com/api/v1/tts' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: speech-001' \ -d '{"text":"Hello from Shixu.","voice_preset_id":"vp_000000000000000000000001","emo_vector":[0,0,0,0,0,0,0,1]}' ``` ```python import json import urllib.request body = {"text": "Hello from Shixu.", "voice_preset_id": "vp_000000000000000000000001"} request = urllib.request.Request( "https://shixux.com/api/v1/tts", method="POST", headers={"X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "speech-001"}, data=json.dumps(body).encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```js const response = await fetch("https://shixux.com/api/v1/tts", { method: "POST", headers: { "X-API-Key": process.env.YB_API_KEY, "Content-Type": "application/json", "Idempotency-Key": "speech-001", }, body: JSON.stringify({ text: "Hello from Shixu.", voice_preset_id: "vp_000000000000000000000001", }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.json()); ``` With `indextts-2.5`: ```bash curl -X POST 'https://shixux.com/api/v1/tts' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: speech-002' \ -d '{"model":"indextts-2.5","language":"EN","text":"Hello from Shixu.","voice_preset_id":"vp_000000000000000000000001","speed":1.1,"emo_text":"Warm and relaxed, like chatting with a friend"}' ``` To call `indextts-2.5` from Python or JavaScript, add the same `model`, `language` and optional `speed` and `emo_text` to the request body. ## Audio composition Audio composition mixes multiple speech lines, sound effects and music into one WAV file. Speech is generated from the script by the speech model. Sound effects and music use audio assets you upload (`purpose: "audio_material"`), which are trimmed, looped and mixed along the timeline. `model` applies to all speech segments and can be `indextts-2` (default) or `indextts-2.5`. With `indextts-2.5`, `language` is required and `speed` and `emo_text` are available. The default voice is set with `voice_preset_id` or `voice_asset_id`; `voice_ref_key`, emotion reference audio and emotion vectors are not supported. ### Write the timeline `prompt_document` is a structured document with version `1`, made of `text` parts and `reference` parts. `text` parts carry the script and timeline text, and `reference` parts refer to a voice or audio asset by `reference_id` and `label`. The timeline text uses this format: ```text [00:00] Alex: Welcome back. [00:03.250] Sam: Let's start recording. 音效 [00:05–00:08] @Footsteps 配乐 [00:00–00:12] @Background music ``` - A speech line starts with its start time; its end is determined by the length of the generated audio. - Sound effect and music lines start with `音效` (sound effect) or `配乐` (music), must give a full time range and reference one audio asset after the range. - Each line may contain only one start time or one time range. - A composition may have up to 64 segments, up to 5000 characters of script in total and a timeline of up to 10 minutes. When `prompt_document` is omitted, `text` is parsed as a simple timeline of speech lines that use the default voice from the request. ### Quote and submit Call [Quote an audio composition](https://docs.shixux.com/en/audio/api/audio-composition-quote/) first. `credits` in the response is the estimated charge and `segments` is the number of speech segments; quoting does not create a job. Then submit the same body to [Create an audio composition](https://docs.shixux.com/en/audio/api/audio-composition/). ```bash curl -X POST 'https://shixux.com/api/v1/audio/compositions/quote' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"text":"[00:00] Welcome back.","prompt_document":{"version":1,"parts":[{"type":"text","text":"[00:00] Welcome back."}]},"voice_preset_id":"vp_000000000000000000000001"}' ``` Creating an audio composition requires an `Idempotency-Key`; keep it unchanged when retrying. If a composition fails or is stopped, call [Resume an audio composition](https://docs.shixux.com/en/audio/api/audio-composition-retry/) to continue. Completed speech segments are reused rather than generated again. ## Voice design Voice design generates a new voice from a text description, without uploading recordings. 1. Call [Get voice design configuration](https://docs.shixux.com/en/audio/api/voice-design-config/) to check availability and read the rate per generation and its version `billing.version`. 2. Call [Design a voice from a description](https://docs.shixux.com/en/audio/api/voice-design/) with `name` (1–80 characters), `description` (1–500 characters), `preview_text` (15–200 characters), `language` and `quote_version`. The configuration's `languages` field lists the available languages from `zh`, `en`, `ja` and `ko`. 3. When the job succeeds, listen to the result. If you are satisfied, call [Save a designed voice](https://docs.shixux.com/en/audio/api/voice-design-save/) to add it to your account's voice library. Saving the same candidate again is not charged again. 4. After saving, use the returned voice ID as `voice_asset_id` for speech synthesis. ## Jobs, results and errors Audio job states are `queued`, `processing`, `succeeded`, `failed` and `cancelled`. After success, call [Retrieve a job result](https://docs.shixux.com/en/common/api/jobs/result/) for the download URL, and call it again for a new URL after it expires. Common submission errors: - `422`: unsupported `model`, missing `language`, or a field the selected model does not support. - `402`: not enough credits. - `409`: the idempotency key was already used for a different request. - `503`: the selected model is temporarily unavailable; retry later with the same idempotency key. For more rules, see [Uploads](https://docs.shixux.com/en/common/uploads/), [Webhooks](https://docs.shixux.com/en/common/webhooks/), [Asynchronous jobs](https://docs.shixux.com/en/common/jobs/) and [Billing and credits](https://docs.shixux.com/en/operations/billing/). --- # 音频接入指南 URL: https://docs.shixux.com/zh/audio/guide/ ## 接入流程 1. [获取 API Key](https://docs.shixux.com/zh/getting-started/keys/),认证方式见[认证](https://docs.shixux.com/zh/common/authentication/)。 2. 选择音色:使用[预置音色](https://docs.shixux.com/zh/audio/api/voices/presets/),或按[素材上传](https://docs.shixux.com/zh/common/uploads/)流程上传自己的声音参考。 3. 提交任务:语音合成、音频编排和音色设计均为异步任务,返回 `202` 和任务 ID。建议为每个生成请求携带唯一的 `Idempotency-Key`。 4. 通过[查询任务](https://docs.shixux.com/zh/common/api/jobs/retrieve/)或 [Webhook](https://docs.shixux.com/zh/common/webhooks/) 获知任务结束,成功后调用[获取任务结果](https://docs.shixux.com/zh/common/api/jobs/result/)取得下载地址。 三种能力的接口、输入和计费对比见[音频模型总览](https://docs.shixux.com/zh/audio/)。 ## 语音合成 调用 [POST /v1/tts](https://docs.shixux.com/zh/audio/api/tts/),通过 `model` 选择语音模型,并指定音色和可选的情绪控制。 ### 选择模型 | `model` | 适用场景 | 必填字段 | 文本上限 | | --- | --- | --- | --- | | `indextts-2`(默认) | 用情绪参考音频或八维向量精细控制情绪 | `text`、一个音色 | 2048 个字符 | | `indextts-2.5` | 中、英、日配音,调节语速,用文字描述情绪 | `text`、`language`(`ZH`、`EN` 或 `JA`) | 2000 个字符,须包含文字或数字 | 省略 `model` 时使用 `indextts-2`。`language`、`speed` 和 `emo_text` 只能与 `indextts-2.5` 一起使用;`emo_asset_id`、`emo_ref_key`、`emo_vector` 和 `emo_alpha` 只能与 `indextts-2` 一起使用。传入不支持的模型或字段组合时返回 `422`。 ### 选择音色 以下音色字段互斥,每次请求最多使用一个。`indextts-2` 必须指定音色;`indextts-2.5` 省略时使用默认音色,建议显式指定。 | 字段 | 取值来源 | | --- | --- | | `voice_preset_id` | [预置音色目录](https://docs.shixux.com/zh/audio/api/voices/presets/)中的音色 ID | | `voice_asset_id` | 当前账号的音色资产 ID:以 `purpose: "voice_reference"` [上传](https://docs.shixux.com/zh/common/uploads/)并确认的声音参考,或已保存的[设计音色](#音色设计) | | `voice_ref_key` | 声音参考的引用值。通过上传接口登记的声音参考请使用 `voice_asset_id` | 声音参考须为 WAV 格式,最大 20 MiB。`indextts-2.5` 使用上传的声音参考时,录音时长须为 0.5–15 秒。只能引用当前账号且未过期的素材。 请确保你有权使用所上传的声音。上传时可传入 `rights_confirmed: true` 记录授权确认,但这不能替代实际取得授权。 列出、重命名、删除和试听已保存音色的[音色资产接口](https://docs.shixux.com/zh/audio/api/voices/assets/)只接受控制台登录凭证;使用 API Key 时,可以直接在生成请求中通过 `voice_asset_id` 引用自己的音色。 ### 情绪控制 默认情绪跟随音色本身。需要调整时,按所选模型使用以下方式;各字段的类型和取值范围见[语音合成接口](https://docs.shixux.com/zh/audio/api/tts/)。 **`indextts-2`**:情绪参考音频和情绪向量二选一。 | 方式 | 字段 | 说明 | | --- | --- | --- | | 情绪参考音频 | `emo_asset_id` 或 `emo_ref_key` | 以 `purpose: "emotion_reference"` 上传并确认的 WAV,最大 20 MiB,`emo_asset_id` 传入其 `asset_id`;两个字段互斥 | | 情绪向量 | `emo_vector` | 8 个权重,顺序固定,每项 0–1.4,建议取 0–1 | `emo_alpha` 用于调整情绪向量的整体强度,范围 0–1,默认 1。`indextts-2` 不支持文字情绪描述,传入 `emo_text` 返回 `422`。 情绪向量的八个维度依次为:高兴、愤怒、悲伤、害怕、厌恶、忧郁、惊讶、平静。例如,平静的语气: ```json {"text":"你好,欢迎使用时序科技。","voice_preset_id":"vp_000000000000000000000001","emo_vector":[0,0,0,0,0,0,0,1]} ``` **`indextts-2.5`**:用 `emo_text` 以一句话描述情绪,最多 200 个字符,例如“压低声音,带着一点笑意”。省略时,模型根据文本内容自动判断情绪。语速通过 `speed` 调节,范围 0.5–2,默认 1。 ```json {"model":"indextts-2.5","language":"ZH","text":"你好,欢迎使用时序科技。","speed":1.1,"emo_text":"温和、放松,像在和朋友聊天"} ``` ### 请求示例 使用 `indextts-2`: ```bash curl -X POST 'https://shixux.com/api/v1/tts' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: speech-001' \ -d '{"text":"你好,欢迎使用时序科技。","voice_preset_id":"vp_000000000000000000000001","emo_vector":[0,0,0,0,0,0,0,1]}' ``` ```python import json import urllib.request body = {"text": "你好,欢迎使用时序科技。", "voice_preset_id": "vp_000000000000000000000001"} request = urllib.request.Request( "https://shixux.com/api/v1/tts", method="POST", headers={"X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "speech-001"}, data=json.dumps(body).encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```js const response = await fetch("https://shixux.com/api/v1/tts", { method: "POST", headers: { "X-API-Key": process.env.YB_API_KEY, "Content-Type": "application/json", "Idempotency-Key": "speech-001", }, body: JSON.stringify({ text: "你好,欢迎使用时序科技。", voice_preset_id: "vp_000000000000000000000001", }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.json()); ``` 使用 `indextts-2.5`: ```bash curl -X POST 'https://shixux.com/api/v1/tts' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: speech-002' \ -d '{"model":"indextts-2.5","language":"ZH","text":"你好,欢迎使用时序科技。","voice_preset_id":"vp_000000000000000000000001","speed":1.1,"emo_text":"温和、放松,像在和朋友聊天"}' ``` 在 Python 或 JavaScript 中调用 `indextts-2.5` 时,在请求体中加入相同的 `model`、`language` 以及可选的 `speed`、`emo_text` 即可。 ## 音频编排 音频编排将多段人声、音效和配乐混合为一个 WAV 文件。人声由语音模型根据台词生成,音效和配乐使用你上传的音频素材(`purpose: "audio_material"`),并按时间轴截取、循环和混音。 `model` 对全部人声片段生效,可选 `indextts-2`(默认)或 `indextts-2.5`。选择 `indextts-2.5` 时必须提供 `language`,可使用 `speed` 和 `emo_text`;默认音色通过 `voice_preset_id` 或 `voice_asset_id` 指定,不支持 `voice_ref_key`、情绪参考音频和情绪向量。 ### 编写时间轴 `prompt_document` 是版本为 `1` 的结构化文档,由 `text` 片段和 `reference` 片段组成:`text` 片段承载台词和时间轴文本,`reference` 片段通过 `reference_id` 和 `label` 引用音色或音频素材。时间轴文本的格式如下: ```text [00:00] 小明:欢迎回来。 [00:03.250] 小红:今天我们开始录音。 音效 [00:05–00:08] @脚步声 配乐 [00:00–00:12] @背景音乐 ``` - 人声行以开始时间开头,结束时间由实际生成的音频时长决定。 - 音效和配乐行以“音效”或“配乐”开头,必须指定完整的时间区间,并在区间后引用一个音频素材。 - 每行只能包含一个开始时间或一个时间区间。 - 每次编排最多 64 个片段,台词合计最多 5000 个字符,时间轴最长 10 分钟。 省略 `prompt_document` 时,会根据 `text` 解析仅包含台词的简单时间轴,并使用请求中的默认音色。 ### 报价与提交 建议先调用[查询音频编排报价](https://docs.shixux.com/zh/audio/api/audio-composition-quote/),响应中的 `credits` 为预计消耗的积分,`segments` 为人声片段数,报价不会创建任务。然后调用[创建音频编排](https://docs.shixux.com/zh/audio/api/audio-composition/)提交相同的请求体。 ```bash curl -X POST 'https://shixux.com/api/v1/audio/compositions/quote' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"text":"[00:00] 欢迎回来。","prompt_document":{"version":1,"parts":[{"type":"text","text":"[00:00] 欢迎回来。"}]},"voice_preset_id":"vp_000000000000000000000001"}' ``` 创建音频编排必须携带 `Idempotency-Key`,重试时保持不变。编排失败或被停止后,调用[恢复音频编排](https://docs.shixux.com/zh/audio/api/audio-composition-retry/)继续处理,已完成的人声片段会被复用,不会重复生成。 ## 音色设计 音色设计根据文字描述生成全新的音色,无需上传录音。 1. 调用[查询音色设计配置](https://docs.shixux.com/zh/audio/api/voice-design-config/),确认功能可用,并读取每次生成的费率和费率版本 `billing.version`。 2. 调用[根据描述设计音色](https://docs.shixux.com/zh/audio/api/voice-design/),提交 `name`(1–80 个字符)、`description`(1–500 个字符)、`preview_text`(15–200 个字符)、`language` 和 `quote_version`。配置的 `languages` 列出当前可用语种,对应 `zh`、`en`、`ja`、`ko`。 3. 任务成功后试听结果。满意时调用[保存设计音色](https://docs.shixux.com/zh/audio/api/voice-design-save/),将其保存到账号的音色库;重复保存同一候选不会重复扣费。 4. 保存后,将返回的音色 ID 作为 `voice_asset_id` 用于语音合成。 ## 任务、结果与错误 音频任务的状态包括 `queued`、`processing`、`succeeded`、`failed` 和 `cancelled`。成功后调用[获取任务结果](https://docs.shixux.com/zh/common/api/jobs/result/)获取下载地址;地址过期后再次调用即可获取新地址。 常见的提交错误: - `422`:`model` 不受支持、缺少 `language`,或使用了所选模型不支持的字段。 - `402`:积分不足。 - `409`:同一幂等键已用于不同的请求。 - `503`:所选模型暂不可用,请稍后使用同一幂等键重试。 更多规则见[素材上传](https://docs.shixux.com/zh/common/uploads/)、[Webhook](https://docs.shixux.com/zh/common/webhooks/)、[异步任务](https://docs.shixux.com/zh/common/jobs/)和[计费与积分](https://docs.shixux.com/zh/operations/billing/)。 --- # Audio model overview URL: https://docs.shixux.com/en/audio/ ## Available models Speech synthesis and audio composition select a speech model with the `model` field in the request body; it defaults to `indextts-2`. Both models share [POST /v1/tts](https://docs.shixux.com/en/audio/api/tts/) and [POST /v1/audio/compositions](https://docs.shixux.com/en/audio/api/audio-composition/), and some request fields apply to only one of them. | Model ID | Language | Emotion control | Voice sources | Text limit | Output | | --- | --- | --- | --- | --- | --- | | `indextts-2` | Follows the voice reference; no `language` needed | Emotion reference audio, or an eight-dimensional emotion vector with `emo_alpha` | Preset voices, saved voices, uploaded voice references | 2048 characters | WAV | | `indextts-2.5` | `language` is required: `ZH`, `EN` or `JA` | `emo_text` description (up to 200 characters); inferred from the text when omitted | Preset voices, saved voices, uploaded voice references (0.5–15 seconds long) | 2000 characters, including at least one letter or digit | WAV | - `indextts-2.5` also supports `speed` (0.5–2×, default 1). It does not accept `emo_asset_id`, `emo_ref_key`, `emo_vector` or `emo_alpha`. - `indextts-2` does not accept `language`, `speed` or `emo_text`. - Both models reserve credits from the estimated audio duration and settle against the actual duration after success, returning any excess. The two models have different rates. For audio compositions, check the credits required with the [quote endpoint](https://docs.shixux.com/en/audio/api/audio-composition-quote/) first. - A `model` not listed above returns `422`. If a model is temporarily unavailable, the API returns `503`; try again later. ## Audio capabilities All audio generation runs as asynchronous jobs: a submission returns `202` with a job ID, and you get the result by polling or through a webhook. | Capability | Submit endpoint | Input | Output | Billing | | --- | --- | --- | --- | --- | | Speech synthesis | [POST /v1/tts](https://docs.shixux.com/en/audio/api/tts/) | Text, a model, one voice and optional emotion control | Speech audio | Reserved from the estimated duration and settled against the actual duration | | Audio composition | [POST /v1/audio/compositions](https://docs.shixux.com/en/audio/api/audio-composition/) | Timed script lines plus sound effect and music assets | Mixed WAV | Check with the [quote endpoint](https://docs.shixux.com/en/audio/api/audio-composition-quote/) first; billed per speech segment | | Voice design | [POST /v1/voice-designs](https://docs.shixux.com/en/audio/api/voice-design/) | Voice name, voice description, preview text and language | A candidate voice that can be saved for speech synthesis | Each generation is charged at the rate returned by [voice design configuration](https://docs.shixux.com/en/audio/api/voice-design-config/) | Voice design does not require choosing a model, so its request has no `model` field. It supports Chinese (`zh`) and English (`en`), descriptions of up to 500 characters and preview text of 15–200 characters. The rate per generation is returned by the [voice design configuration](https://docs.shixux.com/en/audio/api/voice-design-config/) endpoint. ## Choosing a capability - **Turn text into speech**: use speech synthesis. Choose `indextts-2` for fine emotion control with reference audio or an eight-dimensional vector. Choose `indextts-2.5` for Chinese, English or Japanese voice-over, speed control or emotion described in words. - **Produce finished audio with multiple lines, sound effects and music**: use audio composition. Quote before submitting. A failed composition can be resumed, and completed speech segments are reused. - **No suitable voice**: use voice design to generate a candidate voice from a text description, save it when you are satisfied, then use it as `voice_asset_id` for speech synthesis. See the [audio guide](https://docs.shixux.com/en/audio/guide/) for voice selection, emotion control and request examples for each model. ## API reference [Create speech](https://docs.shixux.com/en/audio/api/tts/) · [Quote an audio composition](https://docs.shixux.com/en/audio/api/audio-composition-quote/) · [Create an audio composition](https://docs.shixux.com/en/audio/api/audio-composition/) · [Resume an audio composition](https://docs.shixux.com/en/audio/api/audio-composition-retry/) · [Get voice design configuration](https://docs.shixux.com/en/audio/api/voice-design-config/) · [Design a voice from a description](https://docs.shixux.com/en/audio/api/voice-design/) · [Save a designed voice](https://docs.shixux.com/en/audio/api/voice-design-save/) · [List preset voices](https://docs.shixux.com/en/audio/api/voices/presets/) --- # 音频模型总览 URL: https://docs.shixux.com/zh/audio/ ## 可用模型 语音合成和音频编排通过请求体中的 `model` 字段选择语音模型,省略时使用 `indextts-2`。两个模型共用 [POST /v1/tts](https://docs.shixux.com/zh/audio/api/tts/) 和 [POST /v1/audio/compositions](https://docs.shixux.com/zh/audio/api/audio-composition/),部分请求字段仅适用于其中一个模型。 | 模型 ID | 语言 | 情绪控制 | 音色来源 | 文本上限 | 输出 | | --- | --- | --- | --- | --- | --- | | `indextts-2` | 跟随声音参考,无需指定 `language` | 情绪参考音频,或八维情绪向量配合 `emo_alpha` | 预置音色、已保存的音色、上传的声音参考 | 2048 个字符 | WAV | | `indextts-2.5` | 必须指定 `language`:`ZH`、`EN` 或 `JA` | `emo_text` 文字描述(最多 200 个字符),省略时根据文本自动判断 | 预置音色、已保存的音色、上传的声音参考(时长 0.5–15 秒) | 2000 个字符,须包含文字或数字 | WAV | - `indextts-2.5` 还支持 `speed` 调节语速(0.5–2 倍,默认 1),不支持 `emo_asset_id`、`emo_ref_key`、`emo_vector` 和 `emo_alpha`。 - `indextts-2` 不支持 `language`、`speed` 和 `emo_text`。 - 两个模型均按预估音频时长预扣积分,成功后按实际时长结算,多扣部分退回。两个模型费率不同;音频编排可先通过[报价接口](https://docs.shixux.com/zh/audio/api/audio-composition-quote/)查询所需积分。 - 传入上表以外的 `model` 返回 `422`。模型暂不可用时返回 `503`,请稍后重试。 ## 音频能力 音频生成均为异步任务:提交后返回 `202` 和任务 ID,再通过轮询或 Webhook 获取结果。 | 能力 | 提交接口 | 输入 | 输出 | 计费 | | --- | --- | --- | --- | --- | | 语音合成 | [POST /v1/tts](https://docs.shixux.com/zh/audio/api/tts/) | 文本、模型、一个音色,可选情绪控制 | 语音音频 | 按预估时长预扣,成功后按实际时长结算 | | 音频编排 | [POST /v1/audio/compositions](https://docs.shixux.com/zh/audio/api/audio-composition/) | 带时间轴的台词,以及音效和配乐素材 | 混音后的 WAV | 先通过[报价接口](https://docs.shixux.com/zh/audio/api/audio-composition-quote/)查询,按人声片段计费 | | 音色设计 | [POST /v1/voice-designs](https://docs.shixux.com/zh/audio/api/voice-design/) | 音色名称、声音描述、试听文本和语言 | 候选音色,保存后可用于语音合成 | 按[音色设计配置](https://docs.shixux.com/zh/audio/api/voice-design-config/)返回的费率,每次生成计费一次 | 音色设计无需选择模型,请求中没有 `model` 字段。支持中文(`zh`)和英文(`en`),描述最多 500 个字符,试听文本为 15–200 个字符;每次生成的费率由[音色设计配置](https://docs.shixux.com/zh/audio/api/voice-design-config/)接口返回。 ## 如何选择 - **将文字转换为语音**:使用语音合成。需要用情绪参考音频或八维向量精细控制情绪时,选择 `indextts-2`;需要中文、英文、日文配音、调节语速或用文字描述情绪时,选择 `indextts-2.5`。 - **制作包含多段台词、音效和配乐的成品音频**:使用音频编排。建议先报价再提交;任务失败后可以恢复,已完成的人声片段会被复用。 - **没有合适的音色**:使用音色设计,用文字描述生成候选音色,满意后保存,再作为 `voice_asset_id` 用于语音合成。 音色选择、情绪控制和各模型的请求示例见[音频接入指南](https://docs.shixux.com/zh/audio/guide/)。 ## 接口参考 [创建语音任务](https://docs.shixux.com/zh/audio/api/tts/) · [查询音频编排报价](https://docs.shixux.com/zh/audio/api/audio-composition-quote/) · [创建音频编排](https://docs.shixux.com/zh/audio/api/audio-composition/) · [恢复音频编排](https://docs.shixux.com/zh/audio/api/audio-composition-retry/) · [查询音色设计配置](https://docs.shixux.com/zh/audio/api/voice-design-config/) · [根据描述设计音色](https://docs.shixux.com/zh/audio/api/voice-design/) · [保存设计音色](https://docs.shixux.com/zh/audio/api/voice-design-save/) · [列出预置音色](https://docs.shixux.com/zh/audio/api/voices/presets/) --- # Get available capabilities URL: https://docs.shixux.com/en/common/api/capabilities/ Check whether each feature is currently available. Availability can change at any time; the actual response to a submission is authoritative. No authentication is required. GET /capabilities {"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"features":{"additionalProperties":{"properties":{"enabled":{"title":"Enabled","type":"boolean"},"message":{"title":"Message","type":"string"}},"required":["enabled","message"],"title":"PublicFeatureCapability","type":"object"},"title":"Features","type":"object"},"read_only":{"title":"Read Only","type":"boolean"},"audio":{"type":"object","properties":{"max_text_length":{"type":"integer"},"chars_per_second":{"type":"number"},"credits_per_second":{"type":"number"},"minimum_credits":{"type":"number"},"emotion_text_supported":{"type":"boolean"},"emotion_weight_max":{"type":"number"}},"required":["max_text_length","chars_per_second","credits_per_second","minimum_credits","emotion_text_supported","emotion_weight_max"]}},"required":["read_only","features","audio"],"title":"CapabilitiesResponse","type":"object"}}},"description":"Successful Response"},"503":{"content":{"application/json":{"schema":{"properties":{"detail":{"title":"Detail","type":"string"}},"required":["detail"],"title":"ErrorDetail","type":"object"}}},"description":"Feature Configuration Unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X GET 'https://shixux.com/api/capabilities' ``` ```javascript const response = await fetch("https://shixux.com/api/capabilities", { method: "GET", headers: {}, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/capabilities", method="GET", headers={}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/capabilities", nil) if err != nil { panic(err) } resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 查询可用能力 URL: https://docs.shixux.com/zh/common/api/capabilities/ 查询各项功能当前是否可用。功能状态可能随时变化,提交请求时以实际响应为准。无需认证。 GET /capabilities {"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"features":{"additionalProperties":{"properties":{"enabled":{"title":"Enabled","type":"boolean"},"message":{"title":"Message","type":"string"}},"required":["enabled","message"],"title":"PublicFeatureCapability","type":"object"},"title":"Features","type":"object"},"read_only":{"title":"Read Only","type":"boolean"},"audio":{"type":"object","properties":{"max_text_length":{"type":"integer"},"chars_per_second":{"type":"number"},"credits_per_second":{"type":"number"},"minimum_credits":{"type":"number"},"emotion_text_supported":{"type":"boolean"},"emotion_weight_max":{"type":"number"}},"required":["max_text_length","chars_per_second","credits_per_second","minimum_credits","emotion_text_supported","emotion_weight_max"]}},"required":["read_only","features","audio"],"title":"CapabilitiesResponse","type":"object"}}},"description":"Successful Response"},"503":{"content":{"application/json":{"schema":{"properties":{"detail":{"title":"Detail","type":"string"}},"required":["detail"],"title":"ErrorDetail","type":"object"}}},"description":"Feature Configuration Unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X GET 'https://shixux.com/api/capabilities' ``` ```javascript const response = await fetch("https://shixux.com/api/capabilities", { method: "GET", headers: {}, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/capabilities", method="GET", headers={}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/capabilities", nil) if err != nil { panic(err) } resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # List jobs URL: https://docs.shixux.com/en/common/api/jobs/list/ List your account's jobs, newest first, optionally filtered by job type, status and idempotency key. When more results exist, the X-Next-Cursor response header returns the cursor for the next page. GET /v1/jobs {"parameters":[{"in":"query","name":"limit","schema":{"default":20,"title":"Limit","type":"integer"}},{"name":"type","in":"query","schema":{"type":"string"},"description":"Optional comma-separated job types: tts, video, image, voice_design, audio_composition."},{"name":"status","in":"query","schema":{"type":"string"}},{"name":"cursor","in":"query","schema":{"type":"string"}},{"name":"idempotency_key","in":"query","schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"properties":{"provider_failure":{"description":"User-facing reason and recovery action derived from a failed video generation receipt. Includes only safe service identifiers. Portrait enrollment is indicated only when explicitly requested in the receipt.","type":"object","properties":{"code":{"type":"string"},"request_id":{"type":"string"},"stage":{"type":"string","enum":["submission","generation"]},"reason":{"type":"string"},"reason_en":{"type":"string"},"action":{"type":"string"},"action_en":{"type":"string"}},"required":["stage","reason","reason_en","action","action_en"]},"actual_credits":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Actual Credits"},"created_at":{"format":"date-time","title":"Created At","type":"string"},"error_code":{"description":"Failure reason code. IMAGE_REFERENCE_COPYRIGHT, IMAGE_PROMPT_COPYRIGHT and IMAGE_OUTPUT_COPYRIGHT mean the reference image, prompt or generated image was rejected in copyright review. IMAGE_PROVIDER_INVALID_PARAMETERS means the image model rejected the request parameters. In these cases reserved credits are refunded. IMAGE_PROVIDER_NO_RESULT means the job ended without a result and any remaining reserved credits were refunded. IMAGE_SUBMISSION_NOT_ACCEPTED means the image submission was closed before it was accepted, and no credits were charged.","anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Code"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"finished_at":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"title":"Finished At"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"started_at":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"title":"Started At"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"},"webhook_endpoint_id":{"anyOf":[{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},{"type":"null"}],"title":"Webhook Endpoint Id"},"progress":{"type":"number","minimum":0,"maximum":1}},"required":["id","type","status","reserved_credits","actual_credits","error_code","error_message","created_at","started_at","finished_at"],"title":"JobResponse","type":"object"},"title":"Response List Jobs V1 Jobs Get","type":"array"}}},"description":"Successful Response","headers":{"X-Next-Cursor":{"description":"Opaque cursor for the next page. Absent on the last page.","schema":{"type":"string"}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} webhook_endpoint_id ID of the webhook endpoint notified when the job ends. It must belong to your account and be enabled. ```curl curl -X GET 'https://shixux.com/api/v1/jobs' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/jobs", { method: "GET", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/jobs", method="GET", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/jobs", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 列出任务 URL: https://docs.shixux.com/zh/common/api/jobs/list/ 按创建时间倒序列出当前账号的任务,可按任务类型、状态和幂等键筛选。还有更多结果时,响应头 X-Next-Cursor 返回下一页游标。 GET /v1/jobs {"parameters":[{"in":"query","name":"limit","schema":{"default":20,"title":"Limit","type":"integer"}},{"name":"type","in":"query","schema":{"type":"string"},"description":"Optional comma-separated job types: tts, video, image, voice_design, audio_composition."},{"name":"status","in":"query","schema":{"type":"string"}},{"name":"cursor","in":"query","schema":{"type":"string"}},{"name":"idempotency_key","in":"query","schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"properties":{"provider_failure":{"description":"User-facing reason and recovery action derived from a failed video generation receipt. Includes only safe service identifiers. Portrait enrollment is indicated only when explicitly requested in the receipt.","type":"object","properties":{"code":{"type":"string"},"request_id":{"type":"string"},"stage":{"type":"string","enum":["submission","generation"]},"reason":{"type":"string"},"reason_en":{"type":"string"},"action":{"type":"string"},"action_en":{"type":"string"}},"required":["stage","reason","reason_en","action","action_en"]},"actual_credits":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Actual Credits"},"created_at":{"format":"date-time","title":"Created At","type":"string"},"error_code":{"description":"Failure reason code. IMAGE_REFERENCE_COPYRIGHT, IMAGE_PROMPT_COPYRIGHT and IMAGE_OUTPUT_COPYRIGHT mean the reference image, prompt or generated image was rejected in copyright review. IMAGE_PROVIDER_INVALID_PARAMETERS means the image model rejected the request parameters. In these cases reserved credits are refunded. IMAGE_PROVIDER_NO_RESULT means the job ended without a result and any remaining reserved credits were refunded. IMAGE_SUBMISSION_NOT_ACCEPTED means the image submission was closed before it was accepted, and no credits were charged.","anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Code"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"finished_at":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"title":"Finished At"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"started_at":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"title":"Started At"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"},"webhook_endpoint_id":{"anyOf":[{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},{"type":"null"}],"title":"Webhook Endpoint Id"},"progress":{"type":"number","minimum":0,"maximum":1}},"required":["id","type","status","reserved_credits","actual_credits","error_code","error_message","created_at","started_at","finished_at"],"title":"JobResponse","type":"object"},"title":"Response List Jobs V1 Jobs Get","type":"array"}}},"description":"Successful Response","headers":{"X-Next-Cursor":{"description":"Opaque cursor for the next page. Absent on the last page.","schema":{"type":"string"}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} webhook_endpoint_id 任务结束时接收通知的 Webhook 端点 ID,须属于当前账号且已启用。 ```curl curl -X GET 'https://shixux.com/api/v1/jobs' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/jobs", { method: "GET", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/jobs", method="GET", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/jobs", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Retrieve a job result URL: https://docs.shixux.com/en/common/api/jobs/result/ After a job succeeds, get a short-lived download URL for the result file. Call again for a new URL after it expires. retained_until is when the result file stops being retained. GET /v1/jobs/{job_id}/result {"parameters":[{"in":"path","name":"job_id","required":true,"schema":{"title":"Job Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"expires_in":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expires In"},"id":{"title":"Id","type":"string"},"result_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Result Url"},"retained_until":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"description":"Media retention deadline, or null for permanent retention. Signed URL lifetime is independent."},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"preview_url":{"type":"string"},"preview_status":{"type":"string","enum":["pending","ready","expired"]},"thumbnail_url":{"type":"string","description":"Optional signed, aspect-preserving image thumbnail for canvas display."}},"required":["id","status"],"title":"JobResultResponse","type":"object"}}},"description":"Successful Response"},"410":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["JOB_RESULT_EXPIRED"],"title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"}},"required":["code","detail"],"title":"JobResultExpiredResponse","type":"object"}}},"description":"Generated result is unavailable or expired","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} retained_until When the asset or result file stops being retained. Request a new download URL after one expires. ```curl curl -X GET 'https://shixux.com/api/v1/jobs/job_id_example/result' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/jobs/job_id_example/result", { method: "GET", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/jobs/job_id_example/result", method="GET", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/jobs/job_id_example/result", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 获取任务结果 URL: https://docs.shixux.com/zh/common/api/jobs/result/ 任务成功后获取结果文件的短时下载地址,地址过期后可再次调用获取新地址。retained_until 为结果文件的保留截止时间。 GET /v1/jobs/{job_id}/result {"parameters":[{"in":"path","name":"job_id","required":true,"schema":{"title":"Job Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"expires_in":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expires In"},"id":{"title":"Id","type":"string"},"result_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Result Url"},"retained_until":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"description":"Media retention deadline, or null for permanent retention. Signed URL lifetime is independent."},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"preview_url":{"type":"string"},"preview_status":{"type":"string","enum":["pending","ready","expired"]},"thumbnail_url":{"type":"string","description":"Optional signed, aspect-preserving image thumbnail for canvas display."}},"required":["id","status"],"title":"JobResultResponse","type":"object"}}},"description":"Successful Response"},"410":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["JOB_RESULT_EXPIRED"],"title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"}},"required":["code","detail"],"title":"JobResultExpiredResponse","type":"object"}}},"description":"Generated result is unavailable or expired","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} retained_until 素材或结果文件的保留截止时间。下载地址过期后可重新获取。 ```curl curl -X GET 'https://shixux.com/api/v1/jobs/job_id_example/result' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/jobs/job_id_example/result", { method: "GET", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/jobs/job_id_example/result", method="GET", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/jobs/job_id_example/result", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Retrieve a job URL: https://docs.shixux.com/en/common/api/jobs/retrieve/ Retrieve a job's status: queued, processing, succeeded, failed or cancelled. progress may be null; this does not mean the job has stalled. GET /v1/jobs/{job_id} {"parameters":[{"in":"path","name":"job_id","required":true,"schema":{"title":"Job Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"provider_failure":{"description":"User-facing reason and recovery action derived from a failed video generation receipt. Includes only safe service identifiers. Portrait enrollment is indicated only when explicitly requested in the receipt.","type":"object","properties":{"code":{"type":"string"},"request_id":{"type":"string"},"stage":{"type":"string","enum":["submission","generation"]},"reason":{"type":"string"},"reason_en":{"type":"string"},"action":{"type":"string"},"action_en":{"type":"string"}},"required":["stage","reason","reason_en","action","action_en"]},"actual_credits":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Actual Credits"},"created_at":{"format":"date-time","title":"Created At","type":"string"},"error_code":{"description":"Failure reason code. IMAGE_REFERENCE_COPYRIGHT, IMAGE_PROMPT_COPYRIGHT and IMAGE_OUTPUT_COPYRIGHT mean the reference image, prompt or generated image was rejected in copyright review. IMAGE_PROVIDER_INVALID_PARAMETERS means the image model rejected the request parameters. In these cases reserved credits are refunded. IMAGE_PROVIDER_NO_RESULT means the job ended without a result and any remaining reserved credits were refunded. IMAGE_SUBMISSION_NOT_ACCEPTED means the image submission was closed before it was accepted, and no credits were charged.","anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Code"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"finished_at":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"title":"Finished At"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"started_at":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"title":"Started At"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"},"webhook_endpoint_id":{"anyOf":[{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},{"type":"null"}],"title":"Webhook Endpoint Id"},"progress":{"type":"number","minimum":0,"maximum":1}},"required":["id","type","status","reserved_credits","actual_credits","error_code","error_message","created_at","started_at","finished_at"],"title":"JobResponse","type":"object"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} webhook_endpoint_id ID of the webhook endpoint notified when the job ends. It must belong to your account and be enabled. ```curl curl -X GET 'https://shixux.com/api/v1/jobs/job_id_example' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/jobs/job_id_example", { method: "GET", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/jobs/job_id_example", method="GET", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/jobs/job_id_example", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 查询任务 URL: https://docs.shixux.com/zh/common/api/jobs/retrieve/ 查询任务状态:queued、processing、succeeded、failed 或 cancelled。progress 可能为 null,这不代表任务停滞。 GET /v1/jobs/{job_id} {"parameters":[{"in":"path","name":"job_id","required":true,"schema":{"title":"Job Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"provider_failure":{"description":"User-facing reason and recovery action derived from a failed video generation receipt. Includes only safe service identifiers. Portrait enrollment is indicated only when explicitly requested in the receipt.","type":"object","properties":{"code":{"type":"string"},"request_id":{"type":"string"},"stage":{"type":"string","enum":["submission","generation"]},"reason":{"type":"string"},"reason_en":{"type":"string"},"action":{"type":"string"},"action_en":{"type":"string"}},"required":["stage","reason","reason_en","action","action_en"]},"actual_credits":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Actual Credits"},"created_at":{"format":"date-time","title":"Created At","type":"string"},"error_code":{"description":"Failure reason code. IMAGE_REFERENCE_COPYRIGHT, IMAGE_PROMPT_COPYRIGHT and IMAGE_OUTPUT_COPYRIGHT mean the reference image, prompt or generated image was rejected in copyright review. IMAGE_PROVIDER_INVALID_PARAMETERS means the image model rejected the request parameters. In these cases reserved credits are refunded. IMAGE_PROVIDER_NO_RESULT means the job ended without a result and any remaining reserved credits were refunded. IMAGE_SUBMISSION_NOT_ACCEPTED means the image submission was closed before it was accepted, and no credits were charged.","anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Code"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"finished_at":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"title":"Finished At"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"started_at":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"title":"Started At"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"},"webhook_endpoint_id":{"anyOf":[{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},{"type":"null"}],"title":"Webhook Endpoint Id"},"progress":{"type":"number","minimum":0,"maximum":1}},"required":["id","type","status","reserved_credits","actual_credits","error_code","error_message","created_at","started_at","finished_at"],"title":"JobResponse","type":"object"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} webhook_endpoint_id 任务结束时接收通知的 Webhook 端点 ID,须属于当前账号且已启用。 ```curl curl -X GET 'https://shixux.com/api/v1/jobs/job_id_example' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/jobs/job_id_example", { method: "GET", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/jobs/job_id_example", method="GET", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/jobs/job_id_example", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Create an API Key URL: https://docs.shixux.com/en/common/api/keys/create/ Create a new API Key. The full key is returned only once in the response; store it on your server right away. This endpoint accepts console login credentials only. POST /keys {"requestBody":{"content":{"application/json":{"schema":{"properties":{"name":{"default":"default","maxLength":120,"title":"Name","type":"string"}},"title":"CreateApiKeyRequest","type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"properties":{"created_at":{"format":"date-time","title":"Created At","type":"string"},"id":{"title":"Id","type":"string"},"is_active":{"title":"Is Active","type":"boolean"},"key":{"title":"Key","type":"string"},"last_used_at":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"title":"Last Used At"},"name":{"title":"Name","type":"string"},"public_prefix":{"title":"Public Prefix","type":"string"}},"required":["id","name","public_prefix","is_active","last_used_at","created_at","key"],"title":"ApiKeyCreatedResponse","type":"object"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}},"503":{"content":{"application/json":{"schema":{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"}}},"description":"Feature Temporarily Unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X POST 'https://shixux.com/api/keys' \ -H 'Authorization: Bearer login_credential_placeholder' \ -H 'Content-Type: application/json' \ -d '{"name":"default"}' ``` ```javascript const response = await fetch("https://shixux.com/api/keys", { method: "POST", headers: { "Authorization": "Bearer login_credential_placeholder", "Content-Type": "application/json" }, body: JSON.stringify({ "name": "default" }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/keys", method="POST", headers={"Authorization":"Bearer login_credential_placeholder","Content-Type":"application/json"}, data="{\"name\":\"default\"}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/keys", strings.NewReader("{\"name\":\"default\"}")) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer login_credential_placeholder") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 创建 API Key URL: https://docs.shixux.com/zh/common/api/keys/create/ 创建新的 API Key。完整的 API Key 只在响应中返回一次,请立即保存到服务器端。此接口只接受控制台登录凭证。 POST /keys {"requestBody":{"content":{"application/json":{"schema":{"properties":{"name":{"default":"default","maxLength":120,"title":"Name","type":"string"}},"title":"CreateApiKeyRequest","type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"properties":{"created_at":{"format":"date-time","title":"Created At","type":"string"},"id":{"title":"Id","type":"string"},"is_active":{"title":"Is Active","type":"boolean"},"key":{"title":"Key","type":"string"},"last_used_at":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"title":"Last Used At"},"name":{"title":"Name","type":"string"},"public_prefix":{"title":"Public Prefix","type":"string"}},"required":["id","name","public_prefix","is_active","last_used_at","created_at","key"],"title":"ApiKeyCreatedResponse","type":"object"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}},"503":{"content":{"application/json":{"schema":{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"}}},"description":"Feature Temporarily Unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X POST 'https://shixux.com/api/keys' \ -H 'Authorization: Bearer login_credential_placeholder' \ -H 'Content-Type: application/json' \ -d '{"name":"default"}' ``` ```javascript const response = await fetch("https://shixux.com/api/keys", { method: "POST", headers: { "Authorization": "Bearer login_credential_placeholder", "Content-Type": "application/json" }, body: JSON.stringify({ "name": "default" }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/keys", method="POST", headers={"Authorization":"Bearer login_credential_placeholder","Content-Type":"application/json"}, data="{\"name\":\"default\"}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/keys", strings.NewReader("{\"name\":\"default\"}")) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer login_credential_placeholder") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # List API Keys URL: https://docs.shixux.com/en/common/api/keys/list/ List your account's API Keys without returning the full keys. This endpoint accepts console login credentials only. GET /keys {"responses":{"200":{"content":{"application/json":{"schema":{"items":{"properties":{"created_at":{"format":"date-time","title":"Created At","type":"string"},"id":{"title":"Id","type":"string"},"is_active":{"title":"Is Active","type":"boolean"},"last_used_at":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"title":"Last Used At"},"name":{"title":"Name","type":"string"},"public_prefix":{"title":"Public Prefix","type":"string"}},"required":["id","name","public_prefix","is_active","last_used_at","created_at"],"title":"ApiKeyResponse","type":"object"},"title":"Response List Keys Keys Get","type":"array"}}},"description":"Successful Response"}}} ```curl curl -X GET 'https://shixux.com/api/keys' \ -H 'Authorization: Bearer login_credential_placeholder' ``` ```javascript const response = await fetch("https://shixux.com/api/keys", { method: "GET", headers: { "Authorization": "Bearer login_credential_placeholder" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/keys", method="GET", headers={"Authorization":"Bearer login_credential_placeholder"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/keys", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer login_credential_placeholder") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 列出 API Key URL: https://docs.shixux.com/zh/common/api/keys/list/ 列出当前账号的 API Key 信息,不返回完整的 API Key。此接口只接受控制台登录凭证。 GET /keys {"responses":{"200":{"content":{"application/json":{"schema":{"items":{"properties":{"created_at":{"format":"date-time","title":"Created At","type":"string"},"id":{"title":"Id","type":"string"},"is_active":{"title":"Is Active","type":"boolean"},"last_used_at":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"title":"Last Used At"},"name":{"title":"Name","type":"string"},"public_prefix":{"title":"Public Prefix","type":"string"}},"required":["id","name","public_prefix","is_active","last_used_at","created_at"],"title":"ApiKeyResponse","type":"object"},"title":"Response List Keys Keys Get","type":"array"}}},"description":"Successful Response"}}} ```curl curl -X GET 'https://shixux.com/api/keys' \ -H 'Authorization: Bearer login_credential_placeholder' ``` ```javascript const response = await fetch("https://shixux.com/api/keys", { method: "GET", headers: { "Authorization": "Bearer login_credential_placeholder" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/keys", method="GET", headers={"Authorization":"Bearer login_credential_placeholder"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/keys", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer login_credential_placeholder") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Revoke an API Key URL: https://docs.shixux.com/en/common/api/keys/revoke/ A revoked API Key stops working immediately and cannot be used for any further requests. This endpoint accepts console login credentials only. DELETE /keys/{key_id} {"parameters":[{"in":"path","name":"key_id","required":true,"schema":{"title":"Key Id","type":"string"}}],"responses":{"204":{"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X DELETE 'https://shixux.com/api/keys/key_id_example' \ -H 'Authorization: Bearer login_credential_placeholder' ``` ```javascript const response = await fetch("https://shixux.com/api/keys/key_id_example", { method: "DELETE", headers: { "Authorization": "Bearer login_credential_placeholder" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/keys/key_id_example", method="DELETE", headers={"Authorization":"Bearer login_credential_placeholder"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("DELETE", "https://shixux.com/api/keys/key_id_example", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer login_credential_placeholder") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 撤销 API Key URL: https://docs.shixux.com/zh/common/api/keys/revoke/ 撤销后,该 API Key 立即失效,不能再用于任何请求。此接口只接受控制台登录凭证。 DELETE /keys/{key_id} {"parameters":[{"in":"path","name":"key_id","required":true,"schema":{"title":"Key Id","type":"string"}}],"responses":{"204":{"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X DELETE 'https://shixux.com/api/keys/key_id_example' \ -H 'Authorization: Bearer login_credential_placeholder' ``` ```javascript const response = await fetch("https://shixux.com/api/keys/key_id_example", { method: "DELETE", headers: { "Authorization": "Bearer login_credential_placeholder" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/keys/key_id_example", method="DELETE", headers={"Authorization":"Bearer login_credential_placeholder"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("DELETE", "https://shixux.com/api/keys/key_id_example", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer login_credential_placeholder") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Complete an upload URL: https://docs.shixux.com/en/common/api/uploads/complete/ Call after the file has been uploaded to make the asset available. The service checks the file size and format; unconfirmed assets cannot be used for generation. POST /v1/uploads/{asset_id}/complete {"parameters":[{"in":"path","name":"asset_id","required":true,"schema":{"title":"Asset Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"asset_id":{"title":"Asset Id","type":"string"},"uploaded_at":{"format":"date-time","title":"Uploaded At","type":"string"},"retained_until":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"description":"Media retention deadline, or null for permanent retention. Signed URL lifetime is independent."}},"required":["asset_id","uploaded_at","retained_until"],"title":"UploadCompleteResponse","type":"object"}}},"description":"Successful Response"},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"404":{"description":"Upload not found","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"The credentials do not match the account.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Upload completion window expired","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"description":"Upload incomplete or invalid","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"anyOf":[{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"},{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}]}}}},"503":{"content":{"application/json":{"schema":{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"}}},"description":"Feature Temporarily Unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} retained_until When the asset or result file stops being retained. Request a new download URL after one expires. ```curl curl -X POST 'https://shixux.com/api/v1/uploads/asset_id_example/complete' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/uploads/asset_id_example/complete", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/uploads/asset_id_example/complete", method="POST", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/uploads/asset_id_example/complete", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 确认上传完成 URL: https://docs.shixux.com/zh/common/api/uploads/complete/ 文件上传成功后调用,确认素材可用。服务会核对文件大小和格式;未确认的素材不能用于生成。 POST /v1/uploads/{asset_id}/complete {"parameters":[{"in":"path","name":"asset_id","required":true,"schema":{"title":"Asset Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"asset_id":{"title":"Asset Id","type":"string"},"uploaded_at":{"format":"date-time","title":"Uploaded At","type":"string"},"retained_until":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"description":"Media retention deadline, or null for permanent retention. Signed URL lifetime is independent."}},"required":["asset_id","uploaded_at","retained_until"],"title":"UploadCompleteResponse","type":"object"}}},"description":"Successful Response"},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"404":{"description":"Upload not found","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"The credentials do not match the account.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Upload completion window expired","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"description":"Upload incomplete or invalid","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"anyOf":[{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"},{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}]}}}},"503":{"content":{"application/json":{"schema":{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"}}},"description":"Feature Temporarily Unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} retained_until 素材或结果文件的保留截止时间。下载地址过期后可重新获取。 ```curl curl -X POST 'https://shixux.com/api/v1/uploads/asset_id_example/complete' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/uploads/asset_id_example/complete", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/uploads/asset_id_example/complete", method="POST", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/uploads/asset_id_example/complete", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Request an upload URL URL: https://docs.shixux.com/en/common/api/uploads/create/ Request an upload URL, valid for 300 seconds. Send the returned headers unchanged with the upload, then call the confirmation endpoint. Each account can make up to 30 requests per minute and upload up to 500 MiB in any rolling 24 hours; beyond that the API returns 429, which may include quota details. POST /v1/uploads {"requestBody":{"content":{"application/json":{"schema":{"properties":{"content_type":{"title":"Content Type","type":"string","description":"Must match the filename extension. Supported formats include WAV, MP3, FLAC, M4A, OGG, PNG, JPEG, WebP and MP4, subject to the selected purpose. Video references are limited to 50 MiB, video audio references to 15 MiB, and images and voice WAV files to 20 MiB."},"filename":{"title":"Filename","type":"string","maxLength":255},"display_name":{"maxLength":80,"title":"Display Name","type":"string"},"purpose":{"default":"input","pattern":"^(input|api_input|voice_reference|emotion_reference|audio_material|image_reference|video_image|video_clip|video_audio)$","title":"Purpose","type":"string","description":"Intended use of the asset: voice_reference, emotion_reference, audio_material, image_reference, video_image, video_clip or video_audio. Generation endpoints accept only assets whose purpose matches the use."},"rights_confirmed":{"default":false,"description":"Optional explicit rights confirmation. A confirmation timestamp is recorded only when this is supplied as true.","title":"Rights Confirmed","type":"boolean"},"size_bytes":{"type":"integer","minimum":1,"maximum":104857600,"description":"Actual file size in bytes, required for every upload. The uploaded file must match it. Per-purpose limits also apply; audio_material accepts WAV or MP3 up to 100 MiB.","title":"Size Bytes"}},"required":["filename","content_type","size_bytes"],"title":"UploadUrlRequest","type":"object"}}},"required":true},"parameters":[],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"asset_id":{"type":"string","title":"Asset Id"},"delete_after":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"title":"Delete After","description":"When this upload is deleted if it has not been confirmed."},"expires_in":{"title":"Expires In","type":"integer","description":"Upload authorization expires after 300 seconds. Complete the upload within one hour."},"upload_url":{"title":"Upload Url","type":"string"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"Send every returned header unchanged with the PUT request. Content-Length is the declared size; browsers set it automatically."}},"required":["upload_url","expires_in","asset_id","headers","delete_after"],"title":"UploadUrlResponse","type":"object"}}},"description":"Successful Response"},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"The credentials do not match the account.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}},"429":{"description":"UPLOAD_RATE_LIMITED (more than 30 upload requests per minute) or UPLOAD_QUOTA_EXCEEDED (more than 500 MiB in 24 hours). quota gives the current limit and usage.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."},"Retry-After":{"schema":{"type":"string"},"description":"Seconds until enough rolling quota expires for this request. Omitted when no retry time can be promised. Concurrent uploads may delay availability."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"content":{"application/json":{"schema":{"type":"object","required":["code","detail"],"properties":{"code":{"type":"string"},"detail":{"type":"string"},"feature":{"type":"string"}}}}},"description":"The upload service is unavailable; try again later.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} filename File name. Its extension must match content_type. content_type MIME type of the file, matching its extension. WAV, MP3, FLAC, M4A, OGG, PNG, JPEG, WebP and MP4 are supported, depending on purpose. Voice and emotion references must be audio/wav. size_bytes Actual file size in bytes. Voice references, emotion references and images: up to 20 MiB; reference videos: up to 50 MiB; video reference audio: up to 15 MiB; other audio: up to 100 MiB. purpose Asset purpose: voice_reference (voice reference), emotion_reference (emotion reference), audio_material (sound effect or music for audio composition), image_reference (reference image for image to image), or video_image, video_clip and video_audio (reference image, video and audio for video generation). Generation endpoints check the purpose when they reference the asset. rights_confirmed Confirms that you have permission to use the works, likenesses and voices in the asset. When true, the confirmation time is recorded. delete_after When an unconfirmed upload will be deleted. ```curl curl -X POST 'https://shixux.com/api/v1/uploads' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"filename":"voice.wav","content_type":"audio/wav","size_bytes":1048576,"purpose":"voice_reference","rights_confirmed":true}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/uploads", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json" }, body: JSON.stringify({ "filename": "voice.wav", "content_type": "audio/wav", "size_bytes": 1048576, "purpose": "voice_reference", "rights_confirmed": true }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/uploads", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json"}, data="{\"filename\":\"voice.wav\",\"content_type\":\"audio/wav\",\"size_bytes\":1048576,\"purpose\":\"voice_reference\",\"rights_confirmed\":true}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/uploads", strings.NewReader("{\"filename\":\"voice.wav\",\"content_type\":\"audio/wav\",\"size_bytes\":1048576,\"purpose\":\"voice_reference\",\"rights_confirmed\":true}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 申请上传地址 URL: https://docs.shixux.com/zh/common/api/uploads/create/ 申请素材上传地址,有效期 300 秒。上传时须原样携带返回的 headers,上传完成后调用确认接口。每个账号每分钟最多申请 30 次、任意连续 24 小时内最多 500 MiB;超出时返回 429,响应可包含 quota 详情。 POST /v1/uploads {"requestBody":{"content":{"application/json":{"schema":{"properties":{"content_type":{"title":"Content Type","type":"string","description":"Must match the filename extension. Supported formats include WAV, MP3, FLAC, M4A, OGG, PNG, JPEG, WebP and MP4, subject to the selected purpose. Video references are limited to 50 MiB, video audio references to 15 MiB, and images and voice WAV files to 20 MiB."},"filename":{"title":"Filename","type":"string","maxLength":255},"display_name":{"maxLength":80,"title":"Display Name","type":"string"},"purpose":{"default":"input","pattern":"^(input|api_input|voice_reference|emotion_reference|audio_material|image_reference|video_image|video_clip|video_audio)$","title":"Purpose","type":"string","description":"Intended use of the asset: voice_reference, emotion_reference, audio_material, image_reference, video_image, video_clip or video_audio. Generation endpoints accept only assets whose purpose matches the use."},"rights_confirmed":{"default":false,"description":"Optional explicit rights confirmation. A confirmation timestamp is recorded only when this is supplied as true.","title":"Rights Confirmed","type":"boolean"},"size_bytes":{"type":"integer","minimum":1,"maximum":104857600,"description":"Actual file size in bytes, required for every upload. The uploaded file must match it. Per-purpose limits also apply; audio_material accepts WAV or MP3 up to 100 MiB.","title":"Size Bytes"}},"required":["filename","content_type","size_bytes"],"title":"UploadUrlRequest","type":"object"}}},"required":true},"parameters":[],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"asset_id":{"type":"string","title":"Asset Id"},"delete_after":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"title":"Delete After","description":"When this upload is deleted if it has not been confirmed."},"expires_in":{"title":"Expires In","type":"integer","description":"Upload authorization expires after 300 seconds. Complete the upload within one hour."},"upload_url":{"title":"Upload Url","type":"string"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"Send every returned header unchanged with the PUT request. Content-Length is the declared size; browsers set it automatically."}},"required":["upload_url","expires_in","asset_id","headers","delete_after"],"title":"UploadUrlResponse","type":"object"}}},"description":"Successful Response"},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"The credentials do not match the account.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}},"429":{"description":"UPLOAD_RATE_LIMITED (more than 30 upload requests per minute) or UPLOAD_QUOTA_EXCEEDED (more than 500 MiB in 24 hours). quota gives the current limit and usage.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."},"Retry-After":{"schema":{"type":"string"},"description":"Seconds until enough rolling quota expires for this request. Omitted when no retry time can be promised. Concurrent uploads may delay availability."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"content":{"application/json":{"schema":{"type":"object","required":["code","detail"],"properties":{"code":{"type":"string"},"detail":{"type":"string"},"feature":{"type":"string"}}}}},"description":"The upload service is unavailable; try again later.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} filename 文件名,扩展名必须与 content_type 一致。 content_type 文件的 MIME 类型,须与文件扩展名一致。支持 WAV、MP3、FLAC、M4A、OGG、PNG、JPEG、WebP 和 MP4,可用格式取决于 purpose;声音和情绪参考必须为 audio/wav。 size_bytes 文件的实际字节数。声音参考、情绪参考和图片最大 20 MiB,参考视频最大 50 MiB,视频参考音频最大 15 MiB,其他音频最大 100 MiB。 purpose 素材用途:voice_reference(声音参考)、emotion_reference(情绪参考)、audio_material(音频编排的音效或配乐)、image_reference(图生图参考图)、video_image、video_clip、video_audio(视频生成的参考图片、视频和音频)。生成接口引用素材时会校验用途。 rights_confirmed 确认已取得素材中的作品、人物形象和声音的使用授权。传入 true 时记录确认时间。 delete_after 未确认的上传将被删除的时间。 ```curl curl -X POST 'https://shixux.com/api/v1/uploads' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"filename":"voice.wav","content_type":"audio/wav","size_bytes":1048576,"purpose":"voice_reference","rights_confirmed":true}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/uploads", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json" }, body: JSON.stringify({ "filename": "voice.wav", "content_type": "audio/wav", "size_bytes": 1048576, "purpose": "voice_reference", "rights_confirmed": true }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/uploads", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json"}, data="{\"filename\":\"voice.wav\",\"content_type\":\"audio/wav\",\"size_bytes\":1048576,\"purpose\":\"voice_reference\",\"rights_confirmed\":true}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/uploads", strings.NewReader("{\"filename\":\"voice.wav\",\"content_type\":\"audio/wav\",\"size_bytes\":1048576,\"purpose\":\"voice_reference\",\"rights_confirmed\":true}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Create a webhook endpoint URL: https://docs.shixux.com/en/common/api/webhooks/create/ Register a publicly reachable HTTPS URL. The whsec_ signing secret in the response is returned only once; store it securely right away. POST /v1/webhook-endpoints {"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","title":"CreateWebhookEndpointRequest","additionalProperties":false,"properties":{"name":{"type":"string","minLength":1,"maxLength":120},"url":{"type":"string","format":"uri","minLength":1,"maxLength":2083}},"required":["name","url"]}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"allOf":[{"type":"object","title":"WebhookEndpointResponse","properties":{"id":{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},"name":{"type":"string","maxLength":120},"url":{"type":"string","format":"uri","maxLength":2083},"enabled":{"type":"boolean"},"secret_version":{"type":"integer","minimum":1},"last_delivery_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_success_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_failure_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","url","enabled","secret_version","created_at","updated_at"]},{"type":"object","properties":{"signing_secret":{"type":"string","pattern":"^whsec_"}},"required":["signing_secret"]}],"title":"WebhookEndpointCreatedResponse"}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X POST 'https://shixux.com/api/v1/webhook-endpoints' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"name":"production","url":"https://example.com/webhooks/shixu"}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/webhook-endpoints", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json" }, body: JSON.stringify({ "name": "production", "url": "https://example.com/webhooks/shixu" }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/webhook-endpoints", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json"}, data="{\"name\":\"production\",\"url\":\"https://example.com/webhooks/shixu\"}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/webhook-endpoints", strings.NewReader("{\"name\":\"production\",\"url\":\"https://example.com/webhooks/shixu\"}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 创建 Webhook 端点 URL: https://docs.shixux.com/zh/common/api/webhooks/create/ 注册一个可公网访问的 HTTPS 地址。响应中的 whsec_ 签名密钥只返回一次,请立即安全保存。 POST /v1/webhook-endpoints {"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","title":"CreateWebhookEndpointRequest","additionalProperties":false,"properties":{"name":{"type":"string","minLength":1,"maxLength":120},"url":{"type":"string","format":"uri","minLength":1,"maxLength":2083}},"required":["name","url"]}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"allOf":[{"type":"object","title":"WebhookEndpointResponse","properties":{"id":{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},"name":{"type":"string","maxLength":120},"url":{"type":"string","format":"uri","maxLength":2083},"enabled":{"type":"boolean"},"secret_version":{"type":"integer","minimum":1},"last_delivery_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_success_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_failure_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","url","enabled","secret_version","created_at","updated_at"]},{"type":"object","properties":{"signing_secret":{"type":"string","pattern":"^whsec_"}},"required":["signing_secret"]}],"title":"WebhookEndpointCreatedResponse"}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X POST 'https://shixux.com/api/v1/webhook-endpoints' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"name":"production","url":"https://example.com/webhooks/shixu"}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/webhook-endpoints", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json" }, body: JSON.stringify({ "name": "production", "url": "https://example.com/webhooks/shixu" }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/webhook-endpoints", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json"}, data="{\"name\":\"production\",\"url\":\"https://example.com/webhooks/shixu\"}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/webhook-endpoints", strings.NewReader("{\"name\":\"production\",\"url\":\"https://example.com/webhooks/shixu\"}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Delete a webhook endpoint URL: https://docs.shixux.com/en/common/api/webhooks/delete/ Delete an endpoint. Deliveries that have not completed are no longer sent. DELETE /v1/webhook-endpoints/{endpoint_id} {"parameters":[{"in":"path","name":"endpoint_id","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Successful Response"}}} ```curl curl -X DELETE 'https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example", { method: "DELETE", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example", method="DELETE", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("DELETE", "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 删除 Webhook 端点 URL: https://docs.shixux.com/zh/common/api/webhooks/delete/ 删除端点。删除后,尚未完成的投递将不再发送。 DELETE /v1/webhook-endpoints/{endpoint_id} {"parameters":[{"in":"path","name":"endpoint_id","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Successful Response"}}} ```curl curl -X DELETE 'https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example", { method: "DELETE", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example", method="DELETE", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("DELETE", "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # List webhook deliveries URL: https://docs.shixux.com/en/common/api/webhooks/deliveries/ List an endpoint's deliveries page by page, including status, attempt count, the latest HTTP status and error details. GET /v1/webhook-endpoints/{endpoint_id}/deliveries {"parameters":[{"in":"path","name":"endpoint_id","required":true,"schema":{"type":"string"}},{"in":"query","name":"status","schema":{"type":"string"}},{"in":"query","name":"cursor","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"WebhookDeliveryPage","properties":{"items":{"type":"array","items":{"type":"object","title":"WebhookDeliveryResponse","properties":{"id":{"type":"string"},"event_id":{"type":"string"},"event_type":{"type":"string","enum":["job.succeeded","job.failed","endpoint.test"]},"job_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["pending","processing","delivered","failed","suppressed"]},"attempt_count":{"type":"integer","minimum":0},"last_http_status":{"anyOf":[{"type":"integer"},{"type":"null"}]},"last_duration_ms":{"anyOf":[{"type":"integer"},{"type":"null"}]},"next_attempt_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_attempt_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"delivered_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_error":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"}},"required":["id","event_id","event_type","status","attempt_count","created_at"]}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["items"]}}}}}} ```curl curl -X GET 'https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/deliveries' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/deliveries", { method: "GET", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/deliveries", method="GET", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/deliveries", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 查询投递记录 URL: https://docs.shixux.com/zh/common/api/webhooks/deliveries/ 分页查询端点的投递记录,包括投递状态、尝试次数、最近一次的 HTTP 状态码和错误信息。 GET /v1/webhook-endpoints/{endpoint_id}/deliveries {"parameters":[{"in":"path","name":"endpoint_id","required":true,"schema":{"type":"string"}},{"in":"query","name":"status","schema":{"type":"string"}},{"in":"query","name":"cursor","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"WebhookDeliveryPage","properties":{"items":{"type":"array","items":{"type":"object","title":"WebhookDeliveryResponse","properties":{"id":{"type":"string"},"event_id":{"type":"string"},"event_type":{"type":"string","enum":["job.succeeded","job.failed","endpoint.test"]},"job_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["pending","processing","delivered","failed","suppressed"]},"attempt_count":{"type":"integer","minimum":0},"last_http_status":{"anyOf":[{"type":"integer"},{"type":"null"}]},"last_duration_ms":{"anyOf":[{"type":"integer"},{"type":"null"}]},"next_attempt_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_attempt_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"delivered_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_error":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"}},"required":["id","event_id","event_type","status","attempt_count","created_at"]}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["items"]}}}}}} ```curl curl -X GET 'https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/deliveries' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/deliveries", { method: "GET", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/deliveries", method="GET", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/deliveries", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # List webhook endpoints URL: https://docs.shixux.com/en/common/api/webhooks/list/ List your account's webhook endpoints. Signing secrets are not returned. GET /v1/webhook-endpoints {"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","title":"WebhookEndpointResponse","properties":{"id":{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},"name":{"type":"string","maxLength":120},"url":{"type":"string","format":"uri","maxLength":2083},"enabled":{"type":"boolean"},"secret_version":{"type":"integer","minimum":1},"last_delivery_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_success_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_failure_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","url","enabled","secret_version","created_at","updated_at"]}}}}}}} ```curl curl -X GET 'https://shixux.com/api/v1/webhook-endpoints' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/webhook-endpoints", { method: "GET", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/webhook-endpoints", method="GET", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/webhook-endpoints", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 列出 Webhook 端点 URL: https://docs.shixux.com/zh/common/api/webhooks/list/ 列出当前账号的 Webhook 端点,不返回签名密钥。 GET /v1/webhook-endpoints {"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","title":"WebhookEndpointResponse","properties":{"id":{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},"name":{"type":"string","maxLength":120},"url":{"type":"string","format":"uri","maxLength":2083},"enabled":{"type":"boolean"},"secret_version":{"type":"integer","minimum":1},"last_delivery_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_success_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_failure_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","url","enabled","secret_version","created_at","updated_at"]}}}}}}} ```curl curl -X GET 'https://shixux.com/api/v1/webhook-endpoints' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/webhook-endpoints", { method: "GET", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/webhook-endpoints", method="GET", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/webhook-endpoints", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Redeliver an event URL: https://docs.shixux.com/en/common/api/webhooks/redeliver/ Redeliver an event whose retries have all failed. Receivers must still deduplicate by delivery ID. POST /v1/webhook-deliveries/{delivery_id}/redeliver {"parameters":[{"in":"path","name":"delivery_id","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"WebhookActionResponse","properties":{"delivery_id":{"type":"string"},"status":{"type":"string","const":"pending"}},"required":["delivery_id","status"]}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X POST 'https://shixux.com/api/v1/webhook-deliveries/delivery_id_example/redeliver' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/webhook-deliveries/delivery_id_example/redeliver", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/webhook-deliveries/delivery_id_example/redeliver", method="POST", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/webhook-deliveries/delivery_id_example/redeliver", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 重新投递事件 URL: https://docs.shixux.com/zh/common/api/webhooks/redeliver/ 重新投递一个所有重试均已失败的事件。接收方仍须按投递 ID 去重。 POST /v1/webhook-deliveries/{delivery_id}/redeliver {"parameters":[{"in":"path","name":"delivery_id","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"WebhookActionResponse","properties":{"delivery_id":{"type":"string"},"status":{"type":"string","const":"pending"}},"required":["delivery_id","status"]}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X POST 'https://shixux.com/api/v1/webhook-deliveries/delivery_id_example/redeliver' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/webhook-deliveries/delivery_id_example/redeliver", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/webhook-deliveries/delivery_id_example/redeliver", method="POST", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/webhook-deliveries/delivery_id_example/redeliver", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Retrieve a webhook endpoint URL: https://docs.shixux.com/en/common/api/webhooks/retrieve/ Retrieve the configuration and status of one of your endpoints. GET /v1/webhook-endpoints/{endpoint_id} {"parameters":[{"in":"path","name":"endpoint_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"WebhookEndpointResponse","properties":{"id":{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},"name":{"type":"string","maxLength":120},"url":{"type":"string","format":"uri","maxLength":2083},"enabled":{"type":"boolean"},"secret_version":{"type":"integer","minimum":1},"last_delivery_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_success_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_failure_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","url","enabled","secret_version","created_at","updated_at"]}}}}}} ```curl curl -X GET 'https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example", { method: "GET", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example", method="GET", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 查询 Webhook 端点 URL: https://docs.shixux.com/zh/common/api/webhooks/retrieve/ 查询当前账号一个端点的配置和状态。 GET /v1/webhook-endpoints/{endpoint_id} {"parameters":[{"in":"path","name":"endpoint_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"WebhookEndpointResponse","properties":{"id":{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},"name":{"type":"string","maxLength":120},"url":{"type":"string","format":"uri","maxLength":2083},"enabled":{"type":"boolean"},"secret_version":{"type":"integer","minimum":1},"last_delivery_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_success_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_failure_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","url","enabled","secret_version","created_at","updated_at"]}}}}}} ```curl curl -X GET 'https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example", { method: "GET", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example", method="GET", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Rotate the signing secret URL: https://docs.shixux.com/en/common/api/webhooks/rotate-secret/ Generate a new signing secret, returned only once. For 48 hours after rotation, notifications are signed with both the new and the previous secret; you cannot rotate again until this transition ends. POST /v1/webhook-endpoints/{endpoint_id}/rotate-secret {"parameters":[{"in":"path","name":"endpoint_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"allOf":[{"type":"object","title":"WebhookEndpointResponse","properties":{"id":{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},"name":{"type":"string","maxLength":120},"url":{"type":"string","format":"uri","maxLength":2083},"enabled":{"type":"boolean"},"secret_version":{"type":"integer","minimum":1},"last_delivery_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_success_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_failure_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","url","enabled","secret_version","created_at","updated_at"]},{"type":"object","properties":{"signing_secret":{"type":"string","pattern":"^whsec_"}},"required":["signing_secret"]}],"title":"WebhookEndpointCreatedResponse"}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X POST 'https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/rotate-secret' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/rotate-secret", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/rotate-secret", method="POST", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/rotate-secret", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 轮换签名密钥 URL: https://docs.shixux.com/zh/common/api/webhooks/rotate-secret/ 生成新的签名密钥,新密钥只返回一次。轮换后 48 小时内,通知同时使用新旧密钥签名;过渡期结束前不能再次轮换。 POST /v1/webhook-endpoints/{endpoint_id}/rotate-secret {"parameters":[{"in":"path","name":"endpoint_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"allOf":[{"type":"object","title":"WebhookEndpointResponse","properties":{"id":{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},"name":{"type":"string","maxLength":120},"url":{"type":"string","format":"uri","maxLength":2083},"enabled":{"type":"boolean"},"secret_version":{"type":"integer","minimum":1},"last_delivery_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_success_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_failure_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","url","enabled","secret_version","created_at","updated_at"]},{"type":"object","properties":{"signing_secret":{"type":"string","pattern":"^whsec_"}},"required":["signing_secret"]}],"title":"WebhookEndpointCreatedResponse"}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X POST 'https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/rotate-secret' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/rotate-secret", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/rotate-secret", method="POST", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/rotate-secret", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Send a test event URL: https://docs.shixux.com/en/common/api/webhooks/test/ Send a signed endpoint.test event to the endpoint to check your receiver. No generation job is created. POST /v1/webhook-endpoints/{endpoint_id}/test {"parameters":[{"in":"path","name":"endpoint_id","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"WebhookActionResponse","properties":{"delivery_id":{"type":"string"},"status":{"type":"string","const":"pending"}},"required":["delivery_id","status"]}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X POST 'https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/test' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/test", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/test", method="POST", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/test", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 发送测试事件 URL: https://docs.shixux.com/zh/common/api/webhooks/test/ 向端点发送一条签名的 endpoint.test 事件,用于验证接收逻辑。不会创建生成任务。 POST /v1/webhook-endpoints/{endpoint_id}/test {"parameters":[{"in":"path","name":"endpoint_id","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"WebhookActionResponse","properties":{"delivery_id":{"type":"string"},"status":{"type":"string","const":"pending"}},"required":["delivery_id","status"]}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X POST 'https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/test' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/test", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/test", method="POST", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example/test", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Update a webhook endpoint URL: https://docs.shixux.com/en/common/api/webhooks/update/ Change an endpoint's name, HTTPS URL or enabled state. PATCH /v1/webhook-endpoints/{endpoint_id} {"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","title":"UpdateWebhookEndpointRequest","additionalProperties":false,"minProperties":1,"properties":{"name":{"type":"string","minLength":1,"maxLength":120},"url":{"type":"string","format":"uri","minLength":1,"maxLength":2083},"enabled":{"type":"boolean"}}}}}},"parameters":[{"in":"path","name":"endpoint_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"WebhookEndpointResponse","properties":{"id":{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},"name":{"type":"string","maxLength":120},"url":{"type":"string","format":"uri","maxLength":2083},"enabled":{"type":"boolean"},"secret_version":{"type":"integer","minimum":1},"last_delivery_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_success_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_failure_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","url","enabled","secret_version","created_at","updated_at"]}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X PATCH 'https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"name":"example","url":"https://example.com/resource","enabled":true}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example", { method: "PATCH", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json" }, body: JSON.stringify({ "name": "example", "url": "https://example.com/resource", "enabled": true }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example", method="PATCH", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json"}, data="{\"name\":\"example\",\"url\":\"https://example.com/resource\",\"enabled\":true}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("PATCH", "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example", strings.NewReader("{\"name\":\"example\",\"url\":\"https://example.com/resource\",\"enabled\":true}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 更新 Webhook 端点 URL: https://docs.shixux.com/zh/common/api/webhooks/update/ 修改端点的名称、HTTPS 地址或启用状态。 PATCH /v1/webhook-endpoints/{endpoint_id} {"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","title":"UpdateWebhookEndpointRequest","additionalProperties":false,"minProperties":1,"properties":{"name":{"type":"string","minLength":1,"maxLength":120},"url":{"type":"string","format":"uri","minLength":1,"maxLength":2083},"enabled":{"type":"boolean"}}}}}},"parameters":[{"in":"path","name":"endpoint_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"WebhookEndpointResponse","properties":{"id":{"type":"string","pattern":"^whe_[a-f0-9]{32}$"},"name":{"type":"string","maxLength":120},"url":{"type":"string","format":"uri","maxLength":2083},"enabled":{"type":"boolean"},"secret_version":{"type":"integer","minimum":1},"last_delivery_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_success_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"last_failure_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","url","enabled","secret_version","created_at","updated_at"]}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X PATCH 'https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"name":"example","url":"https://example.com/resource","enabled":true}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example", { method: "PATCH", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json" }, body: JSON.stringify({ "name": "example", "url": "https://example.com/resource", "enabled": true }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example", method="PATCH", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json"}, data="{\"name\":\"example\",\"url\":\"https://example.com/resource\",\"enabled\":true}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("PATCH", "https://shixux.com/api/v1/webhook-endpoints/endpoint_id_example", strings.NewReader("{\"name\":\"example\",\"url\":\"https://example.com/resource\",\"enabled\":true}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Authentication URL: https://docs.shixux.com/en/common/authentication/ ## Use an API Key Generation, upload, job and webhook endpoints authenticate with an API Key. Use either header below; both carry the same API Key: ```http X-API-Key: yb_xxx_yyy ``` ```http Authorization: Bearer yb_xxx_yyy ``` In the OpenAPI description these correspond to the security schemes `APIKeyHeader` and `APIKeyBearer`. To create and store a key, see [Get an API Key](https://docs.shixux.com/en/getting-started/keys/). ## Text model endpoints `GET /v1/models` and `POST /v1/chat/completions` accept API Keys only. We recommend `Authorization: Bearer yb_xxx_yyy`, which OpenAI SDKs send by default; `X-API-Key` also works. See the [text model guide](https://docs.shixux.com/en/text/guide/). ## Endpoints without authentication The following endpoints can be called without authentication: - Preset voice catalog, previews and icons - [Capabilities](https://docs.shixux.com/en/common/api/capabilities/) - Image, video and voice design configuration ## Endpoints that require console login credentials API Key management and voice asset management (listing, retrieving, renaming, deleting and previewing saved voices) are account management operations. They accept only console login credentials (`Authorization: Bearer `) and do not accept API Keys. These operations are usually performed directly in the console. API Keys and console login credentials are not interchangeable. ## Access scope An API Key can access only the jobs, assets, voices and webhook endpoints of its own account. After authentication, requests are still subject to the credit balance, request rate and concurrent job limits. See [Error handling](https://docs.shixux.com/en/operations/errors/) for the errors returned when a limit is reached. --- # 认证 URL: https://docs.shixux.com/zh/common/authentication/ ## 使用 API Key 生成、上传、任务和 Webhook 接口使用 API Key 认证。以下两种请求头任选其一,传入的都是同一个 API Key: ```http X-API-Key: yb_xxx_yyy ``` ```http Authorization: Bearer yb_xxx_yyy ``` 在 OpenAPI 描述文件中,这两种方式分别对应安全方案 `APIKeyHeader` 和 `APIKeyBearer`。API Key 的创建与保存见[获取 API Key](https://docs.shixux.com/zh/getting-started/keys/)。 ## 文本模型接口 `GET /v1/models` 和 `POST /v1/chat/completions` 只接受 API Key。推荐使用 OpenAI SDK 默认的 `Authorization: Bearer yb_xxx_yyy`,也可使用 `X-API-Key`。详见[文本模型接入指南](https://docs.shixux.com/zh/text/guide/)。 ## 无需认证的接口 以下接口无需认证即可调用: - 预置音色目录、试听和图标 - [能力查询](https://docs.shixux.com/zh/common/api/capabilities/) - 图片、视频和音色设计的配置接口 ## 仅限控制台登录凭证的接口 API Key 管理接口和音色资产管理接口(列出、查询、重命名、删除和试听已保存的音色)属于账号管理操作,只接受控制台登录凭证(`Authorization: Bearer <登录凭证>`),不接受 API Key。这些操作通常直接在控制台中完成。 API Key 与控制台登录凭证不能互换使用。 ## 权限范围 API Key 只能访问所属账号的任务、素材、音色和 Webhook 端点,不能访问其他账号的资源。认证通过后,请求仍受积分余额、请求频率和并发任务数限制,超限时返回的错误见[错误处理](https://docs.shixux.com/zh/operations/errors/)。 --- # Common capabilities URL: https://docs.shixux.com/en/common/ The following rules apply across model types. | Topic | Description | Applies to | | --- | --- | --- | | [Authentication](https://docs.shixux.com/en/common/authentication/) | How to use API Keys and what each kind of endpoint requires | All | | [Asynchronous jobs](https://docs.shixux.com/en/common/jobs/) | Job states, polling, fetching results and idempotent retries | Audio, image, video | | [Uploads](https://docs.shixux.com/en/common/uploads/) | Request an upload URL, upload the file, confirm it and reference the asset | Audio, image, video | | [Webhooks](https://docs.shixux.com/en/common/webhooks/) | Job notifications, signature verification, deduplication and retries | Audio, image, video | ## API reference | Group | Endpoints | | --- | --- | | Uploads | [Request an upload URL](https://docs.shixux.com/en/common/api/uploads/create/) · [Complete an upload](https://docs.shixux.com/en/common/api/uploads/complete/) | | Jobs | [List jobs](https://docs.shixux.com/en/common/api/jobs/list/) · [Retrieve a job](https://docs.shixux.com/en/common/api/jobs/retrieve/) · [Retrieve a job result](https://docs.shixux.com/en/common/api/jobs/result/) | | Webhooks | [Create an endpoint](https://docs.shixux.com/en/common/api/webhooks/create/) · [List endpoints](https://docs.shixux.com/en/common/api/webhooks/list/) · [Retrieve an endpoint](https://docs.shixux.com/en/common/api/webhooks/retrieve/) · [Update an endpoint](https://docs.shixux.com/en/common/api/webhooks/update/) · [Delete an endpoint](https://docs.shixux.com/en/common/api/webhooks/delete/) · [Rotate the signing secret](https://docs.shixux.com/en/common/api/webhooks/rotate-secret/) · [Send a test event](https://docs.shixux.com/en/common/api/webhooks/test/) · [List deliveries](https://docs.shixux.com/en/common/api/webhooks/deliveries/) · [Redeliver an event](https://docs.shixux.com/en/common/api/webhooks/redeliver/) | | API Keys | [Create an API Key](https://docs.shixux.com/en/common/api/keys/create/) · [List API Keys](https://docs.shixux.com/en/common/api/keys/list/) · [Revoke an API Key](https://docs.shixux.com/en/common/api/keys/revoke/) | | Capabilities | [Get available capabilities](https://docs.shixux.com/en/common/api/capabilities/) | --- # 通用能力 URL: https://docs.shixux.com/zh/common/ 以下规则适用于多类模型。 | 主题 | 说明 | 适用模型 | | --- | --- | --- | | [认证](https://docs.shixux.com/zh/common/authentication/) | API Key 的使用方式及各类接口的认证要求 | 全部 | | [异步任务](https://docs.shixux.com/zh/common/jobs/) | 任务状态、轮询、获取结果与幂等重试 | 音频、图片、视频 | | [素材上传](https://docs.shixux.com/zh/common/uploads/) | 申请上传地址、上传文件、确认完成并引用素材 | 音频、图片、视频 | | [Webhook](https://docs.shixux.com/zh/common/webhooks/) | 任务完成通知、签名验证、去重与重试 | 音频、图片、视频 | ## 接口参考 | 分组 | 接口 | | --- | --- | | 上传 | [申请上传地址](https://docs.shixux.com/zh/common/api/uploads/create/) · [确认上传完成](https://docs.shixux.com/zh/common/api/uploads/complete/) | | 任务 | [列出任务](https://docs.shixux.com/zh/common/api/jobs/list/) · [查询任务](https://docs.shixux.com/zh/common/api/jobs/retrieve/) · [获取任务结果](https://docs.shixux.com/zh/common/api/jobs/result/) | | Webhook | [创建端点](https://docs.shixux.com/zh/common/api/webhooks/create/) · [列出端点](https://docs.shixux.com/zh/common/api/webhooks/list/) · [查询端点](https://docs.shixux.com/zh/common/api/webhooks/retrieve/) · [更新端点](https://docs.shixux.com/zh/common/api/webhooks/update/) · [删除端点](https://docs.shixux.com/zh/common/api/webhooks/delete/) · [轮换签名密钥](https://docs.shixux.com/zh/common/api/webhooks/rotate-secret/) · [发送测试事件](https://docs.shixux.com/zh/common/api/webhooks/test/) · [查询投递记录](https://docs.shixux.com/zh/common/api/webhooks/deliveries/) · [重新投递事件](https://docs.shixux.com/zh/common/api/webhooks/redeliver/) | | API Key | [创建 API Key](https://docs.shixux.com/zh/common/api/keys/create/) · [列出 API Key](https://docs.shixux.com/zh/common/api/keys/list/) · [撤销 API Key](https://docs.shixux.com/zh/common/api/keys/revoke/) | | 能力查询 | [查询可用能力](https://docs.shixux.com/zh/common/api/capabilities/) | --- # Asynchronous jobs URL: https://docs.shixux.com/en/common/jobs/ Audio, image and video generation endpoints process requests as asynchronous jobs. They return `202` with the job right away, and generation continues in the background. ## Job states | State | Meaning | What to do | | --- | --- | --- | | `queued` | The job is created and credits are reserved; it is waiting to be processed | Keep checking | | `processing` | Generation is in progress | Keep checking | | `succeeded` | Generation succeeded and actual usage is settled | Fetch the result | | `failed` | Generation failed and reserved credits were refunded automatically | Read `error_code` and `error_message` | | `cancelled` | The job was stopped | Whether credits are refunded is given in the [stop job](https://docs.shixux.com/en/video/api/cancel/) response | `progress` may be `null`; this does not mean the job has stalled. Use `status` to track the job. ## Know when a job finishes There are two ways: - **Polling**: call [Retrieve a job](https://docs.shixux.com/en/common/api/jobs/retrieve/) until the job reaches `succeeded`, `failed` or `cancelled`. Start with an interval of a few seconds and lengthen it over time. - **Webhooks**: pass `webhook_endpoint_id` when you submit a generation request, and a signed notification is sent to your endpoint when the job ends. See [Webhooks](https://docs.shixux.com/en/common/webhooks/). Webhooks do not guarantee ordering across jobs. Even with webhooks, keep polling as a fallback in case your endpoint is temporarily unavailable. ## Fetch results After a job succeeds, call [Retrieve a job result](https://docs.shixux.com/en/common/api/jobs/result/) to get the download URL `result_url`. It is a short-lived signed URL whose lifetime in seconds is given by `expires_in`; call the endpoint again for a new URL after it expires. `retained_until` is when the result file stops being retained. [List jobs](https://docs.shixux.com/en/common/api/jobs/list/) returns your account's job history and can filter by `type`, `status` and `idempotency_key`. Each page returns up to `limit` jobs (1–100, default 20). When more results exist, the `X-Next-Cursor` response header carries the cursor for the next page; pass it as the `cursor` parameter. ## Retry safely with idempotency keys Send an `Idempotency-Key` header with generation requests. Its value is a unique string of up to 128 characters that identifies the business operation, such as an order number in your system. - A retry with the same key and the same request parameters returns the job created by the first request, without creating another job or charging again. - Using the same key with different request parameters returns `409 IDEMPOTENCY_CONFLICT`. Use a new key for every new business operation. - [Create an audio composition](https://docs.shixux.com/en/audio/api/audio-composition/) and [Resolve an image submission](https://docs.shixux.com/en/image/api/submission-resolution/) require this header. Other generation endpoints accept requests without it, but such requests cannot be deduplicated, so a retry after a timeout may create another job and reserve credits again. ## After a network timeout A client timeout does not mean the job was not created. Handle it in this order: 1. If you already have the job ID, retrieve that job. 2. If you do not, retry with the same request parameters and the same idempotency key, or look the job up in the job list with the `idempotency_key` parameter. 3. Submit with a new idempotency key only when this really is a new business operation. Webhooks are delivered at least once, so the same event may arrive more than once. See [Webhooks](https://docs.shixux.com/en/common/webhooks/) for deduplication. --- # 异步任务 URL: https://docs.shixux.com/zh/common/jobs/ 音频、图片和视频生成接口均以异步任务处理:提交请求后立即返回 `202` 和任务信息,生成在后台进行。 ## 任务状态 | 状态 | 含义 | 建议处理 | | --- | --- | --- | | `queued` | 任务已创建并预扣积分,等待处理 | 继续查询 | | `processing` | 正在生成 | 继续查询 | | `succeeded` | 生成成功,已按实际用量结算 | 获取结果 | | `failed` | 生成失败,预扣积分已自动退回 | 读取 `error_code` 和 `error_message` | | `cancelled` | 任务已停止 | 积分是否退回以[停止任务接口](https://docs.shixux.com/zh/video/api/cancel/)的返回为准 | `progress` 字段可能为 `null`,这不代表任务停滞。请以 `status` 判断任务进展。 ## 获知任务完成 有两种方式: - **轮询**:调用[查询任务](https://docs.shixux.com/zh/common/api/jobs/retrieve/),直到任务进入 `succeeded`、`failed` 或 `cancelled`。建议从数秒的间隔开始,逐步拉长。 - **Webhook**:提交生成请求时传入 `webhook_endpoint_id`,任务结束后会向你的端点发送签名通知,详见 [Webhook](https://docs.shixux.com/zh/common/webhooks/)。 Webhook 不保证不同任务之间的通知顺序。即使使用 Webhook,也建议保留轮询作为补充,以应对端点暂时不可用的情况。 ## 获取结果 任务成功后,调用[获取任务结果](https://docs.shixux.com/zh/common/api/jobs/result/)取得下载地址 `result_url`。下载地址为短时有效的签名地址,有效秒数见 `expires_in`;过期后再次调用该接口即可获取新地址。`retained_until` 为结果文件的保留截止时间。 [列出任务](https://docs.shixux.com/zh/common/api/jobs/list/)用于查询账号下的历史任务,支持按 `type`、`status` 和 `idempotency_key` 筛选。每页最多返回 `limit` 条(1–100,默认 20);还有更多结果时,响应头 `X-Next-Cursor` 返回下一页的游标,将其作为 `cursor` 参数传入即可翻页。 ## 使用幂等键安全重试 为生成请求携带 `Idempotency-Key` 请求头,值为代表本次业务操作的唯一字符串(最长 128 个字符),例如你系统中的订单号。 - 使用相同的键和相同的请求参数重试时,返回首次创建的任务,不会重复创建任务或重复扣费。 - 同一个键用于不同的请求参数时,返回 `409 IDEMPOTENCY_CONFLICT`。每个新的业务操作请使用新的键。 - [创建音频编排](https://docs.shixux.com/zh/audio/api/audio-composition/)和[处理图片提交回执](https://docs.shixux.com/zh/image/api/submission-resolution/)必须携带该请求头;其他生成接口虽可省略,但不带幂等键时无法去重,超时后重试可能创建新任务并再次预扣积分。 ## 网络超时后的处理 客户端超时不代表任务未创建。请按以下顺序处理: 1. 如果已经拿到任务 ID,直接查询该任务。 2. 如果没有任务 ID,使用相同的请求参数和相同的幂等键重试;也可以用 `idempotency_key` 参数在任务列表中查找。 3. 只有确认这是一个新的业务操作时,才使用新的幂等键提交。 Webhook 采用至少一次投递,同一事件可能收到多次,去重方法见 [Webhook](https://docs.shixux.com/zh/common/webhooks/)。 --- # Uploads URL: https://docs.shixux.com/en/common/uploads/ Voice references, emotion references, reference images, reference videos and other media must be uploaded before [audio](https://docs.shixux.com/en/audio/), [image](https://docs.shixux.com/en/image/) and [video](https://docs.shixux.com/en/video/) generation requests can reference them. Text models do not use uploads. An upload takes three steps: request an upload URL, upload the file and confirm completion. ## 1. Request an upload URL Call [POST /v1/uploads](https://docs.shixux.com/en/common/api/uploads/create/) with `filename`, `content_type` and the actual file size `size_bytes`, and set `purpose` to the intended use: | `purpose` | Use | Format and size | | --- | --- | --- | | `voice_reference` | Voice reference used as the voice for speech synthesis | WAV, up to 20 MiB | | `emotion_reference` | Emotion reference for `indextts-2` emotion control | WAV, up to 20 MiB | | `audio_material` | Sound effect or music in an audio composition | WAV or MP3, up to 100 MiB | | `image_reference` | Reference image for image-to-image | PNG, JPEG or WebP, up to 20 MiB | | `video_image` | Reference image or first/last frame for video generation | PNG, JPEG or WebP, up to 20 MiB | | `video_clip` | Reference video for video generation | MP4, up to 50 MiB | | `video_audio` | Reference audio for video generation | WAV or MP3, up to 15 MiB | Always send the `purpose` that matches the actual use; generation endpoints check it when they reference the asset. The `filename` extension must match `content_type`. Make sure you have permission before uploading someone else's voice or likeness. You can send `rights_confirmed: true` to record your confirmation. ## 2. Upload the file Send the raw file content with `PUT` to `upload_url` from the response, including every header in the response `headers` unchanged. The upload URL is valid for 300 seconds. Do not send your API Key to the upload URL. ```bash curl -X PUT "$UPLOAD_URL" \ -H 'Content-Type: audio/wav' \ --data-binary '@voice.wav' ``` ## 3. Confirm the upload After the upload succeeds, call [`POST /v1/uploads/{asset_id}/complete`](https://docs.shixux.com/en/common/api/uploads/complete/). The service checks the file size and format, and only confirmed assets can be used for generation. Confirm within one hour of requesting the URL; unconfirmed uploads are removed after that. Once confirmed, reference the asset by `asset_id` in generation requests. For example, use a voice reference as `voice_asset_id` in speech synthesis, an emotion reference as `emo_asset_id`, and a reference image in `reference_asset_ids` for image generation. ## Upload allowance - All API Keys and the console of one account share the upload allowance: up to 30 upload requests per minute and up to 500 MiB in any rolling 24-hour period. There is no daily limit on the number of uploads. - `size_bytes` counts toward the 24-hour allowance as soon as the upload URL is issued. Failed uploads and deleted assets do not give it back; the allowance recovers as the window moves on. - Saving a designed voice does not use the upload allowance. When the allowance is exceeded, the API returns `429` with the error code `UPLOAD_RATE_LIMITED` (too many requests) or `UPLOAD_QUOTA_EXCEEDED` (too many bytes). The `quota` object in the response contains the limit type `kind`, the limit `limit`, the amount used `used` and the amount requested `requested`. When a recovery time can be estimated, `quota.retry_at` gives it as an RFC 3339 timestamp and the `Retry-After` header gives the seconds to wait. Retry after that time rather than retrying in a loop. --- # 素材上传 URL: https://docs.shixux.com/zh/common/uploads/ 声音参考、情绪参考、参考图片和参考视频等素材需要先上传,才能在[音频](https://docs.shixux.com/zh/audio/)、[图片](https://docs.shixux.com/zh/image/)和[视频](https://docs.shixux.com/zh/video/)生成请求中引用。文本模型无需上传素材。 上传分三步:申请上传地址、上传文件、确认完成。 ## 1. 申请上传地址 调用 [POST /v1/uploads](https://docs.shixux.com/zh/common/api/uploads/create/),传入 `filename`、`content_type` 和文件的实际大小 `size_bytes`,并通过 `purpose` 指明素材用途: | `purpose` | 用途 | 格式与大小 | | --- | --- | --- | | `voice_reference` | 声音参考,用作语音合成的音色 | WAV,最大 20 MiB | | `emotion_reference` | 情绪参考,用于 `indextts-2` 的情绪控制 | WAV,最大 20 MiB | | `audio_material` | 音频编排中的音效或配乐 | WAV 或 MP3,最大 100 MiB | | `image_reference` | 图生图的参考图片 | PNG、JPEG 或 WebP,最大 20 MiB | | `video_image` | 视频生成的参考图片或首尾帧 | PNG、JPEG 或 WebP,最大 20 MiB | | `video_clip` | 视频生成的参考视频 | MP4,最大 50 MiB | | `video_audio` | 视频生成的参考音频 | WAV 或 MP3,最大 15 MiB | 请始终传入与实际用途一致的 `purpose`,生成接口引用素材时会校验其用途。`filename` 的扩展名必须与 `content_type` 一致。 上传他人的声音或肖像前,请确保已取得授权;可传入 `rights_confirmed: true` 记录你的确认。 ## 2. 上传文件 用 `PUT` 将文件原始内容发送到响应中的 `upload_url`,并原样携带响应 `headers` 中的全部请求头。上传地址有效期为 300 秒。不要向上传地址发送 API Key。 ```bash curl -X PUT "$UPLOAD_URL" \ -H 'Content-Type: audio/wav' \ --data-binary '@voice.wav' ``` ## 3. 确认上传完成 上传成功后,调用 [`POST /v1/uploads/{asset_id}/complete`](https://docs.shixux.com/zh/common/api/uploads/complete/)。服务会核对文件大小和格式,确认通过后素材才能用于生成。请在申请地址后 1 小时内完成确认,逾期未确认的上传会被清理。 确认完成后,在生成请求中通过 `asset_id` 引用素材。例如,声音参考作为语音合成的 `voice_asset_id`,情绪参考作为 `emo_asset_id`,参考图片作为图片生成的 `reference_asset_ids`。 ## 上传额度 - 同一账号下的所有 API Key 和控制台共用上传额度:每分钟最多申请 30 次上传,任意连续 24 小时内最多上传 500 MiB。不限制每日上传次数。 - 申请上传地址时即按 `size_bytes` 计入 24 小时额度。上传失败或删除素材不会返还已计入的额度,额度随时间窗口滚动恢复。 - 保存设计音色不占用上传额度。 超出额度时返回 `429`,错误码为 `UPLOAD_RATE_LIMITED`(次数超限)或 `UPLOAD_QUOTA_EXCEEDED`(容量超限)。响应中的 `quota` 包含限额类型 `kind`、上限 `limit`、已用量 `used` 和本次申请量 `requested`。可以估算恢复时间时,`quota.retry_at` 返回 RFC 3339 格式的时间,`Retry-After` 响应头返回需等待的秒数,请在此之后再重试,不要循环自动重试。 --- # Webhooks URL: https://docs.shixux.com/en/common/webhooks/ Webhooks notify your server when an asynchronous [audio](https://docs.shixux.com/en/audio/), [image](https://docs.shixux.com/en/image/) or [video](https://docs.shixux.com/en/video/) job ends. Text models return results directly and do not use webhooks. ## Register an endpoint 1. Call [Create a webhook endpoint](https://docs.shixux.com/en/common/api/webhooks/create/) with a publicly reachable HTTPS URL. 2. Save the signing secret that starts with `whsec_` from the response right away. It is shown only this once. 3. Pass the endpoint's `webhook_endpoint_id` when you submit generation requests. When a job succeeds or fails, a `job.succeeded` or `job.failed` event is sent to the endpoint. Call [Send a test event](https://docs.shixux.com/en/common/api/webhooks/test/) to send an `endpoint.test` event and check your receiver. Examples of the three events: job.succeeded ```json { "id": "evt_0123456789abcdef0123456789abcdef", "api_version": "2026-09-01", "created_at": "2026-10-06T10:00:00Z", "type": "job.succeeded", "data": { "job": { "id": "job_xxx", "type": "tts", "status": "succeeded", "finished_at": "2026-10-06T10:00:00Z", "result_endpoint": "https://shixux.com/api/v1/jobs/job_xxx/result" } } } ``` job.failed ```json { "id": "evt_0123456789abcdef0123456789abcdef", "api_version": "2026-09-01", "created_at": "2026-10-06T10:00:00Z", "type": "job.failed", "data": { "job": { "id": "job_xxx", "type": "video", "status": "failed", "finished_at": "2026-10-06T10:00:00Z", "error": { "code": "GENERATION_FAILED", "message": "The generation job could not be completed." } } } } ``` endpoint.test ```json { "id": "evt_0123456789abcdef0123456789abcdef", "api_version": "2026-09-01", "created_at": "2026-10-06T10:00:00Z", "type": "endpoint.test", "data": { "endpoint": { "id": "whe_0123456789abcdef0123456789abcdef", "name": "production" } } } ``` A notification contains the job status and `result_endpoint`, the endpoint for fetching the result. It does not contain a file download URL. After receiving `job.succeeded`, call [Retrieve a job result](https://docs.shixux.com/en/common/api/jobs/result/) to get the download URL. ## Verify signatures Every notification carries these headers: | Header | Description | | --- | --- | | `X-YB-Timestamp` | Send time as a Unix timestamp in seconds | | `X-YB-Signature` | Signature in the form `v1=`; during secret rotation it may contain several comma-separated values | | `X-YB-Delivery-ID` | Delivery ID used for deduplication | To verify a notification: 1. Concatenate the `X-YB-Timestamp` value, a period `.` and the raw request body bytes, and processing HMAC-SHA256 with the signing secret. 2. Using a constant-time comparison, check that the result matches any `v1` value in `X-YB-Signature`. 3. Reject requests whose timestamp differs from the current time by more than 5 minutes. processing the signature over the raw request body as received; do not parse the JSON and serialize it again. The examples below are ready to use. In Node.js, obtain the raw `Buffer` first; in Python, use the raw `bytes`. ```javascript import { createHmac, timingSafeEqual } from 'node:crypto'; export function verifyWebhook(rawBody, headers, secret) { const timestamp = headers['x-yb-timestamp']; const signature = headers['x-yb-signature']; if (typeof timestamp !== 'string' || !/^\d+$/.test(timestamp) || typeof signature !== 'string') return false; const sentAt = Number(timestamp); if (!Number.isSafeInteger(sentAt) || Math.abs(Date.now() / 1000 - sentAt) > 300) return false; const expected = createHmac('sha256', secret).update(timestamp + '.').update(rawBody).digest(); return signature.split(',').some(part => { const value = part.trim(); if (!/^v1=[a-fA-F0-9]{64}$/.test(value)) return false; return timingSafeEqual(Buffer.from(value.slice(3), 'hex'), expected); }); } ``` ```python import hashlib, hmac, time def verify_webhook(raw_body: bytes, headers: dict, secret: str) -> bool: headers = {key.lower(): value for key, value in headers.items()} timestamp = headers.get("x-yb-timestamp", "") signature = headers.get("x-yb-signature", "") if not timestamp.isascii() or not timestamp.isdigit(): return False if abs(time.time() - int(timestamp)) > 300: return False expected = hmac.new(secret.encode(), timestamp.encode() + b"." + raw_body, hashlib.sha256).hexdigest() return any(part.strip().startswith("v1=") and hmac.compare_digest(part.strip()[3:], expected) for part in signature.split(",")) ``` ```go package webhook import ( "crypto/hmac" "crypto/sha256" "encoding/hex" "math" "strconv" "strings" "time" ) func VerifyWebhook(body []byte, timestamp, signature, secret string) bool { sentAt, err := strconv.ParseInt(timestamp, 10, 64) if err != nil || math.Abs(float64(time.Now().Unix())-float64(sentAt)) > 300 { return false } mac := hmac.New(sha256.New, []byte(secret)) mac.Write([]byte(timestamp + ".")) mac.Write(body) expected := mac.Sum(nil) for _, part := range strings.Split(signature, ",") { value := strings.TrimSpace(part) if !strings.HasPrefix(value, "v1=") { continue } actual, err := hex.DecodeString(strings.TrimPrefix(value, "v1=")) if err == nil && hmac.Equal(actual, expected) { return true } } return false } ``` ## Respond quickly and deduplicate After verifying the signature, return a 2xx status within 5 seconds and process your business logic asynchronously. Webhooks are delivered at least once: the same event may arrive more than once, and ordering across jobs is not guaranteed. Deduplicate by `X-YB-Delivery-ID` so that repeated deliveries do not repeat business operations. ## Timeouts and retries Each delivery attempt times out after 5 seconds. If no 2xx response is received, the delivery is retried after 30 seconds, 2 minutes, 10 minutes, 30 minutes, 2 hours, 6 hours and 24 hours, for at most 8 attempts in total. - 3xx redirects are not followed. - If the endpoint returns `429` or `503` with `Retry-After`, the next attempt is delayed accordingly, by up to 24 hours. - After all attempts fail, check the cause in [delivery records](https://docs.shixux.com/en/common/api/webhooks/deliveries/) and call [Redeliver an event](https://docs.shixux.com/en/common/api/webhooks/redeliver/). While your endpoint is unavailable, you can still use [Retrieve a job](https://docs.shixux.com/en/common/api/jobs/retrieve/) and [Retrieve a job result](https://docs.shixux.com/en/common/api/jobs/result/) to follow job progress. ## Rotate the signing secret Call [Rotate the signing secret](https://docs.shixux.com/en/common/api/webhooks/rotate-secret/) to get a new secret and store it securely. For 48 hours after rotation, notifications are signed with both the new and the previous secret, and a match on any `v1` value is valid. Switch your receiver to the new secret during this period. You cannot rotate again until the 48-hour transition of the previous rotation has ended. ## Manage endpoints [List endpoints](https://docs.shixux.com/en/common/api/webhooks/list/) · [Retrieve an endpoint](https://docs.shixux.com/en/common/api/webhooks/retrieve/) · [Update an endpoint](https://docs.shixux.com/en/common/api/webhooks/update/) · [Delete an endpoint](https://docs.shixux.com/en/common/api/webhooks/delete/) · [Rotate the signing secret](https://docs.shixux.com/en/common/api/webhooks/rotate-secret/) · [List deliveries](https://docs.shixux.com/en/common/api/webhooks/deliveries/) · [Redeliver an event](https://docs.shixux.com/en/common/api/webhooks/redeliver/) After an endpoint is deleted, deliveries that have not completed are no longer sent. --- # Webhook URL: https://docs.shixux.com/zh/common/webhooks/ Webhook 用于在[音频](https://docs.shixux.com/zh/audio/)、[图片](https://docs.shixux.com/zh/image/)和[视频](https://docs.shixux.com/zh/video/)异步任务结束时,向你的服务器发送通知。文本模型直接返回结果,不使用 Webhook。 ## 注册端点 1. 调用[创建 Webhook 端点](https://docs.shixux.com/zh/common/api/webhooks/create/),提交可公网访问的 HTTPS 地址。 2. 立即保存响应中以 `whsec_` 开头的签名密钥。密钥只显示这一次。 3. 提交生成请求时传入该端点的 `webhook_endpoint_id`。 任务成功或失败后,会向端点发送 `job.succeeded` 或 `job.failed` 事件。调用[发送测试事件](https://docs.shixux.com/zh/common/api/webhooks/test/)可发送一条 `endpoint.test` 事件,用于验证接收逻辑。 三种事件的示例: job.succeeded ```json { "id": "evt_0123456789abcdef0123456789abcdef", "api_version": "2026-09-01", "created_at": "2026-10-06T10:00:00Z", "type": "job.succeeded", "data": { "job": { "id": "job_xxx", "type": "tts", "status": "succeeded", "finished_at": "2026-10-06T10:00:00Z", "result_endpoint": "https://shixux.com/api/v1/jobs/job_xxx/result" } } } ``` job.failed ```json { "id": "evt_0123456789abcdef0123456789abcdef", "api_version": "2026-09-01", "created_at": "2026-10-06T10:00:00Z", "type": "job.failed", "data": { "job": { "id": "job_xxx", "type": "video", "status": "failed", "finished_at": "2026-10-06T10:00:00Z", "error": { "code": "GENERATION_FAILED", "message": "The generation job could not be completed." } } } } ``` endpoint.test ```json { "id": "evt_0123456789abcdef0123456789abcdef", "api_version": "2026-09-01", "created_at": "2026-10-06T10:00:00Z", "type": "endpoint.test", "data": { "endpoint": { "id": "whe_0123456789abcdef0123456789abcdef", "name": "production" } } } ``` 通知中包含任务状态和获取结果的接口地址 `result_endpoint`,不包含文件下载地址。收到 `job.succeeded` 后,请调用[获取任务结果](https://docs.shixux.com/zh/common/api/jobs/result/)取得下载地址。 ## 验证签名 每个通知都带有以下请求头: | 请求头 | 说明 | | --- | --- | | `X-YB-Timestamp` | 发送时间,Unix 秒级时间戳 | | `X-YB-Signature` | 签名,格式为 `v1=<十六进制摘要>`;轮换密钥期间可能包含多个以逗号分隔的值 | | `X-YB-Delivery-ID` | 投递 ID,用于去重 | 验证步骤: 1. 将 `X-YB-Timestamp` 的值、英文句点 `.` 和原始请求体字节依次拼接,以签名密钥计算 HMAC-SHA256。 2. 使用常量时间比较,确认结果与 `X-YB-Signature` 中任一 `v1` 值一致。 3. 拒绝时间戳与当前时间相差超过 5 分钟的请求。 请使用接收到的原始请求体计算签名,不要先解析 JSON 再重新序列化。以下示例可直接使用:Node.js 需先取得原始 `Buffer`,Python 需使用原始 `bytes`。 ```javascript import { createHmac, timingSafeEqual } from 'node:crypto'; export function verifyWebhook(rawBody, headers, secret) { const timestamp = headers['x-yb-timestamp']; const signature = headers['x-yb-signature']; if (typeof timestamp !== 'string' || !/^\d+$/.test(timestamp) || typeof signature !== 'string') return false; const sentAt = Number(timestamp); if (!Number.isSafeInteger(sentAt) || Math.abs(Date.now() / 1000 - sentAt) > 300) return false; const expected = createHmac('sha256', secret).update(timestamp + '.').update(rawBody).digest(); return signature.split(',').some(part => { const value = part.trim(); if (!/^v1=[a-fA-F0-9]{64}$/.test(value)) return false; return timingSafeEqual(Buffer.from(value.slice(3), 'hex'), expected); }); } ``` ```python import hashlib, hmac, time def verify_webhook(raw_body: bytes, headers: dict, secret: str) -> bool: headers = {key.lower(): value for key, value in headers.items()} timestamp = headers.get("x-yb-timestamp", "") signature = headers.get("x-yb-signature", "") if not timestamp.isascii() or not timestamp.isdigit(): return False if abs(time.time() - int(timestamp)) > 300: return False expected = hmac.new(secret.encode(), timestamp.encode() + b"." + raw_body, hashlib.sha256).hexdigest() return any(part.strip().startswith("v1=") and hmac.compare_digest(part.strip()[3:], expected) for part in signature.split(",")) ``` ```go package webhook import ( "crypto/hmac" "crypto/sha256" "encoding/hex" "math" "strconv" "strings" "time" ) func VerifyWebhook(body []byte, timestamp, signature, secret string) bool { sentAt, err := strconv.ParseInt(timestamp, 10, 64) if err != nil || math.Abs(float64(time.Now().Unix())-float64(sentAt)) > 300 { return false } mac := hmac.New(sha256.New, []byte(secret)) mac.Write([]byte(timestamp + ".")) mac.Write(body) expected := mac.Sum(nil) for _, part := range strings.Split(signature, ",") { value := strings.TrimSpace(part) if !strings.HasPrefix(value, "v1=") { continue } actual, err := hex.DecodeString(strings.TrimPrefix(value, "v1=")) if err == nil && hmac.Equal(actual, expected) { return true } } return false } ``` ## 快速响应与去重 验证签名后,请在 5 秒内返回 2xx 状态码,再异步处理业务逻辑。 Webhook 采用至少一次投递:同一事件可能送达多次,不同任务之间也不保证顺序。请以 `X-YB-Delivery-ID` 去重,确保重复送达不会导致业务操作重复执行。 ## 超时与重试 每次投递的超时时间为 5 秒。未收到 2xx 响应时,会在首次投递后依次间隔 30 秒、2 分钟、10 分钟、30 分钟、2 小时、6 小时和 24 小时重试,最多投递 8 次。 - 不跟随 3xx 重定向。 - 端点返回 `429` 或 `503` 并带有 `Retry-After` 时,按其指定时间延后重试,最长 24 小时。 - 全部重试失败后,可以在[投递记录](https://docs.shixux.com/zh/common/api/webhooks/deliveries/)中查看原因,并调用[重新投递](https://docs.shixux.com/zh/common/api/webhooks/redeliver/)。 端点不可用期间,仍可通过[查询任务](https://docs.shixux.com/zh/common/api/jobs/retrieve/)和[获取任务结果](https://docs.shixux.com/zh/common/api/jobs/result/)获取任务进展。 ## 轮换签名密钥 调用[轮换签名密钥](https://docs.shixux.com/zh/common/api/webhooks/rotate-secret/)获取新密钥,并安全保存。轮换后 48 小时内,通知会同时使用新旧密钥签名,签名头中任一 `v1` 值验证通过即可。请在此期间将接收端切换到新密钥。上一次轮换的 48 小时过渡期结束前,不能再次轮换。 ## 管理端点 [列出端点](https://docs.shixux.com/zh/common/api/webhooks/list/) · [查询端点](https://docs.shixux.com/zh/common/api/webhooks/retrieve/) · [更新端点](https://docs.shixux.com/zh/common/api/webhooks/update/) · [删除端点](https://docs.shixux.com/zh/common/api/webhooks/delete/) · [轮换签名密钥](https://docs.shixux.com/zh/common/api/webhooks/rotate-secret/) · [查询投递记录](https://docs.shixux.com/zh/common/api/webhooks/deliveries/) · [重新投递事件](https://docs.shixux.com/zh/common/api/webhooks/redeliver/) 删除端点后,尚未完成的投递将不再发送。 --- # Get an API Key URL: https://docs.shixux.com/en/getting-started/keys/ ## Create an API Key Sign in and create an API Key on the [API Keys page of the console](https://console.shixux.com/keys?lang=en). The full key is shown only once, when it is created. Store it right away in a server environment variable, a secret manager or an encrypted CI variable. Send the API Key with every request in the `X-API-Key` header or as `Authorization: Bearer`. See [Authentication](https://docs.shixux.com/en/common/authentication/). **Protect your API Key** An API Key calls the API on behalf of your account and spends its credits. Do not put it in browser code, mobile app packages, logs or public repositories. If a key is exposed, revoke it in the console immediately and create a new one. `yb_xxx_yyy` in these examples is a placeholder. --- # 获取 API Key URL: https://docs.shixux.com/zh/getting-started/keys/ ## 创建 API Key 登录后,在[控制台的 API Key 页面](https://console.shixux.com/keys?lang=zh)创建 API Key。完整的 API Key 只在创建时显示一次,请立即保存到服务器环境变量、密钥管理服务或 CI 的加密变量中。 每次请求通过 `X-API-Key` 请求头或 `Authorization: Bearer` 传入 API Key,详见[认证](https://docs.shixux.com/zh/common/authentication/)。 **保护 API Key** API Key 代表你的账号调用接口并消耗积分。不要将其写入浏览器端代码、移动应用安装包、日志或公开代码仓库。API Key 泄露后,请立即在控制台撤销并创建新的 API Key。本文档示例中的 `yb_xxx_yyy` 为占位值。 --- # Your first request URL: https://docs.shixux.com/en/getting-started/quickstart/ This example uses speech synthesis to walk through the full asynchronous job flow: submit a job, check its status and fetch the result. Requests go to the API Base URL `https://shixux.com/api`. Run them on your server and replace `yb_xxx_yyy` with your [API Key](https://docs.shixux.com/en/getting-started/keys/). ## 1. Submit a job ```bash curl -X POST 'https://shixux.com/api/v1/tts' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: tts-order-1001' \ -d '{"text":"Hello from Shixu.","voice_preset_id":"vp_000000000000000000000001"}' ``` The request body contains the `text` to synthesize and one voice. This example uses a [preset voice](https://docs.shixux.com/en/audio/api/voices/presets/). To use your own voice, [upload it](https://docs.shixux.com/en/common/uploads/) first. The API returns `202` with the job. Save its `id`, such as `job_xxx`. `Idempotency-Key` makes retries safe: if you resend the same request after a network problem with the same value, no duplicate job is created. See [Asynchronous jobs](https://docs.shixux.com/en/common/jobs/). ## 2. Check the job status ```bash curl 'https://shixux.com/api/v1/jobs/job_xxx' \ -H 'X-API-Key: yb_xxx_yyy' ``` While the job is `queued` or `processing`, check again after a few seconds and lengthen the interval over time. Fetch the result once the status is `succeeded`. If it is `failed`, read `error_code` and `error_message`; reserved credits are refunded automatically. Do not submit a new generation request in place of checking the status. ## 3. Fetch the result ```bash curl 'https://shixux.com/api/v1/jobs/job_xxx/result' \ -H 'X-API-Key: yb_xxx_yyy' ``` Download the audio from `result_url`. `expires_in` is the lifetime of the download URL in seconds, and `retained_until` is when the result file stops being retained. Call this endpoint again to get a new URL after the old one expires. ## Next steps - See the [speech synthesis endpoint](https://docs.shixux.com/en/audio/api/tts/) for every parameter, with cURL, JavaScript, Python and Go examples. - In production, use [webhooks](https://docs.shixux.com/en/common/webhooks/) to be notified when jobs finish instead of polling. - To call text models, see the [text model guide](https://docs.shixux.com/en/text/guide/). --- # 第一条请求 URL: https://docs.shixux.com/zh/getting-started/quickstart/ 以下示例以语音合成为例,演示异步任务的完整流程:提交任务、查询状态、获取结果。请求发往 API Base URL `https://shixux.com/api`,请在服务器端运行,并将 `yb_xxx_yyy` 替换为你的 [API Key](https://docs.shixux.com/zh/getting-started/keys/)。 ## 1. 提交任务 ```bash curl -X POST 'https://shixux.com/api/v1/tts' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: tts-order-1001' \ -d '{"text":"你好,欢迎使用时序科技。","voice_preset_id":"vp_000000000000000000000001"}' ``` 请求体包含要合成的 `text` 和一个音色。示例使用[预置音色](https://docs.shixux.com/zh/audio/api/voices/presets/);如需使用自己的声音,请先[上传素材](https://docs.shixux.com/zh/common/uploads/)。 接口返回 `202` 和任务信息,请保存其中的 `id`(如 `job_xxx`)。`Idempotency-Key` 用于安全重试:因网络问题重发同一请求时,使用相同的值不会重复创建任务,详见[异步任务](https://docs.shixux.com/zh/common/jobs/)。 ## 2. 查询任务状态 ```bash curl 'https://shixux.com/api/v1/jobs/job_xxx' \ -H 'X-API-Key: yb_xxx_yyy' ``` 任务处于 `queued` 或 `processing` 时,间隔数秒后再次查询,并逐步拉长间隔。状态变为 `succeeded` 后获取结果;变为 `failed` 时读取 `error_code` 和 `error_message`,预扣的积分会自动退回。不要通过重新提交生成请求来代替状态查询。 ## 3. 获取结果 ```bash curl 'https://shixux.com/api/v1/jobs/job_xxx/result' \ -H 'X-API-Key: yb_xxx_yyy' ``` 通过响应中的 `result_url` 下载音频。`expires_in` 是下载地址的有效秒数,`retained_until` 是结果文件的保留截止时间。下载地址过期后,再次调用此接口即可获取新地址。 ## 下一步 - 查看[语音合成接口](https://docs.shixux.com/zh/audio/api/tts/)的完整参数及 cURL、JavaScript、Python、Go 示例。 - 在生产环境中使用 [Webhook](https://docs.shixux.com/zh/common/webhooks/) 接收任务完成通知,减少轮询。 - 调用文本模型请参阅[文本模型接入指南](https://docs.shixux.com/zh/text/guide/)。 --- # Get image generation settings URL: https://docs.shixux.com/en/image/api/config/ Get whether image generation is available, the available models and sizes, reference image limits, reference image surcharges and the current rate version. No authentication is required. Submit only the models and sizes this endpoint returns. GET /v1/image/config {"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"reference_rates":{"type":"object","description":"Per-model reference image surcharge in credits. Models absent from this map do not charge for reference images.","additionalProperties":{"type":"object","required":["credits","free_images"],"properties":{"credits":{"type":"number","minimum":0},"free_images":{"type":"integer","minimum":0}}}},"max_reference_images":{"type":"object","description":"Maximum number of input images per model.","additionalProperties":{"type":"integer","minimum":1,"maximum":10}},"available":{"type":"boolean"},"billing":{"properties":{"rates":{"items":{"properties":{"credits":{"anyOf":[{"exclusiveMinimum":0,"maximum":1000000,"type":"number"},{"type":"null"}]},"model":{"enum":["doubao-seedream-5-0-pro-260628","doubao-seedream-5-0-flash-260915","doubao-seedream-5-5-261028","sx-image-2.6-sunburst"],"type":"string"},"size":{"enum":["1024x1024","1536x1024","1024x1536","2048x2048","2048x1152","1152x2048"],"type":"string"}},"required":["model","size","credits"],"type":"object"},"type":"array"},"updated_at":{"format":"date-time","type":"string"},"version":{"type":"integer"}},"required":["rates","version","updated_at"],"type":"object"},"enabled":{"type":"boolean"},"message":{"type":"string"},"models":{"items":{"enum":["doubao-seedream-5-0-pro-260628","doubao-seedream-5-0-flash-260915","doubao-seedream-5-5-261028","sx-image-2.6-sunburst"],"type":"string"},"type":"array"},"sizes":{"items":{"enum":["1024x1024","1536x1024","1024x1536","2048x2048","2048x1152","1152x2048","1776x2368","2368x1776"],"type":"string"},"type":"array"}},"required":["enabled","available","message","models","sizes","billing"],"type":"object"}}},"description":"Successful Response"},"503":{"content":{"application/json":{"schema":{"properties":{"detail":{"title":"Detail","type":"string"}},"required":["detail"],"title":"ErrorDetail","type":"object"}}},"description":"Feature Configuration Unavailable","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}}}} model Model ID. For image and video models, use the corresponding settings endpoint for current availability, resolutions and rates. Speech synthesis and audio composition accept indextts-2 (default) or indextts-2.5. size Image output size. Read the available sizes and rates from GET /v1/image/config. 1776x2368 and 2368x1776 are billed at the corresponding large-size tier. ```curl curl -X GET 'https://shixux.com/api/v1/image/config' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/image/config", { method: "GET", headers: {}, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/image/config", method="GET", headers={}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/image/config", nil) if err != nil { panic(err) } resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 查询图片生成配置 URL: https://docs.shixux.com/zh/image/api/config/ 查询图片生成是否可用,以及可用模型、尺寸、参考图上限、参考图附加费和当前费率版本。无需认证。提交时只使用本接口返回的模型和尺寸。 GET /v1/image/config {"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"reference_rates":{"type":"object","description":"Per-model reference image surcharge in credits. Models absent from this map do not charge for reference images.","additionalProperties":{"type":"object","required":["credits","free_images"],"properties":{"credits":{"type":"number","minimum":0},"free_images":{"type":"integer","minimum":0}}}},"max_reference_images":{"type":"object","description":"Maximum number of input images per model.","additionalProperties":{"type":"integer","minimum":1,"maximum":10}},"available":{"type":"boolean"},"billing":{"properties":{"rates":{"items":{"properties":{"credits":{"anyOf":[{"exclusiveMinimum":0,"maximum":1000000,"type":"number"},{"type":"null"}]},"model":{"enum":["doubao-seedream-5-0-pro-260628","doubao-seedream-5-0-flash-260915","doubao-seedream-5-5-261028","sx-image-2.6-sunburst"],"type":"string"},"size":{"enum":["1024x1024","1536x1024","1024x1536","2048x2048","2048x1152","1152x2048"],"type":"string"}},"required":["model","size","credits"],"type":"object"},"type":"array"},"updated_at":{"format":"date-time","type":"string"},"version":{"type":"integer"}},"required":["rates","version","updated_at"],"type":"object"},"enabled":{"type":"boolean"},"message":{"type":"string"},"models":{"items":{"enum":["doubao-seedream-5-0-pro-260628","doubao-seedream-5-0-flash-260915","doubao-seedream-5-5-261028","sx-image-2.6-sunburst"],"type":"string"},"type":"array"},"sizes":{"items":{"enum":["1024x1024","1536x1024","1024x1536","2048x2048","2048x1152","1152x2048","1776x2368","2368x1776"],"type":"string"},"type":"array"}},"required":["enabled","available","message","models","sizes","billing"],"type":"object"}}},"description":"Successful Response"},"503":{"content":{"application/json":{"schema":{"properties":{"detail":{"title":"Detail","type":"string"}},"required":["detail"],"title":"ErrorDetail","type":"object"}}},"description":"Feature Configuration Unavailable","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}}}} model 模型 ID。图片和视频模型的可用状态、清晰度和费率以对应配置接口的返回为准;语音合成和音频编排可选 indextts-2(默认)或 indextts-2.5。 size 图片输出尺寸。可用尺寸和费率由 GET /v1/image/config 返回;1776x2368 和 2368x1776 按对应的大尺寸档位计费。 ```curl curl -X GET 'https://shixux.com/api/v1/image/config' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/image/config", { method: "GET", headers: {}, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/image/config", method="GET", headers={}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/image/config", nil) if err != nil { panic(err) } resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Create an image URL: https://docs.shixux.com/en/image/api/generate/ Generate a PNG image with text to image or image to image. Image to image specifies reference images with reference_asset_id or reference_asset_ids, up to 10 images. Send the rate_version from the settings endpoint and a unique Idempotency-Key for retries. POST /v1/image/generate {"requestBody":{"content":{"application/json":{"schema":{"properties":{"reference_asset_ids":{"type":"array","description":"按顺序排列的参考图片素材 ID,与 reference_asset_id 二选一,最多 10 张。","maxItems":10,"items":{"type":"string"}},"mode":{"enum":["text-to-image","image-to-image"],"description":"生成模式。text-to-image 不接受参考图,image-to-image 至少需要一张参考图。","type":"string"},"model":{"enum":["doubao-seedream-5-0-pro-260628","doubao-seedream-5-0-flash-260915","doubao-seedream-5-5-261028","sx-image-2.6-sunburst"],"type":"string","description":"图片模型 ID。可用模型以 GET /v1/image/config 返回为准。"},"prompt":{"maxLength":32000,"minLength":1,"description":"图片提示词,长度为 1–32000 个字符。","type":"string"},"rate_version":{"minimum":1,"description":"GET /v1/image/config 返回的费率版本,提交时必须保持一致。","type":"integer"},"reference_asset_id":{"type":"string","description":"Asset ID of a single reference image. Use either this field or reference_asset_ids."},"size":{"enum":["1024x1024","1536x1024","1024x1536","2048x2048","2048x1152","1152x2048","1776x2368","2368x1776"],"type":"string","description":"Output dimensions. 1776x2368 and 2368x1776 use the reported 1024x1536 and 1536x1024 rates respectively."}},"required":["mode","model","prompt","size","rate_version"],"type":"object"}}},"required":true},"parameters":[{"in":"header","name":"Idempotency-Key","schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}}],"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}},"description":"Successful Response"},"401":{"description":"Authentication required","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}},"description":"Idempotency-Key was already used for a different request, or the rate has changed; read the current rate before submitting again.","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}},"410":{"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}},"description":"Reference asset expired; upload the reference again."},"422":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"},{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}]}}},"description":"Validation Error","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}},"429":{"description":"Concurrent job limit (MAX_CONCURRENT_JOBS), request rate limit (RATE_LIMITED) or upload allowance (UPLOAD_RATE_LIMITED, UPLOAD_QUOTA_EXCEEDED) reached.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."},"Retry-After":{"schema":{"type":"string"},"description":"Seconds until enough rolling quota expires for this request. Omitted when no retry time can be promised. Concurrent uploads may delay availability."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"},{"properties":{"code":{"title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"}},"required":["code","detail"],"title":"ServiceUnavailableResponse","type":"object"}]}}},"description":"Feature disabled or service temporarily unavailable; try again later","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}}}} model Model ID. For image and video models, use the corresponding settings endpoint for current availability, resolutions and rates. Speech synthesis and audio composition accept indextts-2 (default) or indextts-2.5. mode Generation mode. Video supports t2va, fl2va and ref2va; images support text-to-image and image-to-image. The modes each model supports are given by the corresponding settings endpoint. size Image output size. Read the available sizes and rates from GET /v1/image/config. 1776x2368 and 2368x1776 are billed at the corresponding large-size tier. rate_version Rate version. For image generation, send billing.version from the settings endpoint. If the rate has changed, the submission is rejected; read the settings or quote again. ```curl curl -X POST 'https://shixux.com/api/v1/image/generate' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"mode":"text-to-image","model":"sx-image-2.6-sunburst","prompt":"A yellow ceramic cup on a plain table.","size":"1024x1024","rate_version":1}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/image/generate", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "your-unique-business-action-id" }, body: JSON.stringify({ "mode": "text-to-image", "model": "sx-image-2.6-sunburst", "prompt": "A yellow ceramic cup on a plain table.", "size": "1024x1024", "rate_version": 1 }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/image/generate", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json","Idempotency-Key":"your-unique-business-action-id"}, data="{\"mode\":\"text-to-image\",\"model\":\"sx-image-2.6-sunburst\",\"prompt\":\"A yellow ceramic cup on a plain table.\",\"size\":\"1024x1024\",\"rate_version\":1}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/image/generate", strings.NewReader("{\"mode\":\"text-to-image\",\"model\":\"sx-image-2.6-sunburst\",\"prompt\":\"A yellow ceramic cup on a plain table.\",\"size\":\"1024x1024\",\"rate_version\":1}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", "your-unique-business-action-id") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 创建图片任务 URL: https://docs.shixux.com/zh/image/api/generate/ 生成 PNG 图片,支持文生图和图生图。图生图通过 reference_asset_id 或 reference_asset_ids 指定参考图,最多 10 张。请携带配置接口返回的 rate_version,并使用唯一的 Idempotency-Key 处理重试。 POST /v1/image/generate {"requestBody":{"content":{"application/json":{"schema":{"properties":{"reference_asset_ids":{"type":"array","description":"按顺序排列的参考图片素材 ID,与 reference_asset_id 二选一,最多 10 张。","maxItems":10,"items":{"type":"string"}},"mode":{"enum":["text-to-image","image-to-image"],"description":"生成模式。text-to-image 不接受参考图,image-to-image 至少需要一张参考图。","type":"string"},"model":{"enum":["doubao-seedream-5-0-pro-260628","doubao-seedream-5-0-flash-260915","doubao-seedream-5-5-261028","sx-image-2.6-sunburst"],"type":"string","description":"图片模型 ID。可用模型以 GET /v1/image/config 返回为准。"},"prompt":{"maxLength":32000,"minLength":1,"description":"图片提示词,长度为 1–32000 个字符。","type":"string"},"rate_version":{"minimum":1,"description":"GET /v1/image/config 返回的费率版本,提交时必须保持一致。","type":"integer"},"reference_asset_id":{"type":"string","description":"Asset ID of a single reference image. Use either this field or reference_asset_ids."},"size":{"enum":["1024x1024","1536x1024","1024x1536","2048x2048","2048x1152","1152x2048","1776x2368","2368x1776"],"type":"string","description":"Output dimensions. 1776x2368 and 2368x1776 use the reported 1024x1536 and 1536x1024 rates respectively."}},"required":["mode","model","prompt","size","rate_version"],"type":"object"}}},"required":true},"parameters":[{"in":"header","name":"Idempotency-Key","schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}}],"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}},"description":"Successful Response"},"401":{"description":"Authentication required","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}},"description":"Idempotency-Key was already used for a different request, or the rate has changed; read the current rate before submitting again.","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}},"410":{"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}},"description":"Reference asset expired; upload the reference again."},"422":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"},{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}]}}},"description":"Validation Error","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}},"429":{"description":"Concurrent job limit (MAX_CONCURRENT_JOBS), request rate limit (RATE_LIMITED) or upload allowance (UPLOAD_RATE_LIMITED, UPLOAD_QUOTA_EXCEEDED) reached.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."},"Retry-After":{"schema":{"type":"string"},"description":"Seconds until enough rolling quota expires for this request. Omitted when no retry time can be promised. Concurrent uploads may delay availability."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"},{"properties":{"code":{"title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"}},"required":["code","detail"],"title":"ServiceUnavailableResponse","type":"object"}]}}},"description":"Feature disabled or service temporarily unavailable; try again later","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}}}}} model 模型 ID。图片和视频模型的可用状态、清晰度和费率以对应配置接口的返回为准;语音合成和音频编排可选 indextts-2(默认)或 indextts-2.5。 mode 生成模式。视频支持 t2va、fl2va、ref2va;图片支持 text-to-image 和 image-to-image。各模型支持的模式以对应配置接口为准。 size 图片输出尺寸。可用尺寸和费率由 GET /v1/image/config 返回;1776x2368 和 2368x1776 按对应的大尺寸档位计费。 rate_version 费率版本。图片生成传入配置接口返回的 billing.version;费率变化后提交会被拒绝,需重新读取配置或报价。 ```curl curl -X POST 'https://shixux.com/api/v1/image/generate' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"mode":"text-to-image","model":"sx-image-2.6-sunburst","prompt":"A yellow ceramic cup on a plain table.","size":"1024x1024","rate_version":1}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/image/generate", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "your-unique-business-action-id" }, body: JSON.stringify({ "mode": "text-to-image", "model": "sx-image-2.6-sunburst", "prompt": "A yellow ceramic cup on a plain table.", "size": "1024x1024", "rate_version": 1 }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/image/generate", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json","Idempotency-Key":"your-unique-business-action-id"}, data="{\"mode\":\"text-to-image\",\"model\":\"sx-image-2.6-sunburst\",\"prompt\":\"A yellow ceramic cup on a plain table.\",\"size\":\"1024x1024\",\"rate_version\":1}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/image/generate", strings.NewReader("{\"mode\":\"text-to-image\",\"model\":\"sx-image-2.6-sunburst\",\"prompt\":\"A yellow ceramic cup on a plain table.\",\"size\":\"1024x1024\",\"rate_version\":1}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", "your-unique-business-action-id") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Resolve an image submission URL: https://docs.shixux.com/en/image/api/submission-resolution/ When no response to an image submission arrives, confirm its outcome with the original request body and the original Idempotency-Key. If the original request was accepted, the job is returned; if not, an uncharged failed job is returned and the original request will not be accepted later. This endpoint never generates an image. POST /v1/image/submissions/resolve {"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["request"],"properties":{"request":{"properties":{"reference_asset_ids":{"type":"array","description":"Ordered original reference images for image-to-image. Use either this field or reference_asset_id.","maxItems":16,"items":{"type":"string"}},"mode":{"enum":["text-to-image","image-to-image"],"type":"string"},"model":{"type":"string"},"prompt":{"maxLength":32000,"minLength":1,"type":"string"},"quality":{"type":"string"},"rate_version":{"minimum":1,"type":"integer"},"reference_asset_id":{"type":"string"},"size":{"type":"string"}},"required":["mode","model","prompt","size","rate_version"],"type":"object","description":"The original image request that received no response. It must match the original request body."},"expected_job_id":{"type":"string","description":"Job ID returned earlier for this submission, or an empty string if none was returned."}}}}}},"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","maxLength":128}}],"responses":{"202":{"description":"The original job or an uncharged failed job","content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}}},"401":{"description":"Authentication required","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"The Idempotency-Key belongs to a different request (IDEMPOTENCY_CONFLICT).","content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"description":"Service temporarily unavailable; retry this endpoint later instead of submitting a new image","content":{"application/json":{"schema":{"properties":{"code":{"title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"}},"required":["code","detail"],"title":"ServiceUnavailableResponse","type":"object"}}}}}} model Model ID. For image and video models, use the corresponding settings endpoint for current availability, resolutions and rates. Speech synthesis and audio composition accept indextts-2 (default) or indextts-2.5. mode Generation mode. Video supports t2va, fl2va and ref2va; images support text-to-image and image-to-image. The modes each model supports are given by the corresponding settings endpoint. size Image output size. Read the available sizes and rates from GET /v1/image/config. 1776x2368 and 2368x1776 are billed at the corresponding large-size tier. rate_version Rate version. For image generation, send billing.version from the settings endpoint. If the rate has changed, the submission is rejected; read the settings or quote again. ```curl curl -X POST 'https://shixux.com/api/v1/image/submissions/resolve' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"request":{"mode":"text-to-image","model":"doubao-seedream-5-0-pro-260628","prompt":"A yellow ceramic cup on a plain table.","size":"1024x1024","rate_version":1}}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/image/submissions/resolve", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "your-unique-business-action-id" }, body: JSON.stringify({ "request": { "mode": "text-to-image", "model": "doubao-seedream-5-0-pro-260628", "prompt": "A yellow ceramic cup on a plain table.", "size": "1024x1024", "rate_version": 1 } }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/image/submissions/resolve", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json","Idempotency-Key":"your-unique-business-action-id"}, data="{\"request\":{\"mode\":\"text-to-image\",\"model\":\"doubao-seedream-5-0-pro-260628\",\"prompt\":\"A yellow ceramic cup on a plain table.\",\"size\":\"1024x1024\",\"rate_version\":1}}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/image/submissions/resolve", strings.NewReader("{\"request\":{\"mode\":\"text-to-image\",\"model\":\"doubao-seedream-5-0-pro-260628\",\"prompt\":\"A yellow ceramic cup on a plain table.\",\"size\":\"1024x1024\",\"rate_version\":1}}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", "your-unique-business-action-id") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 处理图片提交回执 URL: https://docs.shixux.com/zh/image/api/submission-resolution/ 未收到图片提交的响应时,使用原请求体和原 Idempotency-Key 确认提交结果。原请求已受理时返回该任务;未受理时返回一个未扣费的失败任务,并确保原请求之后不会再被受理。本接口不会生成图片。 POST /v1/image/submissions/resolve {"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["request"],"properties":{"request":{"properties":{"reference_asset_ids":{"type":"array","description":"Ordered original reference images for image-to-image. Use either this field or reference_asset_id.","maxItems":16,"items":{"type":"string"}},"mode":{"enum":["text-to-image","image-to-image"],"type":"string"},"model":{"type":"string"},"prompt":{"maxLength":32000,"minLength":1,"type":"string"},"quality":{"type":"string"},"rate_version":{"minimum":1,"type":"integer"},"reference_asset_id":{"type":"string"},"size":{"type":"string"}},"required":["mode","model","prompt","size","rate_version"],"type":"object","description":"The original image request that received no response. It must match the original request body."},"expected_job_id":{"type":"string","description":"Job ID returned earlier for this submission, or an empty string if none was returned."}}}}}},"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","maxLength":128}}],"responses":{"202":{"description":"The original job or an uncharged failed job","content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}}},"401":{"description":"Authentication required","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"The Idempotency-Key belongs to a different request (IDEMPOTENCY_CONFLICT).","content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"description":"Service temporarily unavailable; retry this endpoint later instead of submitting a new image","content":{"application/json":{"schema":{"properties":{"code":{"title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"}},"required":["code","detail"],"title":"ServiceUnavailableResponse","type":"object"}}}}}} model 模型 ID。图片和视频模型的可用状态、清晰度和费率以对应配置接口的返回为准;语音合成和音频编排可选 indextts-2(默认)或 indextts-2.5。 mode 生成模式。视频支持 t2va、fl2va、ref2va;图片支持 text-to-image 和 image-to-image。各模型支持的模式以对应配置接口为准。 size 图片输出尺寸。可用尺寸和费率由 GET /v1/image/config 返回;1776x2368 和 2368x1776 按对应的大尺寸档位计费。 rate_version 费率版本。图片生成传入配置接口返回的 billing.version;费率变化后提交会被拒绝,需重新读取配置或报价。 ```curl curl -X POST 'https://shixux.com/api/v1/image/submissions/resolve' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"request":{"mode":"text-to-image","model":"doubao-seedream-5-0-pro-260628","prompt":"A yellow ceramic cup on a plain table.","size":"1024x1024","rate_version":1}}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/image/submissions/resolve", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "your-unique-business-action-id" }, body: JSON.stringify({ "request": { "mode": "text-to-image", "model": "doubao-seedream-5-0-pro-260628", "prompt": "A yellow ceramic cup on a plain table.", "size": "1024x1024", "rate_version": 1 } }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/image/submissions/resolve", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json","Idempotency-Key":"your-unique-business-action-id"}, data="{\"request\":{\"mode\":\"text-to-image\",\"model\":\"doubao-seedream-5-0-pro-260628\",\"prompt\":\"A yellow ceramic cup on a plain table.\",\"size\":\"1024x1024\",\"rate_version\":1}}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/image/submissions/resolve", strings.NewReader("{\"request\":{\"mode\":\"text-to-image\",\"model\":\"doubao-seedream-5-0-pro-260628\",\"prompt\":\"A yellow ceramic cup on a plain table.\",\"size\":\"1024x1024\",\"rate_version\":1}}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", "your-unique-business-action-id") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Image guide URL: https://docs.shixux.com/en/image/guide/ ## Read the settings Before submitting, call [Get image generation settings](https://docs.shixux.com/en/image/api/config/) (no authentication required). The response contains: - `available`: whether image generation is currently available. - `models` and `sizes`: the models and output sizes you can submit now. - `max_reference_images` and `reference_rates`: the reference image limit and reference image surcharge for each model. - `billing.rates` and `billing.version`: the rate for each model and size, and the rate version. When submitting, send `billing.version` as `rate_version` in the request. Rates may change, so read the settings again before each submission. See [Image model overview](https://docs.shixux.com/en/image/) for model IDs and common specifications. ## Text to image Call [POST /v1/image/generate](https://docs.shixux.com/en/image/api/generate/) with `mode: "text-to-image"`, `model`, `prompt`, `size` and `rate_version`. The prompt is 1–32000 characters long. ```bash curl -X POST 'https://shixux.com/api/v1/image/generate' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: image-001' \ -d '{"mode":"text-to-image","model":"doubao-seedream-5-0-pro-260628","prompt":"A yellow ceramic cup on a wooden table","size":"1024x1024","rate_version":1}' ``` ```python import json import urllib.request body = { "mode": "text-to-image", "model": "doubao-seedream-5-0-pro-260628", "prompt": "A yellow ceramic cup on a wooden table", "size": "1024x1024", "rate_version": 1, } request = urllib.request.Request( "https://shixux.com/api/v1/image/generate", method="POST", headers={"X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "image-001"}, data=json.dumps(body).encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```js const response = await fetch("https://shixux.com/api/v1/image/generate", { method: "POST", headers: { "X-API-Key": process.env.YB_API_KEY, "Content-Type": "application/json", "Idempotency-Key": "image-001", }, body: JSON.stringify({ mode: "text-to-image", model: "doubao-seedream-5-0-pro-260628", prompt: "A yellow ceramic cup on a wooden table", size: "1024x1024", rate_version: 1, }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.json()); ``` `rate_version` in these examples is a placeholder; replace it with `billing.version` from the settings response. ## Image to image Image to image uses `mode: "image-to-image"` and specifies reference images with `reference_asset_id` (one image) or `reference_asset_ids` (several images, in order). Use one of the two fields, with up to 10 images. Reference images must be [uploaded](https://docs.shixux.com/en/common/uploads/) and confirmed with `purpose: "image_reference"`. Image to image can create a new image based on the references, or edit a reference image when the prompt describes the change, for example: ```json { "mode": "image-to-image", "model": "doubao-seedream-5-5-261028", "prompt": "Make the cup blue and keep the composition and lighting", "size": "1536x1024", "reference_asset_ids": ["asset_reference_1"], "rate_version": 1 } ``` Whether reference images incur a surcharge is determined by `reference_rates` in the settings. If the rate version is out of date, the submission returns `409 IMAGE_RATE_CHANGED`; read the settings again and confirm the cost before resubmitting. ## When no submission response arrives If a submission times out and you cannot tell whether the image job was created: 1. Call [List jobs](https://docs.shixux.com/en/common/api/jobs/list/) with the original `Idempotency-Key` as the `idempotency_key` parameter. 2. If that still does not settle it, call [Resolve an image submission](https://docs.shixux.com/en/image/api/submission-resolution/) with the original request body and the original `Idempotency-Key`. If the original request was accepted, the endpoint returns that job. If it was not, the endpoint returns an uncharged failed job and makes sure the original request will not be accepted later. The endpoint itself never generates an image. ## Jobs and results A successful submission returns `202`, the job ID and the credits reserved. Learn when the job ends through [Retrieve a job](https://docs.shixux.com/en/common/api/jobs/retrieve/) or a [webhook](https://docs.shixux.com/en/common/webhooks/), then call [Retrieve a job result](https://docs.shixux.com/en/common/api/jobs/result/) for the download URL. The URL is short-lived; call the endpoint again after it expires. `retained_until` gives how long the result file is retained. When a job fails, `error_code` gives the reason, for example a reference image, prompt or generated image that did not pass copyright review (`IMAGE_REFERENCE_COPYRIGHT`, `IMAGE_PROMPT_COPYRIGHT`, `IMAGE_OUTPUT_COPYRIGHT`). Reserved credits are refunded. For more rules, see [Uploads](https://docs.shixux.com/en/common/uploads/), [Webhooks](https://docs.shixux.com/en/common/webhooks/), [Asynchronous jobs](https://docs.shixux.com/en/common/jobs/) and [Billing and credits](https://docs.shixux.com/en/operations/billing/). --- # 图片接入指南 URL: https://docs.shixux.com/zh/image/guide/ ## 读取配置 提交前先调用[查询图片生成配置](https://docs.shixux.com/zh/image/api/config/)(无需认证),响应包含: - `available`:图片生成当前是否可用。 - `models`、`sizes`:当前可提交的模型和输出尺寸。 - `max_reference_images`、`reference_rates`:各模型的参考图上限和参考图附加费。 - `billing.rates`、`billing.version`:各模型、尺寸的费率及费率版本。 提交时,将 `billing.version` 作为请求中的 `rate_version` 传入。费率可能调整,建议每次提交前重新读取配置。四个模型的 ID 和通用规格见[图片模型总览](https://docs.shixux.com/zh/image/)。 ## 文生图 调用 [POST /v1/image/generate](https://docs.shixux.com/zh/image/api/generate/),提交 `mode: "text-to-image"`、`model`、`prompt`、`size` 和 `rate_version`。提示词长度为 1–32000 个字符。 ```bash curl -X POST 'https://shixux.com/api/v1/image/generate' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: image-001' \ -d '{"mode":"text-to-image","model":"doubao-seedream-5-0-pro-260628","prompt":"一只黄色陶瓷杯放在木桌上","size":"1024x1024","rate_version":1}' ``` ```python import json import urllib.request body = { "mode": "text-to-image", "model": "doubao-seedream-5-0-pro-260628", "prompt": "一只黄色陶瓷杯放在木桌上", "size": "1024x1024", "rate_version": 1, } request = urllib.request.Request( "https://shixux.com/api/v1/image/generate", method="POST", headers={"X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "image-001"}, data=json.dumps(body).encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```js const response = await fetch("https://shixux.com/api/v1/image/generate", { method: "POST", headers: { "X-API-Key": process.env.YB_API_KEY, "Content-Type": "application/json", "Idempotency-Key": "image-001", }, body: JSON.stringify({ mode: "text-to-image", model: "doubao-seedream-5-0-pro-260628", prompt: "一只黄色陶瓷杯放在木桌上", size: "1024x1024", rate_version: 1, }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.json()); ``` 示例中的 `rate_version` 为占位值,请替换为配置接口返回的 `billing.version`。 ## 图生图 图生图使用 `mode: "image-to-image"`,通过 `reference_asset_id`(单张)或 `reference_asset_ids`(多张,按顺序)指定参考图。两个字段二选一,最多 10 张。参考图须以 `purpose: "image_reference"` [上传](https://docs.shixux.com/zh/common/uploads/)并确认。 图生图既可以基于参考图生成新图片,也可以在提示词中写明修改要求来编辑参考图,例如: ```json { "mode": "image-to-image", "model": "doubao-seedream-5-5-261028", "prompt": "把杯子改成蓝色,保留构图和光照", "size": "1536x1024", "reference_asset_ids": ["asset_reference_1"], "rate_version": 1 } ``` 参考图是否额外收费由配置中的 `reference_rates` 决定。费率版本过期时提交返回 `409 IMAGE_RATE_CHANGED`,请重新读取配置并确认费用后再提交。 ## 未收到提交响应时 如果提交请求超时,无法确定图片任务是否已创建: 1. 使用原 `Idempotency-Key` 作为 `idempotency_key` 参数,调用[列出任务](https://docs.shixux.com/zh/common/api/jobs/list/)查找任务。 2. 仍无法确认时,调用[处理图片提交回执](https://docs.shixux.com/zh/image/api/submission-resolution/),提交原请求体并携带原 `Idempotency-Key`。如果原请求已被受理,接口返回该任务;如果未被受理,接口返回一个未扣费的失败任务,并确保原请求之后不会再被受理。该接口本身不会生成图片。 ## 任务与结果 提交成功返回 `202`、任务 ID 和本次预扣的积分。通过[查询任务](https://docs.shixux.com/zh/common/api/jobs/retrieve/)或 [Webhook](https://docs.shixux.com/zh/common/webhooks/) 获知任务结束,成功后调用[获取任务结果](https://docs.shixux.com/zh/common/api/jobs/result/)获取下载地址。下载地址短时有效,过期后再次调用即可;`retained_until` 表示结果文件的保留期限。 任务失败时,`error_code` 说明原因,例如参考图、提示词或生成结果未通过版权审核(`IMAGE_REFERENCE_COPYRIGHT`、`IMAGE_PROMPT_COPYRIGHT`、`IMAGE_OUTPUT_COPYRIGHT`),预扣积分会退回。 更多规则见[素材上传](https://docs.shixux.com/zh/common/uploads/)、[Webhook](https://docs.shixux.com/zh/common/webhooks/)、[异步任务](https://docs.shixux.com/zh/common/jobs/)和[计费与积分](https://docs.shixux.com/zh/operations/billing/)。 --- # Image model overview URL: https://docs.shixux.com/en/image/ ## Available models | Model ID | Generation modes | Reference image limit | | --- | --- | --- | | `doubao-seedream-5-0-pro-260628` | Text to image, image to image | 10 images | | `doubao-seedream-5-0-flash-260915` | Text to image, image to image | 10 images | | `doubao-seedream-5-5-261028` | Text to image, image to image | 10 images | | `sx-image-2.6-sunburst` | Text to image, image to image | 10 images | All four models use the same request structure; to switch models, change only `model`. The models differ mainly in their rates. Current availability, supported sizes, reference image limits, reference image surcharges and the rate version for each model are returned by the [image generation settings](https://docs.shixux.com/en/image/api/config/) endpoint. ## Common specifications - Output format is PNG. - Supported output sizes: `1024x1024`, `1536x1024`, `1024x1536`, `2048x2048`, `2048x1152`, `1152x2048`, `1776x2368` and `2368x1776`. The sizes currently available are given by `sizes` in the settings response. - Image to image uses up to 10 reference images, which must first be [uploaded](https://docs.shixux.com/en/common/uploads/). - Whether reference images incur a surcharge is determined by `reference_rates` in the settings response. ## API reference [Get image generation settings](https://docs.shixux.com/en/image/api/config/) · [Create an image](https://docs.shixux.com/en/image/api/generate/) · [Resolve an image submission](https://docs.shixux.com/en/image/api/submission-resolution/). See the [image guide](https://docs.shixux.com/en/image/guide/) for the full integration flow and examples. --- # 图片模型总览 URL: https://docs.shixux.com/zh/image/ ## 可用模型 | 模型 ID | 生成模式 | 参考图上限 | | --- | --- | --- | | `doubao-seedream-5-0-pro-260628` | 文生图、图生图 | 10 张 | | `doubao-seedream-5-0-flash-260915` | 文生图、图生图 | 10 张 | | `doubao-seedream-5-5-261028` | 文生图、图生图 | 10 张 | | `sx-image-2.6-sunburst` | 文生图、图生图 | 10 张 | 四个模型使用相同的请求结构,切换模型只需修改 `model`,模型之间的差异主要在于费率。各模型当前是否可用、支持的尺寸、参考图上限、参考图附加费和费率版本以[图片生成配置](https://docs.shixux.com/zh/image/api/config/)接口的返回为准。 ## 通用规格 - 输出格式为 PNG。 - 支持的输出尺寸:`1024x1024`、`1536x1024`、`1024x1536`、`2048x2048`、`2048x1152`、`1152x2048`、`1776x2368`、`2368x1776`。具体可用的尺寸以配置接口返回的 `sizes` 为准。 - 图生图最多使用 10 张参考图,参考图须先完成[素材上传](https://docs.shixux.com/zh/common/uploads/)。 - 参考图是否额外收费,由配置接口返回的 `reference_rates` 决定。 ## 接口参考 [查询图片生成配置](https://docs.shixux.com/zh/image/api/config/) · [创建图片任务](https://docs.shixux.com/zh/image/api/generate/) · [处理图片提交回执](https://docs.shixux.com/zh/image/api/submission-resolution/)。完整的接入流程和示例见[图片接入指南](https://docs.shixux.com/zh/image/guide/)。 --- # Platform overview URL: https://docs.shixux.com/en/ ## Four model types The Shixu API is organized by model type. Audio, image and video generation run as asynchronous jobs: submit a request to receive a job ID, learn when the job finishes by polling or through a webhook, then call the result endpoint for a download URL. Text models are compatible with the OpenAI Chat Completions API. They return results directly or as a stream, are billed per token and do not create jobs. | Type | Capabilities | Submit endpoints | Documentation | | --- | --- | --- | --- | | Audio models | Speech synthesis, audio composition, voice design | [POST /v1/tts](https://docs.shixux.com/en/audio/api/tts/), [POST /v1/audio/compositions](https://docs.shixux.com/en/audio/api/audio-composition/), [POST /v1/voice-designs](https://docs.shixux.com/en/audio/api/voice-design/) | [Overview](https://docs.shixux.com/en/audio/) · [Guide](https://docs.shixux.com/en/audio/guide/) | | Image models | Text to image and image to image, 4 models | [POST /v1/image/generate](https://docs.shixux.com/en/image/api/generate/) | [Overview](https://docs.shixux.com/en/image/) · [Guide](https://docs.shixux.com/en/image/guide/) | | Video models | Text to video, first/last-frame and multimodal reference generation, 8 models | [POST /v1/video/generate](https://docs.shixux.com/en/video/api/generate/) | [Overview](https://docs.shixux.com/en/video/) · [Guide](https://docs.shixux.com/en/video/guide/) | | Text models | Chat completions with streaming | [POST /v1/chat/completions](https://docs.shixux.com/en/text/api/chat-completions/) | [Overview](https://docs.shixux.com/en/text/) · [Guide](https://docs.shixux.com/en/text/guide/) | ## Get started API Base URL: `https://shixux.com/api` 1. [Get an API Key](https://docs.shixux.com/en/getting-started/keys/). 2. Follow [Your first request](https://docs.shixux.com/en/getting-started/quickstart/) to synthesize speech and learn the submit, poll and fetch-result flow. 3. Read the guide for the model type you need. Rules shared by all model types, including authentication, asynchronous jobs, uploads and webhooks, are under [Common capabilities](https://docs.shixux.com/en/common/). Error codes, billing and data retention are under [Operations](https://docs.shixux.com/en/operations/errors/). ## Machine-readable resources [OpenAPI description](/openapi.public.json) · [llms.txt](/llms.txt) · [llms-full.txt](/llms-full.txt) --- # 平台概览 URL: https://docs.shixux.com/zh/ ## 四类模型 时序科技 API 按模型类型组织。音频、图片和视频生成均为异步任务:提交请求后获得任务 ID,通过轮询或 Webhook 获知任务完成,再调用结果接口获取下载地址。文本模型兼容 OpenAI Chat Completions 接口,直接返回或流式输出结果,按 Token 计费,不创建任务。 | 类型 | 能力 | 提交接口 | 文档 | | --- | --- | --- | --- | | 音频模型 | 语音合成、音频编排、音色设计 | [POST /v1/tts](https://docs.shixux.com/zh/audio/api/tts/)、[POST /v1/audio/compositions](https://docs.shixux.com/zh/audio/api/audio-composition/)、[POST /v1/voice-designs](https://docs.shixux.com/zh/audio/api/voice-design/) | [总览](https://docs.shixux.com/zh/audio/) · [接入指南](https://docs.shixux.com/zh/audio/guide/) | | 图片模型 | 文生图、图生图,4 个模型 | [POST /v1/image/generate](https://docs.shixux.com/zh/image/api/generate/) | [总览](https://docs.shixux.com/zh/image/) · [接入指南](https://docs.shixux.com/zh/image/guide/) | | 视频模型 | 文生视频、首尾帧生成、多模态参考生成,8 个模型 | [POST /v1/video/generate](https://docs.shixux.com/zh/video/api/generate/) | [总览](https://docs.shixux.com/zh/video/) · [接入指南](https://docs.shixux.com/zh/video/guide/) | | 文本模型 | 对话补全,支持流式输出 | [POST /v1/chat/completions](https://docs.shixux.com/zh/text/api/chat-completions/) | [总览](https://docs.shixux.com/zh/text/) · [接入指南](https://docs.shixux.com/zh/text/guide/) | ## 开始接入 API Base URL:`https://shixux.com/api` 1. [获取 API Key](https://docs.shixux.com/zh/getting-started/keys/)。 2. 按[第一条请求](https://docs.shixux.com/zh/getting-started/quickstart/)完成一次语音合成,熟悉提交、查询和获取结果的流程。 3. 阅读所需模型的接入指南。 认证、异步任务、素材上传和 Webhook 等各类模型共用的规则见[通用能力](https://docs.shixux.com/zh/common/);错误码、计费和数据保留见[运行规则](https://docs.shixux.com/zh/operations/errors/)。 ## 机器可读资源 [OpenAPI 描述文件](/openapi.public.json) · [llms.txt](/llms.txt) · [llms-full.txt](/llms-full.txt) --- # Billing and credits URL: https://docs.shixux.com/en/operations/billing/ ## Credits All API usage is billed in credits. Credits are deducted from your account balance, which is shared by every API Key of the account. Each ¥0.01 paid adds 1 credit; top up in the [console wallet](https://console.shixux.com/wallet?lang=en). When credits are insufficient, submissions return `402 INSUFFICIENT_CREDITS`. ## Settlement of asynchronous jobs 1. When a job is created, credits are reserved based on estimated usage. `reserved_credits` in the submission response is the amount reserved. 2. When the job succeeds, it is settled against actual usage and any excess reservation is returned. The actual charge is given in `actual_credits`. 3. When the job fails, the reservation is refunded in full automatically; no request is needed. 4. When a job is stopped, whether the reservation is refunded is given in the [stop job](https://docs.shixux.com/en/video/api/cancel/) response. ## Find prices Before submitting, get rates or quotes from these endpoints: | Capability | Price source | | --- | --- | | Image generation | [Image generation settings](https://docs.shixux.com/en/image/api/config/) return the rates for each model and size and the `rate_version` | | Video generation | The [video quote](https://docs.shixux.com/en/video/api/quote/) returns `quote_id`, the billable duration and the credits required | | Audio composition | The [composition quote](https://docs.shixux.com/en/audio/api/audio-composition-quote/) returns the credits required as `credits` and does not create a job | | Voice design | [Voice design configuration](https://docs.shixux.com/en/audio/api/voice-design-config/) returns the rate per generation | | Speech synthesis | Credits are reserved from the audio duration estimated from the text; `reserved_credits` in the submission response is the amount reserved | | Text models | [List text models](https://docs.shixux.com/en/text/api/models/) returns token prices for each model | Rates may change. Image and video requests must carry the rate version returned by the configuration or quote. If the rate has changed, the submission returns `409`; read the rate again before resubmitting. ## Text models are billed per token Text models do not create jobs. Input tokens, cached input tokens and output tokens are priced separately. Credits are reserved from `max_tokens` when the request starts and settled from actual usage when it completes, with any excess returned immediately; a failed request is refunded in full. See the [text model guide](https://docs.shixux.com/en/text/guide/). --- # 计费与积分 URL: https://docs.shixux.com/zh/operations/billing/ ## 积分 所有接口调用以积分计费。积分从账号余额中扣除,同一账号下的所有 API Key 共用余额。每支付人民币 0.01 元获得 1 积分,可在[控制台钱包](https://console.shixux.com/wallet?lang=zh)充值。积分不足时,提交请求返回 `402 INSUFFICIENT_CREDITS`。 ## 异步任务的结算 1. 任务创建时,按预估用量预扣积分。提交响应中的 `reserved_credits` 为本次预扣的积分。 2. 任务成功后,按实际用量结算,多预扣的积分退回。任务的实际消耗见 `actual_credits`。 3. 任务失败时,预扣积分自动全额退回,无需申请。 4. 任务被停止时,是否退回预扣积分以[停止任务接口](https://docs.shixux.com/zh/video/api/cancel/)的返回为准。 ## 查询价格 提交前可通过以下接口获取费率或报价: | 能力 | 价格来源 | | --- | --- | | 图片生成 | [图片生成配置](https://docs.shixux.com/zh/image/api/config/)返回各模型、尺寸的费率及 `rate_version` | | 视频生成 | [视频报价](https://docs.shixux.com/zh/video/api/quote/)返回 `quote_id`、计费时长和所需积分 | | 音频编排 | [音频编排报价](https://docs.shixux.com/zh/audio/api/audio-composition-quote/)返回所需积分 `credits`,不会创建任务 | | 音色设计 | [音色设计配置](https://docs.shixux.com/zh/audio/api/voice-design-config/)返回每次生成的费率 | | 语音合成 | 按文本预估的音频时长预扣,提交响应中的 `reserved_credits` 为本次预扣积分 | | 文本模型 | [列出文本模型](https://docs.shixux.com/zh/text/api/models/)返回各模型的 Token 单价 | 费率可能调整。图片和视频请求须携带配置或报价返回的费率版本,费率更新后提交会返回 `409`,请重新读取费率后再提交。 ## 文本模型按 Token 计费 文本模型不创建任务,按输入 Token、缓存命中的输入 Token 和输出 Token 分别计价。请求开始时按 `max_tokens` 预扣积分,完成后按实际用量结算,多扣部分立即退回;请求失败时全额退回。详见[文本模型接入指南](https://docs.shixux.com/zh/text/guide/)。 --- # Error handling URL: https://docs.shixux.com/en/operations/errors/ ## Error response format A failed request returns a 4xx or 5xx status code and a JSON error body: ```json {"code": "INSUFFICIENT_CREDITS", "detail": "Insufficient credits"} ``` - `code`: a stable, machine-readable error code. Base your error handling on it. - `detail`: a description of the error for troubleshooting. Its wording may change, so do not rely on the text. Some errors include additional fields, such as `quota` when the upload allowance is exceeded; see the response descriptions of each endpoint. Text model endpoints use the OpenAI error format; see the [text model guide](https://docs.shixux.com/en/text/guide/). ## Common errors | HTTP | Common `code` | Meaning and action | | --- | --- | --- | | 401 | — | Credentials are missing, invalid or revoked. Check the API Key, and whether the endpoint requires an API Key or console login credentials | | 402 | `INSUFFICIENT_CREDITS` | Not enough credits. Top up and try again | | 403 | `ACCOUNT_DISABLED` | The account is disabled. Contact platform support | | 404 | `RESOURCE_NOT_FOUND` | The job, voice, asset or webhook endpoint does not exist or does not belong to your account | | 409 | `IDEMPOTENCY_CONFLICT` | The same `Idempotency-Key` was used for a different request. Keep the parameters unchanged when retrying the original request, and use a new key for a new business operation; see [Asynchronous jobs](https://docs.shixux.com/en/common/jobs/) | | 409 | `IMAGE_RATE_CHANGED`, `VIDEO_RATE_CONFLICT`, `VOICE_DESIGN_RATE_CONFLICT` | The rate or quote has changed. Read the configuration or quote again before submitting | | 409 | `CONFLICT` | The resource's current state does not allow the operation, for example a voice is in use or a job can no longer be stopped | | 410 | `RESOURCE_EXPIRED`, `JOB_RESULT_EXPIRED`, `INPUT_ASSET_EXPIRED` | The result or asset has expired or is unavailable. Upload the asset again or submit a new generation | | 413 | `FILE_TOO_LARGE` | The request body or file is too large | | 422 | `VALIDATION_ERROR` | Invalid parameters, a referenced asset that does not exist, or an asset whose upload has not been confirmed | | 429 | `MAX_CONCURRENT_JOBS` | The account has reached its limit of concurrent generation jobs. Wait for running jobs to finish before submitting | | 429 | `UPLOAD_RATE_LIMITED`, `UPLOAD_QUOTA_EXCEEDED` | The upload count or byte allowance is exceeded. Wait for `Retry-After` before retrying; see [Uploads](https://docs.shixux.com/en/common/uploads/) | | 429 | `RATE_LIMITED` | Too many requests. Slow down and retry with backoff | | 500, 502, 504 | `INTERNAL_ERROR`, `SERVICE_UNAVAILABLE`, `REQUEST_TIMEOUT` | A server error or processing timeout. First check whether a job was created, then retry with the original idempotency key | | 503 | `SERVICE_UNAVAILABLE`, `feature_disabled` | The service or feature is temporarily unavailable. Try again later | ## Retry guidance - Except for `429`, 4xx errors require fixing the request or the account state first; retrying unchanged will not succeed. - Retry `429` and `5xx` with exponential backoff. If the response includes `Retry-After`, wait for the time it specifies. - Keep the original `Idempotency-Key` when retrying a generation request so that no duplicate job is created or charged. --- # 错误处理 URL: https://docs.shixux.com/zh/operations/errors/ ## 错误响应格式 请求失败时,接口返回 4xx 或 5xx 状态码和 JSON 错误体: ```json {"code": "INSUFFICIENT_CREDITS", "detail": "Insufficient credits"} ``` - `code`:稳定的机器可读错误码,请根据它进行程序判断。 - `detail`:错误说明,用于排查问题。其内容可能调整,不要依赖其文本做判断。 部分错误会附带额外字段,例如上传额度超限时的 `quota`,详见各接口的响应说明。文本模型接口沿用 OpenAI 的错误格式,见[文本模型接入指南](https://docs.shixux.com/zh/text/guide/)。 ## 常见错误 | HTTP | 常见 `code` | 含义与处理 | | --- | --- | --- | | 401 | — | 未提供凭证,或凭证无效、已撤销。请检查 API Key 是否正确,以及该接口要求的是 API Key 还是控制台登录凭证 | | 402 | `INSUFFICIENT_CREDITS` | 积分不足。充值后重试 | | 403 | `ACCOUNT_DISABLED` | 账号已停用,请联系平台支持 | | 404 | `RESOURCE_NOT_FOUND` | 任务、音色、素材或 Webhook 端点不存在,或不属于当前账号 | | 409 | `IDEMPOTENCY_CONFLICT` | 同一个 `Idempotency-Key` 已用于不同的请求。重试原请求时保持参数不变;新的业务操作请使用新的键,见[异步任务](https://docs.shixux.com/zh/common/jobs/) | | 409 | `IMAGE_RATE_CHANGED`、`VIDEO_RATE_CONFLICT`、`VOICE_DESIGN_RATE_CONFLICT` | 费率或报价已更新。重新读取配置或报价后再提交 | | 409 | `CONFLICT` | 资源当前状态不允许该操作,例如音色正在使用中、任务已无法停止 | | 410 | `RESOURCE_EXPIRED`、`JOB_RESULT_EXPIRED`、`INPUT_ASSET_EXPIRED` | 结果或素材已过期或不可用。重新上传素材,或重新提交生成 | | 413 | `FILE_TOO_LARGE` | 请求体或文件过大 | | 422 | `VALIDATION_ERROR` | 请求参数不合法、引用的素材不存在,或素材尚未确认上传 | | 429 | `MAX_CONCURRENT_JOBS` | 账号同时进行的生成任务数已达上限。等待已有任务结束后再提交 | | 429 | `UPLOAD_RATE_LIMITED`、`UPLOAD_QUOTA_EXCEEDED` | 上传次数或容量超出额度。按 `Retry-After` 等待后重试,见[素材上传](https://docs.shixux.com/zh/common/uploads/) | | 429 | `RATE_LIMITED` | 请求过于频繁。降低频率并退避重试 | | 500、502、504 | `INTERNAL_ERROR`、`SERVICE_UNAVAILABLE`、`REQUEST_TIMEOUT` | 服务错误或处理超时。先确认任务是否已创建,再使用原幂等键重试 | | 503 | `SERVICE_UNAVAILABLE`、`feature_disabled` | 服务或该功能暂不可用。稍后重试 | ## 重试建议 - 除 `429` 外,4xx 错误需要先修正请求或处理账号状态,原样重试不会成功。 - 对 `429`、`5xx` 使用指数退避重试;响应带有 `Retry-After` 时,按其指定的时间等待。 - 重试生成请求时保留原 `Idempotency-Key`,避免重复创建任务和重复扣费。 --- # Data retention URL: https://docs.shixux.com/en/operations/retention/ ## Lifetimes and retention | Field | Where it appears | Meaning | |---|---|---| | `expires_in` | Upload URL response | Lifetime of the upload URL in seconds: 300 | | `delete_after` | Upload URL response | When an unconfirmed upload is deleted | | `expires_in` | Job result response | Lifetime of the download URL in seconds | | `retained_until` | Upload confirmation, job result and other responses | When the asset or result file stops being retained | The lifetime of a download URL is independent of how long the file is retained: an expired URL does not mean the file was deleted. After a URL expires, call [Retrieve a job result](https://docs.shixux.com/en/common/api/jobs/result/) again with the original job ID to get a new one. --- # 数据保留 URL: https://docs.shixux.com/zh/operations/retention/ ## 有效期与保留期限 | 字段 | 出现位置 | 含义 | |---|---|---| | `expires_in` | 申请上传地址的响应 | 上传地址的有效秒数,为 300 秒 | | `delete_after` | 申请上传地址的响应 | 未确认的上传将被删除的时间 | | `expires_in` | 获取任务结果的响应 | 下载地址的有效秒数 | | `retained_until` | 上传确认、任务结果等响应 | 素材或结果文件的保留截止时间 | 下载地址的有效期与文件的保留期限相互独立:下载地址过期不代表文件被删除。地址过期后,使用原任务 ID 重新调用[获取任务结果](https://docs.shixux.com/zh/common/api/jobs/result/)即可获得新地址。 --- # Create a chat completion URL: https://docs.shixux.com/en/text/api/chat-completions/ OpenAI-compatible chat completions; set stream=true to stream the output. Credits are reserved from max_tokens when the request starts and settled against actual usage, with any excess returned. API Keys only. POST /v1/chat/completions {"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","description":"A model id from GET /v1/models."},"messages":{"type":"array","minItems":1,"items":{"type":"object","properties":{"role":{"type":"string","enum":["system","user","assistant"]},"content":{"type":"string"},"name":{"type":"string"}},"required":["role","content"]}},"stream":{"type":"boolean"},"stream_options":{"type":"object","properties":{"include_usage":{"type":"boolean"}}},"max_tokens":{"type":"integer","minimum":1},"max_completion_tokens":{"type":"integer","minimum":1},"temperature":{"type":"number"},"top_p":{"type":"number"},"presence_penalty":{"type":"number"},"frequency_penalty":{"type":"number"},"seed":{"type":"integer"},"stop":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"},"maxItems":4}]},"response_format":{"type":"object","properties":{"type":{"type":"string","enum":["text","json_object"]}}},"reasoning_effort":{"type":"string","enum":["low","medium","high"]},"user":{"type":"string"}},"required":["model","messages"],"description":"OpenAI chat completion request. Unknown fields are ignored. n greater than 1, tools and non-text content are not supported."}}}},"responses":{"200":{"description":"Successful Response","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"chat.completion"},"created":{"type":"integer"},"model":{"type":"string"},"choices":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"message":{"type":"object","properties":{"role":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"reasoning_content":{"anyOf":[{"type":"string"},{"type":"null"}]}}},"finish_reason":{"anyOf":[{"type":"string"},{"type":"null"}]}}}},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer"},"completion_tokens":{"type":"integer"},"total_tokens":{"type":"integer"},"prompt_tokens_details":{"type":"object","properties":{"cached_tokens":{"type":"integer"}}},"completion_tokens_details":{"type":"object","properties":{"reasoning_tokens":{"type":"integer"}}}},"required":["prompt_tokens","completion_tokens","total_tokens"]}},"required":["id","object","created","model","choices"]}},"text/event-stream":{"schema":{"type":"string","description":"Server-sent events. Each data line is a chat.completion.chunk JSON object; the stream ends with data: [DONE]."}}}},"400":{"description":"Invalid request","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}},"401":{"description":"Invalid or revoked API key","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}},"402":{"description":"Insufficient credits","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}},"404":{"description":"Model not found","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}},"413":{"description":"Request too large","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}},"429":{"description":"Rate or concurrency limit reached","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."},"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}},"502":{"description":"Model service error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}},"503":{"description":"Feature disabled or service unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}},"504":{"description":"Model service timed out","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}}}} text Text to synthesize. It must not be all whitespace. In speech synthesis, indextts-2 accepts up to 2048 characters, and indextts-2.5 accepts up to 2000 characters that include a letter or digit. Audio composition scripts are limited to 5000 characters in total. model Model ID. For image and video models, use the corresponding settings endpoint for current availability, resolutions and rates. Speech synthesis and audio composition accept indextts-2 (default) or indextts-2.5. seed Optional deterministic seed from 0 to 2147483647. Omit it when the selected model does not support seeds. ```curl curl -X POST 'https://shixux.com/api/v1/chat/completions' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"model":"deepseek-v4.1-flash","messages":[{"role":"system","content":"你是一个简洁的助手。"},{"role":"user","content":"用一句话介绍时序科技。"}],"max_tokens":512,"stream":false}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/chat/completions", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json" }, body: JSON.stringify({ "model": "deepseek-v4.1-flash", "messages": [ { "role": "system", "content": "你是一个简洁的助手。" }, { "role": "user", "content": "用一句话介绍时序科技。" } ], "max_tokens": 512, "stream": false }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/chat/completions", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json"}, data="{\"model\":\"deepseek-v4.1-flash\",\"messages\":[{\"role\":\"system\",\"content\":\"你是一个简洁的助手。\"},{\"role\":\"user\",\"content\":\"用一句话介绍时序科技。\"}],\"max_tokens\":512,\"stream\":false}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/chat/completions", strings.NewReader("{\"model\":\"deepseek-v4.1-flash\",\"messages\":[{\"role\":\"system\",\"content\":\"你是一个简洁的助手。\"},{\"role\":\"user\",\"content\":\"用一句话介绍时序科技。\"}],\"max_tokens\":512,\"stream\":false}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 创建对话补全 URL: https://docs.shixux.com/zh/text/api/chat-completions/ 兼容 OpenAI 的对话补全接口,设置 stream=true 可流式输出。请求开始时按 max_tokens 预扣积分,完成后按实际用量结算,多扣部分退回。只接受 API Key。 POST /v1/chat/completions {"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","description":"A model id from GET /v1/models."},"messages":{"type":"array","minItems":1,"items":{"type":"object","properties":{"role":{"type":"string","enum":["system","user","assistant"]},"content":{"type":"string"},"name":{"type":"string"}},"required":["role","content"]}},"stream":{"type":"boolean"},"stream_options":{"type":"object","properties":{"include_usage":{"type":"boolean"}}},"max_tokens":{"type":"integer","minimum":1},"max_completion_tokens":{"type":"integer","minimum":1},"temperature":{"type":"number"},"top_p":{"type":"number"},"presence_penalty":{"type":"number"},"frequency_penalty":{"type":"number"},"seed":{"type":"integer"},"stop":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"},"maxItems":4}]},"response_format":{"type":"object","properties":{"type":{"type":"string","enum":["text","json_object"]}}},"reasoning_effort":{"type":"string","enum":["low","medium","high"]},"user":{"type":"string"}},"required":["model","messages"],"description":"OpenAI chat completion request. Unknown fields are ignored. n greater than 1, tools and non-text content are not supported."}}}},"responses":{"200":{"description":"Successful Response","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"chat.completion"},"created":{"type":"integer"},"model":{"type":"string"},"choices":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"message":{"type":"object","properties":{"role":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"reasoning_content":{"anyOf":[{"type":"string"},{"type":"null"}]}}},"finish_reason":{"anyOf":[{"type":"string"},{"type":"null"}]}}}},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer"},"completion_tokens":{"type":"integer"},"total_tokens":{"type":"integer"},"prompt_tokens_details":{"type":"object","properties":{"cached_tokens":{"type":"integer"}}},"completion_tokens_details":{"type":"object","properties":{"reasoning_tokens":{"type":"integer"}}}},"required":["prompt_tokens","completion_tokens","total_tokens"]}},"required":["id","object","created","model","choices"]}},"text/event-stream":{"schema":{"type":"string","description":"Server-sent events. Each data line is a chat.completion.chunk JSON object; the stream ends with data: [DONE]."}}}},"400":{"description":"Invalid request","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}},"401":{"description":"Invalid or revoked API key","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}},"402":{"description":"Insufficient credits","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}},"404":{"description":"Model not found","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}},"413":{"description":"Request too large","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}},"429":{"description":"Rate or concurrency limit reached","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."},"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}},"502":{"description":"Model service error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}},"503":{"description":"Feature disabled or service unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}},"504":{"description":"Model service timed out","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}}}} text 要合成的文本,不能全为空白。语音合成中,indextts-2 最多 2048 个字符,indextts-2.5 最多 2000 个字符且须包含文字或数字;音频编排的台词合计最多 5000 个字符。 model 模型 ID。图片和视频模型的可用状态、清晰度和费率以对应配置接口的返回为准;语音合成和音频编排可选 indextts-2(默认)或 indextts-2.5。 seed 可选的确定性种子,范围 0–2147483647;模型不支持时不要传入。 ```curl curl -X POST 'https://shixux.com/api/v1/chat/completions' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"model":"deepseek-v4.1-flash","messages":[{"role":"system","content":"你是一个简洁的助手。"},{"role":"user","content":"用一句话介绍时序科技。"}],"max_tokens":512,"stream":false}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/chat/completions", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json" }, body: JSON.stringify({ "model": "deepseek-v4.1-flash", "messages": [ { "role": "system", "content": "你是一个简洁的助手。" }, { "role": "user", "content": "用一句话介绍时序科技。" } ], "max_tokens": 512, "stream": false }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/chat/completions", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json"}, data="{\"model\":\"deepseek-v4.1-flash\",\"messages\":[{\"role\":\"system\",\"content\":\"你是一个简洁的助手。\"},{\"role\":\"user\",\"content\":\"用一句话介绍时序科技。\"}],\"max_tokens\":512,\"stream\":false}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/chat/completions", strings.NewReader("{\"model\":\"deepseek-v4.1-flash\",\"messages\":[{\"role\":\"system\",\"content\":\"你是一个简洁的助手。\"},{\"role\":\"user\",\"content\":\"用一句话介绍时序科技。\"}],\"max_tokens\":512,\"stream\":false}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # List text models URL: https://docs.shixux.com/en/text/api/models/ List the text models you can call, with context window, output limit and credits per million tokens. The response is compatible with the OpenAI model list. GET /v1/models {"responses":{"200":{"description":"Successful Response","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"model"},"created":{"type":"integer"},"display_name":{"type":"string"},"context_window":{"type":"integer"},"max_output_tokens":{"type":"integer"},"supports_stream":{"type":"boolean"},"supports_thinking":{"type":"boolean"},"pricing":{"type":"object","properties":{"input_credits_per_million":{"type":"string"},"cached_input_credits_per_million":{"type":"string"},"output_credits_per_million":{"type":"string"}},"required":["input_credits_per_million","cached_input_credits_per_million","output_credits_per_million"],"additionalProperties":false,"description":"Credits per million tokens as decimal strings with four decimals."}},"required":["id","object","created","display_name","context_window","max_output_tokens","supports_stream","supports_thinking","pricing"],"additionalProperties":false}}},"required":["object","data"],"additionalProperties":false}}}},"401":{"description":"Invalid or revoked API key","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}},"500":{"description":"Server error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}}}} model Model ID. For image and video models, use the corresponding settings endpoint for current availability, resolutions and rates. Speech synthesis and audio composition accept indextts-2 (default) or indextts-2.5. ```curl curl -X GET 'https://shixux.com/api/v1/models' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/models", { method: "GET", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/models", method="GET", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/models", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 列出文本模型 URL: https://docs.shixux.com/zh/text/api/models/ 列出当前可调用的文本模型,包括上下文窗口、最大输出和每百万 Token 的积分单价。响应结构兼容 OpenAI 的模型列表。 GET /v1/models {"responses":{"200":{"description":"Successful Response","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"model"},"created":{"type":"integer"},"display_name":{"type":"string"},"context_window":{"type":"integer"},"max_output_tokens":{"type":"integer"},"supports_stream":{"type":"boolean"},"supports_thinking":{"type":"boolean"},"pricing":{"type":"object","properties":{"input_credits_per_million":{"type":"string"},"cached_input_credits_per_million":{"type":"string"},"output_credits_per_million":{"type":"string"}},"required":["input_credits_per_million","cached_input_credits_per_million","output_credits_per_million"],"additionalProperties":false,"description":"Credits per million tokens as decimal strings with four decimals."}},"required":["id","object","created","display_name","context_window","max_output_tokens","supports_stream","supports_thinking","pricing"],"additionalProperties":false}}},"required":["object","data"],"additionalProperties":false}}}},"401":{"description":"Invalid or revoked API key","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}},"500":{"description":"Server error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["message","type","code","param"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Error body used by the OpenAI-compatible routes."}}}}}} model 模型 ID。图片和视频模型的可用状态、清晰度和费率以对应配置接口的返回为准;语音合成和音频编排可选 indextts-2(默认)或 indextts-2.5。 ```curl curl -X GET 'https://shixux.com/api/v1/models' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/models", { method: "GET", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/models", method="GET", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/models", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Text model guide URL: https://docs.shixux.com/en/text/guide/ ## Setup The chat endpoint is compatible with OpenAI Chat Completions. With an OpenAI SDK, set `base_url` to the API Base URL `https://shixux.com/api` followed by `/v1`, and set `api_key` to your [API Key](https://docs.shixux.com/en/getting-started/keys/). The endpoints accept API Keys only and do not allow cross-origin browser requests. Call them from your server and never expose your API Key in web pages or client apps. Call [POST /v1/chat/completions](https://docs.shixux.com/en/text/api/chat-completions/) with a model ID listed in [Text model overview](https://docs.shixux.com/en/text/) as `model`. ```python from openai import OpenAI client = OpenAI(base_url="https://shixux.com/api/v1", api_key="yb_xxx_yyy") reply = client.chat.completions.create( model="deepseek-v4.1-flash", messages=[{"role": "user", "content": "Describe Shixu in one sentence."}], max_tokens=512, ) print(reply.choices[0].message.content) print(reply.usage) ``` ```js import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://shixux.com/api/v1", apiKey: process.env.YB_API_KEY }); const reply = await client.chat.completions.create({ model: "deepseek-v4.1-flash", messages: [{ role: "user", content: "Describe Shixu in one sentence." }], max_tokens: 512, }); console.log(reply.choices[0].message.content); console.log(reply.usage); ``` ## Streaming With `stream: true`, the response is `text/event-stream`. Each data line is a `chat.completion.chunk`, and the stream ends with `data: [DONE]`. To receive usage at the end of the stream, add `"stream_options": {"include_usage": true}` to the request. ```bash curl -N 'https://shixux.com/api/v1/chat/completions' \ -H 'Authorization: Bearer yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"model":"deepseek-v4.1-flash","stream":true,"stream_options":{"include_usage":true},"messages":[{"role":"user","content":"Hello"}]}' ``` - A single request can last up to 10 minutes. - If the client disconnects, generation stops and the usage produced so far is billed. - If an error occurs after the stream has started, a data chunk containing `error` is sent before the stream ends. The HTTP status is already 200 at that point, so check the chunk content for errors. ## Supported parameters These request fields are supported: `model`, `messages` (text messages with the `system`, `user` and `assistant` roles), `stream`, `stream_options.include_usage`, `max_tokens` or `max_completion_tokens`, `temperature`, `top_p`, `stop`, `presence_penalty`, `frequency_penalty`, `seed`, `response_format`, `reasoning_effort` and `user`. Fields not listed are ignored. `n` greater than 1, tool calls (function calling) and non-text content such as images are not supported yet and return `400 unsupported_parameter`. Models that support reasoning return their reasoning in `message.reasoning_content`; these tokens are billed at the output price. ## Billing Prices are in credits per million tokens, with separate input, cached input and output prices. Read them from `pricing` in `GET /v1/models`; usage records are available in the console. 1. When the request starts, credits are reserved based on the estimated input length and `max_tokens` (a default applies when it is omitted). If the balance is insufficient, the API returns `402`. 2. When generation completes, the request is settled against actual usage and any excess reservation is returned immediately. 3. If the request fails or produces no billable output, the reservation is refunded in full. If a streaming request is interrupted, the usage actually produced is billed. A larger `max_tokens` reserves more credits; set a smaller value when you only need a short answer. Price changes apply only to requests made after the change. ## Limits and errors Each account has limits on requests per minute and concurrent requests, and `max_tokens` and the request body size are also limited. Exceeding them returns the errors below. Error bodies use the OpenAI format: ```json {"error": {"message": "Rate limit of 60 requests per minute reached", "type": "rate_limit_error", "code": "rate_limit_exceeded", "param": null}} ``` | HTTP | `code` | What to do | | --- | --- | --- | | 400 | `invalid_request`, `unsupported_parameter` | Fix the request according to `param` | | 401 | `invalid_api_key` | Check that the API Key is correct and has not been revoked | | 402 | `insufficient_credits` | Top up, or lower `max_tokens` | | 404 | `model_not_found` | Check the model ID against [available models](https://docs.shixux.com/en/text/) | | 413 | `request_too_large` | Shorten the conversation | | 429 | `rate_limit_exceeded`, `concurrency_limit_exceeded` | Wait for `Retry-After`, then retry | | 502, 504 | `service_unavailable` | The service is temporarily unavailable; retry later | | 503 | `feature_disabled`, `service_unavailable` | The feature is not enabled or the service is under maintenance | Every response includes an `X-Request-ID` header. When contacting support about a problem, provide this value; you do not need to share your API Key or conversation content. --- # 文本模型接入指南 URL: https://docs.shixux.com/zh/text/guide/ ## 接入方式 对话接口兼容 OpenAI Chat Completions。使用 OpenAI SDK 时,将 `base_url` 设为 API Base URL `https://shixux.com/api` 加上 `/v1`,`api_key` 设为你的 [API Key](https://docs.shixux.com/zh/getting-started/keys/) 即可。 接口只接受 API Key,且不支持浏览器跨域请求,请在服务器端调用,不要在网页或客户端应用中暴露 API Key。 调用 [POST /v1/chat/completions](https://docs.shixux.com/zh/text/api/chat-completions/) 即可,`model` 填写[文本模型总览](https://docs.shixux.com/zh/text/)中列出的模型 ID。 ```python from openai import OpenAI client = OpenAI(base_url="https://shixux.com/api/v1", api_key="yb_xxx_yyy") reply = client.chat.completions.create( model="deepseek-v4.1-flash", messages=[{"role": "user", "content": "用一句话介绍时序科技。"}], max_tokens=512, ) print(reply.choices[0].message.content) print(reply.usage) ``` ```js import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://shixux.com/api/v1", apiKey: process.env.YB_API_KEY }); const reply = await client.chat.completions.create({ model: "deepseek-v4.1-flash", messages: [{ role: "user", content: "用一句话介绍时序科技。" }], max_tokens: 512, }); console.log(reply.choices[0].message.content); console.log(reply.usage); ``` ## 流式输出 设置 `stream: true` 后,响应类型为 `text/event-stream`,每个数据行是一个 `chat.completion.chunk`,最后以 `data: [DONE]` 结束。如需在流末尾收到用量信息,请在请求中加入 `"stream_options": {"include_usage": true}`。 ```bash curl -N 'https://shixux.com/api/v1/chat/completions' \ -H 'Authorization: Bearer yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"model":"deepseek-v4.1-flash","stream":true,"stream_options":{"include_usage":true},"messages":[{"role":"user","content":"你好"}]}' ``` - 单次请求最长持续 10 分钟。 - 客户端中途断开连接后,生成随即停止,已产生的用量照常计费。 - 流开始后如果发生错误,会先发送一个包含 `error` 的数据块再结束。此时 HTTP 状态码已是 200,请以数据块内容判断是否出错。 ## 支持的参数 支持以下请求字段:`model`、`messages`(`system`、`user`、`assistant` 角色的文本消息)、`stream`、`stream_options.include_usage`、`max_tokens` 或 `max_completion_tokens`、`temperature`、`top_p`、`stop`、`presence_penalty`、`frequency_penalty`、`seed`、`response_format`、`reasoning_effort` 和 `user`。未列出的字段会被忽略。 暂不支持 `n` 大于 1、工具调用(function calling)以及图片等非文本内容,传入时返回 `400 unsupported_parameter`。 支持深度思考的模型会在 `message.reasoning_content` 中返回思考过程,这部分 Token 按输出单价计费。 ## 计费 单价以积分每百万 Token 计,分为输入、缓存命中输入和输出三档,可从 `GET /v1/models` 的 `pricing` 字段读取,消费记录可在控制台查看。 1. 请求开始时,根据输入长度估算和 `max_tokens`(未传时使用默认值)预扣积分;余额不足时返回 `402`。 2. 生成完成后,按实际用量结算,多预扣的积分立即退回。 3. 请求失败或未产生可计费的输出时,预扣积分全额退回。流式请求中断时,按已产生的实际用量结算。 `max_tokens` 越大,预扣的积分越多;只需简短回答时,建议设置较小的值。价格调整仅影响调整后发起的请求。 ## 限制与错误 每个账号的每分钟请求数和同时进行的请求数有上限,`max_tokens` 和请求体大小也有上限,超出时返回下表中的错误。错误体采用 OpenAI 的格式: ```json {"error": {"message": "Rate limit of 60 requests per minute reached", "type": "rate_limit_error", "code": "rate_limit_exceeded", "param": null}} ``` | HTTP | `code` | 处理方式 | | --- | --- | --- | | 400 | `invalid_request`、`unsupported_parameter` | 根据 `param` 修正请求 | | 401 | `invalid_api_key` | 检查 API Key 是否正确、是否已被撤销 | | 402 | `insufficient_credits` | 充值,或调小 `max_tokens` | | 404 | `model_not_found` | 核对模型 ID 是否与[可用模型](https://docs.shixux.com/zh/text/)一致 | | 413 | `request_too_large` | 缩短对话内容 | | 429 | `rate_limit_exceeded`、`concurrency_limit_exceeded` | 按 `Retry-After` 等待后重试 | | 502、504 | `service_unavailable` | 服务暂时不可用,可稍后重试 | | 503 | `feature_disabled`、`service_unavailable` | 功能未开放或服务维护中 | 每个响应都带有 `X-Request-ID` 响应头。联系支持排查问题时,请提供该值,无需提供 API Key 或对话内容。 --- # Text model overview URL: https://docs.shixux.com/en/text/ ## Available models | Model ID | Model version | Context window (tokens) | Max output (tokens) | Streaming | Reasoning | | --- | --- | --- | --- | --- | --- | | `deepseek-v4.1-flash` | `1017` | 1,000,000 | 393,216 | Supported | Supported | - Send the model ID in the `model` field of your request, without the version number. - Models that support reasoning return it in `message.reasoning_content`; these tokens are billed at the output price. - The `max_tokens` you can set per request cannot exceed the max output and is also subject to a platform per-request limit. Exceeding it returns `400`, and the error message gives the maximum allowed value. - Input, cached input and output tokens are billed separately; see [Billing and credits](https://docs.shixux.com/en/operations/billing/). ## Endpoints Text models are compatible with the OpenAI Chat Completions API. They return results directly or as a stream and do not create jobs. | Endpoint | Purpose | | --- | --- | | [POST /v1/chat/completions](https://docs.shixux.com/en/text/api/chat-completions/) | Chat completions with streaming | | [GET /v1/models](https://docs.shixux.com/en/text/api/models/) | Return the available models and current prices in the OpenAI model list format, for programmatic use | - Requesting a model ID that does not exist returns `404 model_not_found`. - If text models are not enabled, requests return `503 feature_disabled`. - Text model endpoints accept API Keys only; call them from your server. See the [text model guide](https://docs.shixux.com/en/text/guide/) for SDK setup, streaming, supported parameters, billing and error handling. --- # 文本模型总览 URL: https://docs.shixux.com/zh/text/ ## 可用模型 | 模型 ID | 模型版本 | 上下文窗口(Token) | 最大输出(Token) | 流式输出 | 深度思考 | | --- | --- | --- | --- | --- | --- | | `deepseek-v4.1-flash` | `1017` | 1,000,000 | 393,216 | 支持 | 支持 | - 调用时将模型 ID 填入请求的 `model` 字段,不需要附加版本号。 - 支持深度思考的模型会在 `message.reasoning_content` 中返回思考过程,这部分 Token 按输出单价计费。 - 单次请求可设置的 `max_tokens` 不超过最大输出,同时受平台单次请求上限约束;超出时返回 `400`,错误信息会给出允许的最大值。 - 按输入、缓存命中输入和输出 Token 分别计费,计费规则见[计费与积分](https://docs.shixux.com/zh/operations/billing/)。 ## 接口 文本模型兼容 OpenAI Chat Completions 接口,直接返回或流式输出结果,不创建任务。 | 接口 | 用途 | | --- | --- | | [POST /v1/chat/completions](https://docs.shixux.com/zh/text/api/chat-completions/) | 对话补全,支持流式输出 | | [GET /v1/models](https://docs.shixux.com/zh/text/api/models/) | 以 OpenAI 模型列表格式返回可用模型及当前单价,便于程序读取 | - 请求不存在的模型 ID 时,返回 `404 model_not_found`。 - 文本模型功能未开放时,请求返回 `503 feature_disabled`。 - 文本模型接口只接受 API Key,请在服务器端调用。 SDK 接入、流式输出、支持的参数、计费和错误处理见[文本模型接入指南](https://docs.shixux.com/zh/text/guide/)。 --- # Stop a generation job URL: https://docs.shixux.com/en/video/api/cancel/ Stop a generation job of your account. If the job is stopped before generation starts, the reserved credits are refunded in full; if generation has started, they are not refunded. Pass queued_only=true to stop the job only while it is still queued. Repeated requests incur no extra charge. POST /v1/jobs/{job_id}/cancel {"parameters":[{"in":"path","name":"job_id","required":true,"schema":{"title":"Job Id","type":"string"}},{"in":"query","name":"queued_only","description":"Stop the job only while it is still queued. If generation has started, return 409 and leave the job running.","schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"job_status":{"anyOf":[{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},{"type":"null"}]},"ok":{"default":true,"title":"Ok","type":"boolean"}},"title":"JobCancellationResponse","type":"object"}}},"description":"Successful Response"},"404":{"description":"Job not found or not owned by this account","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"The job cannot be stopped, or generation started before a queued_only request took effect","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X POST 'https://shixux.com/api/v1/jobs/job_id_example/cancel' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/jobs/job_id_example/cancel", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/jobs/job_id_example/cancel", method="POST", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/jobs/job_id_example/cancel", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 停止生成任务 URL: https://docs.shixux.com/zh/video/api/cancel/ 停止当前账号的生成任务。任务开始生成前停止,预扣积分全部退回;已开始生成的任务被停止时,预扣积分不予退回。传入 queued_only=true 时仅停止仍在排队的任务。重复请求不会产生额外费用。 POST /v1/jobs/{job_id}/cancel {"parameters":[{"in":"path","name":"job_id","required":true,"schema":{"title":"Job Id","type":"string"}},{"in":"query","name":"queued_only","description":"Stop the job only while it is still queued. If generation has started, return 409 and leave the job running.","schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"job_status":{"anyOf":[{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},{"type":"null"}]},"ok":{"default":true,"title":"Ok","type":"boolean"}},"title":"JobCancellationResponse","type":"object"}}},"description":"Successful Response"},"404":{"description":"Job not found or not owned by this account","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"The job cannot be stopped, or generation started before a queued_only request took effect","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} ```curl curl -X POST 'https://shixux.com/api/v1/jobs/job_id_example/cancel' \ -H 'X-API-Key: yb_xxx_yyy' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/jobs/job_id_example/cancel", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy" }, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/jobs/job_id_example/cancel", method="POST", headers={"X-API-Key":"yb_xxx_yyy"}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/jobs/job_id_example/cancel", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Get video generation settings URL: https://docs.shixux.com/en/video/api/config/ Get the current availability of each video model and its supported modes, durations, aspect ratios, resolutions, reference limits and rates. No authentication is required. Before submitting, check models[].available and available_resolutions. GET /v1/video/config {"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"available":{"type":"boolean"},"available_resolutions":{"type":"array","items":{"type":"string","enum":["768p","2k"]}},"message":{"type":"string"},"billing":{"type":"object","properties":{"credits_per_second":{"anyOf":[{"type":"number"},{"type":"null"}]},"version":{"type":"integer"},"updated_at":{"type":"string","format":"date-time"},"rates":{"type":"array","items":{"type":"object","properties":{"model":{"type":"string","description":"模型 ID。","enum":["minmax-h3-flash","minmax-h3-pro","wan3.0-video","seedance-2.0","seedance-2.5","seedance-2.5-flash","kling-4.0","seedance-2.0-mini","seedance-2.0-fast"]},"resolution":{"type":"string","description":"该模型的输出清晰度。","enum":["768p","2k","480p","720p","1080p","4k"]},"credits_per_second":{"description":"按输出秒数计费的积分。Token 计费模型返回 null。","anyOf":[{"type":"number"},{"type":"null"}]},"input_video_credits_per_second":{"description":"带参考视频时按输入视频秒数计费的积分。","anyOf":[{"type":"number"},{"type":"null"}]},"credits_per_million_tokens":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Credits per million generated video tokens for requests without video input."},"credits_per_million_tokens_with_video":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Credits per million billable tokens for requests with video input."}},"required":["model","resolution","credits_per_second"]}},"official_enabled":{"type":"object","additionalProperties":{"type":"boolean"}}},"required":["credits_per_second","version","updated_at"]},"available_modes":{"type":"array","items":{"type":"string","enum":["t2va","fl2va","ref2va"]}},"models":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"模型 ID,用于 VideoRequest.model。"},"name":{"type":"string","description":"模型显示名称。"},"modes":{"type":"array","description":"模型支持的生成模式。","items":{"type":"string","enum":["t2va","fl2va","ref2va"]}},"ratios":{"type":"array","description":"模型支持的输出画幅。","items":{"type":"string"}},"min_duration":{"type":"integer","description":"单个输出允许的最短时长,单位为秒。"},"max_duration":{"type":"integer","description":"单个输出允许的最长时长,单位为秒。"},"max_prompt_chars":{"type":"integer","description":"提示词最大字符数。"},"supports_seed":{"type":"boolean","description":"是否接受 VideoRequest.seed。"},"style_presets":{"type":"array","description":"模型允许提交的风格预设值。","items":{"type":"string"}},"available":{"type":"boolean","description":"模型当前是否可以提交。"},"available_resolutions":{"type":"array","description":"当前可以提交的清晰度。","items":{"type":"string"}},"rates":{"type":"array","description":"该模型的费率列表。列表中的规格不一定都可提交,以 available_resolutions 为准。","items":{"$ref":"#/components/schemas/VideoRate"}},"max_images":{"type":"integer","description":"最多可提交的图片参考数量。","minimum":0},"max_videos":{"type":"integer","description":"最多可提交的视频参考数量。","minimum":0},"max_audios":{"type":"integer","description":"最多可提交的音频参考数量。","minimum":0},"max_references":{"type":"integer","description":"参考素材总数上限。","minimum":0},"resolutions":{"type":"array","description":"模型支持的全部清晰度;当前可以提交的清晰度见 available_resolutions。","items":{"type":"string"}},"supports_generate_audio":{"type":"boolean","description":"是否支持请求中控制生成音频。"},"supports_audio_only":{"type":"boolean","description":"是否允许仅使用音频参考素材。"},"keyframe_adaptive_only":{"type":"boolean","description":"首尾帧模式是否必须使用 adaptive 画幅。"},"min_clip_seconds":{"type":"integer","description":"参考视频片段的最短时长,单位为秒。"},"max_clip_seconds":{"type":"integer","description":"参考视频片段的最长时长,单位为秒。"},"max_combined_seconds":{"type":"integer","description":"多个参考视频合计时长上限,单位为秒。"}},"required":["id","name","modes","ratios","min_duration","max_duration","max_prompt_chars","supports_seed","style_presets","available","available_resolutions","rates","max_images","max_videos","max_audios","max_references"]}}},"required":["enabled","available","available_resolutions","message","billing","available_modes"]}}},"description":"Successful Response"},"503":{"content":{"application/json":{"schema":{"properties":{"detail":{"title":"Detail","type":"string"}},"required":["detail"],"title":"ErrorDetail","type":"object"}}},"description":"Feature Configuration Unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} resolution Video resolution. minmax-h3-flash and minmax-h3-pro accept 768p or 2k (2k output is automatically enhanced). For other models, use the resolutions returned by GET /v1/video/config. model Model ID. For image and video models, use the corresponding settings endpoint for current availability, resolutions and rates. Speech synthesis and audio composition accept indextts-2 (default) or indextts-2.5. ```curl curl -X GET 'https://shixux.com/api/v1/video/config' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/video/config", { method: "GET", headers: {}, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/video/config", method="GET", headers={}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/video/config", nil) if err != nil { panic(err) } resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 查询视频生成配置 URL: https://docs.shixux.com/zh/video/api/config/ 查询各视频模型当前是否可用,以及支持的模式、时长、画幅、清晰度、参考素材上限和费率。无需认证。提交前请以 models[].available 和 available_resolutions 为准。 GET /v1/video/config {"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"available":{"type":"boolean"},"available_resolutions":{"type":"array","items":{"type":"string","enum":["768p","2k"]}},"message":{"type":"string"},"billing":{"type":"object","properties":{"credits_per_second":{"anyOf":[{"type":"number"},{"type":"null"}]},"version":{"type":"integer"},"updated_at":{"type":"string","format":"date-time"},"rates":{"type":"array","items":{"type":"object","properties":{"model":{"type":"string","description":"模型 ID。","enum":["minmax-h3-flash","minmax-h3-pro","wan3.0-video","seedance-2.0","seedance-2.5","seedance-2.5-flash","kling-4.0","seedance-2.0-mini","seedance-2.0-fast"]},"resolution":{"type":"string","description":"该模型的输出清晰度。","enum":["768p","2k","480p","720p","1080p","4k"]},"credits_per_second":{"description":"按输出秒数计费的积分。Token 计费模型返回 null。","anyOf":[{"type":"number"},{"type":"null"}]},"input_video_credits_per_second":{"description":"带参考视频时按输入视频秒数计费的积分。","anyOf":[{"type":"number"},{"type":"null"}]},"credits_per_million_tokens":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Credits per million generated video tokens for requests without video input."},"credits_per_million_tokens_with_video":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Credits per million billable tokens for requests with video input."}},"required":["model","resolution","credits_per_second"]}},"official_enabled":{"type":"object","additionalProperties":{"type":"boolean"}}},"required":["credits_per_second","version","updated_at"]},"available_modes":{"type":"array","items":{"type":"string","enum":["t2va","fl2va","ref2va"]}},"models":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"模型 ID,用于 VideoRequest.model。"},"name":{"type":"string","description":"模型显示名称。"},"modes":{"type":"array","description":"模型支持的生成模式。","items":{"type":"string","enum":["t2va","fl2va","ref2va"]}},"ratios":{"type":"array","description":"模型支持的输出画幅。","items":{"type":"string"}},"min_duration":{"type":"integer","description":"单个输出允许的最短时长,单位为秒。"},"max_duration":{"type":"integer","description":"单个输出允许的最长时长,单位为秒。"},"max_prompt_chars":{"type":"integer","description":"提示词最大字符数。"},"supports_seed":{"type":"boolean","description":"是否接受 VideoRequest.seed。"},"style_presets":{"type":"array","description":"模型允许提交的风格预设值。","items":{"type":"string"}},"available":{"type":"boolean","description":"模型当前是否可以提交。"},"available_resolutions":{"type":"array","description":"当前可以提交的清晰度。","items":{"type":"string"}},"rates":{"type":"array","description":"该模型的费率列表。列表中的规格不一定都可提交,以 available_resolutions 为准。","items":{"$ref":"#/components/schemas/VideoRate"}},"max_images":{"type":"integer","description":"最多可提交的图片参考数量。","minimum":0},"max_videos":{"type":"integer","description":"最多可提交的视频参考数量。","minimum":0},"max_audios":{"type":"integer","description":"最多可提交的音频参考数量。","minimum":0},"max_references":{"type":"integer","description":"参考素材总数上限。","minimum":0},"resolutions":{"type":"array","description":"模型支持的全部清晰度;当前可以提交的清晰度见 available_resolutions。","items":{"type":"string"}},"supports_generate_audio":{"type":"boolean","description":"是否支持请求中控制生成音频。"},"supports_audio_only":{"type":"boolean","description":"是否允许仅使用音频参考素材。"},"keyframe_adaptive_only":{"type":"boolean","description":"首尾帧模式是否必须使用 adaptive 画幅。"},"min_clip_seconds":{"type":"integer","description":"参考视频片段的最短时长,单位为秒。"},"max_clip_seconds":{"type":"integer","description":"参考视频片段的最长时长,单位为秒。"},"max_combined_seconds":{"type":"integer","description":"多个参考视频合计时长上限,单位为秒。"}},"required":["id","name","modes","ratios","min_duration","max_duration","max_prompt_chars","supports_seed","style_presets","available","available_resolutions","rates","max_images","max_videos","max_audios","max_references"]}}},"required":["enabled","available","available_resolutions","message","billing","available_modes"]}}},"description":"Successful Response"},"503":{"content":{"application/json":{"schema":{"properties":{"detail":{"title":"Detail","type":"string"}},"required":["detail"],"title":"ErrorDetail","type":"object"}}},"description":"Feature Configuration Unavailable","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} resolution 视频清晰度。minmax-h3-flash 和 minmax-h3-pro 支持 768p 和 2k(2k 输出会自动增强画质);其他模型的可用清晰度以 GET /v1/video/config 的返回为准。 model 模型 ID。图片和视频模型的可用状态、清晰度和费率以对应配置接口的返回为准;语音合成和音频编排可选 indextts-2(默认)或 indextts-2.5。 ```curl curl -X GET 'https://shixux.com/api/v1/video/config' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/video/config", { method: "GET", headers: {}, }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/video/config", method="GET", headers={}, ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" ) func main() { req, err := http.NewRequest("GET", "https://shixux.com/api/v1/video/config", nil) if err != nil { panic(err) } resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Create a video URL: https://docs.shixux.com/en/video/api/generate/ Create a video generation job. Before submitting, read the video generation settings and get a video quote, then pass the quote's quote_id and rate_version as quote_id and quote_version. Mode, duration, aspect ratio, resolution and reference counts must match the selected model's settings. POST /v1/video/generate {"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","description":"生成模式。t2va 为文生视频,fl2va 使用首帧和尾帧,ref2va 使用多模态参考素材。","enum":["t2va","fl2va","ref2va"]},"prompt":{"type":"string","description":"视频提示词。可使用请求中已登记的 Picture、Video 和 Audio 引用标记。","minLength":1,"maxLength":20000},"duration":{"type":"integer","description":"输出时长,具体范围由 GET /v1/video/config 返回的模型能力决定。","minimum":1,"maximum":30,"default":5},"ratio":{"type":"string","description":"输出画幅。部分模型的首尾帧请求必须使用 adaptive,以 GET /v1/video/config 为准。","enum":["16:9","9:16","1:1","4:3","3:4","21:9","adaptive"]},"seed":{"type":"integer","description":"可选的非负随机种子,用于需要稳定结果的请求。","minimum":0,"maximum":2147483647},"references":{"type":"array","description":"有序参考素材。kind 为 image、video 或 audio,role 为 reference、first 或 last。","maxItems":50,"items":{"type":"object","properties":{"asset_id":{"description":"当前账号拥有且已完成上传的素材 ID。","type":"string"},"kind":{"description":"素材类型。image、video 或 audio。","type":"string","enum":["image","video","audio"]},"role":{"description":"素材用途。reference 为普通参考,first 和 last 仅用于首尾帧模式。","type":"string","enum":["reference","first","last"]}},"required":["asset_id","kind","role"]}},"resolution":{"type":"string","description":"输出清晰度。模型支持的实际选项以 GET /v1/video/config 返回为准。","enum":["768p","2k","480p","720p","1080p","4k"],"default":"768p","title":"Resolution"},"model":{"type":"string","description":"视频模型 ID。省略时使用默认模型。提交前应先读取 GET /v1/video/config 并报价。","enum":["minmax-h3-flash","minmax-h3-pro","wan3.0-video","seedance-2.0","seedance-2.5","seedance-2.5-flash","kling-4.0","seedance-2.0-mini","seedance-2.0-fast"]},"quote_version":{"type":"integer","description":"报价配置版本。必须与 POST /v1/video/quote 返回的版本一致。","minimum":1},"style_preset":{"type":"string","description":"风格预设,仅可传入 GET /v1/video/config 为所选模型返回的 style_presets 中的值;没有可用预设时省略。"},"voice_bindings":{"type":"array","description":"将图片素材与声音素材绑定,用于指定角色的画面和声音。","maxItems":30,"items":{"type":"object","properties":{"image_asset_id":{"type":"string","format":"uuid"},"audio_asset_id":{"type":"string","format":"uuid"}},"required":["image_asset_id","audio_asset_id"]}},"generate_audio":{"type":"boolean","description":"Whether to generate audio with the video, for models whose supports_generate_audio is true. Defaults to true."},"quote_id":{"type":"string","description":"POST /v1/video/quote 返回的报价 ID,绑定本次模型、素材、提示词、时长和清晰度。"}},"required":["mode","prompt","duration","ratio","references","resolution"]}}}},"parameters":[{"in":"header","name":"Idempotency-Key","schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}}],"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}},"description":"Successful Response"},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"Idempotency-Key was already used for a different request (IDEMPOTENCY_CONFLICT).","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Reference asset expired; upload the reference again.","content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"},{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}]}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}},"429":{"description":"Concurrent job limit (MAX_CONCURRENT_JOBS) or request rate limit (RATE_LIMITED) reached.","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"},{"properties":{"code":{"title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"}},"required":["code","detail"],"title":"ServiceUnavailableResponse","type":"object"}]}}},"description":"Feature disabled or service temporarily unavailable; try again later","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} voice_bindings Binds a person in a reference image to an audio asset to set that person's voice. Each person image can be bound to at most one audio asset; for unbound people, describe the voice in the prompt. resolution Video resolution. minmax-h3-flash and minmax-h3-pro accept 768p or 2k (2k output is automatically enhanced). For other models, use the resolutions returned by GET /v1/video/config. model Model ID. For image and video models, use the corresponding settings endpoint for current availability, resolutions and rates. Speech synthesis and audio composition accept indextts-2 (default) or indextts-2.5. mode Generation mode. Video supports t2va, fl2va and ref2va; images support text-to-image and image-to-image. The modes each model supports are given by the corresponding settings endpoint. duration Video duration in seconds. The minimum and maximum for the selected model are given in models[] from GET /v1/video/config. ratio Video aspect ratio. Some models require adaptive for first/last-frame requests; follow the selected model's settings. seed Optional deterministic seed from 0 to 2147483647. Omit it when the selected model does not support seeds. references Video reference media. kind is image, video or audio, and role is reference, first or last. First/last-frame mode uses at most one first-frame image and one last-frame image. quote_id Quote ID returned by POST /v1/video/quote, bound to the model, media, duration and other parameters of the quoted request. Get a new quote whenever the request changes. quote_version The rate_version from the quote response. If the rate has changed, the submission is rejected and a new quote is required. style_preset Style preset. Only send a value from style_presets returned for the selected model by GET /v1/video/config. ```curl curl -X POST 'https://shixux.com/api/v1/video/generate' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"model":"seedance-2.5-flash","mode":"t2va","prompt":"A lighthouse by the sea, a slow camera move, waves and wind.","duration":5,"ratio":"16:9","resolution":"720p","seed":42,"references":[],"quote_id":"quote_xxx","quote_version":1}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/video/generate", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "your-unique-business-action-id" }, body: JSON.stringify({ "model": "seedance-2.5-flash", "mode": "t2va", "prompt": "A lighthouse by the sea, a slow camera move, waves and wind.", "duration": 5, "ratio": "16:9", "resolution": "720p", "seed": 42, "references": [], "quote_id": "quote_xxx", "quote_version": 1 }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/video/generate", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json","Idempotency-Key":"your-unique-business-action-id"}, data="{\"model\":\"seedance-2.5-flash\",\"mode\":\"t2va\",\"prompt\":\"A lighthouse by the sea, a slow camera move, waves and wind.\",\"duration\":5,\"ratio\":\"16:9\",\"resolution\":\"720p\",\"seed\":42,\"references\":[],\"quote_id\":\"quote_xxx\",\"quote_version\":1}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/video/generate", strings.NewReader("{\"model\":\"seedance-2.5-flash\",\"mode\":\"t2va\",\"prompt\":\"A lighthouse by the sea, a slow camera move, waves and wind.\",\"duration\":5,\"ratio\":\"16:9\",\"resolution\":\"720p\",\"seed\":42,\"references\":[],\"quote_id\":\"quote_xxx\",\"quote_version\":1}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", "your-unique-business-action-id") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 创建视频任务 URL: https://docs.shixux.com/zh/video/api/generate/ 创建视频生成任务。提交前先读取视频生成配置并调用视频报价,将报价返回的 quote_id 和 rate_version 分别作为 quote_id 和 quote_version 传入。模式、时长、画幅、清晰度和参考素材数量须符合所选模型的配置。 POST /v1/video/generate {"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","description":"生成模式。t2va 为文生视频,fl2va 使用首帧和尾帧,ref2va 使用多模态参考素材。","enum":["t2va","fl2va","ref2va"]},"prompt":{"type":"string","description":"视频提示词。可使用请求中已登记的 Picture、Video 和 Audio 引用标记。","minLength":1,"maxLength":20000},"duration":{"type":"integer","description":"输出时长,具体范围由 GET /v1/video/config 返回的模型能力决定。","minimum":1,"maximum":30,"default":5},"ratio":{"type":"string","description":"输出画幅。部分模型的首尾帧请求必须使用 adaptive,以 GET /v1/video/config 为准。","enum":["16:9","9:16","1:1","4:3","3:4","21:9","adaptive"]},"seed":{"type":"integer","description":"可选的非负随机种子,用于需要稳定结果的请求。","minimum":0,"maximum":2147483647},"references":{"type":"array","description":"有序参考素材。kind 为 image、video 或 audio,role 为 reference、first 或 last。","maxItems":50,"items":{"type":"object","properties":{"asset_id":{"description":"当前账号拥有且已完成上传的素材 ID。","type":"string"},"kind":{"description":"素材类型。image、video 或 audio。","type":"string","enum":["image","video","audio"]},"role":{"description":"素材用途。reference 为普通参考,first 和 last 仅用于首尾帧模式。","type":"string","enum":["reference","first","last"]}},"required":["asset_id","kind","role"]}},"resolution":{"type":"string","description":"输出清晰度。模型支持的实际选项以 GET /v1/video/config 返回为准。","enum":["768p","2k","480p","720p","1080p","4k"],"default":"768p","title":"Resolution"},"model":{"type":"string","description":"视频模型 ID。省略时使用默认模型。提交前应先读取 GET /v1/video/config 并报价。","enum":["minmax-h3-flash","minmax-h3-pro","wan3.0-video","seedance-2.0","seedance-2.5","seedance-2.5-flash","kling-4.0","seedance-2.0-mini","seedance-2.0-fast"]},"quote_version":{"type":"integer","description":"报价配置版本。必须与 POST /v1/video/quote 返回的版本一致。","minimum":1},"style_preset":{"type":"string","description":"风格预设,仅可传入 GET /v1/video/config 为所选模型返回的 style_presets 中的值;没有可用预设时省略。"},"voice_bindings":{"type":"array","description":"将图片素材与声音素材绑定,用于指定角色的画面和声音。","maxItems":30,"items":{"type":"object","properties":{"image_asset_id":{"type":"string","format":"uuid"},"audio_asset_id":{"type":"string","format":"uuid"}},"required":["image_asset_id","audio_asset_id"]}},"generate_audio":{"type":"boolean","description":"Whether to generate audio with the video, for models whose supports_generate_audio is true. Defaults to true."},"quote_id":{"type":"string","description":"POST /v1/video/quote 返回的报价 ID,绑定本次模型、素材、提示词、时长和清晰度。"}},"required":["mode","prompt","duration","ratio","references","resolution"]}}}},"parameters":[{"in":"header","name":"Idempotency-Key","schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}}],"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"estimate_detail":{"additionalProperties":true,"title":"Estimate Detail","type":"object"},"id":{"title":"Id","type":"string"},"reserved_credits":{"title":"Reserved Credits","type":"number"},"status":{"enum":["queued","processing","succeeded","failed","cancelled"],"title":"JobStatus","type":"string"},"type":{"enum":["tts","avatar","video","video_analysis","image","voice_design","audio_composition"],"title":"JobType","type":"string"}},"required":["id","type","status","reserved_credits","estimate_detail"],"title":"JobAcceptedResponse","type":"object"}}},"description":"Successful Response"},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"Idempotency-Key was already used for a different request (IDEMPOTENCY_CONFLICT).","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Reference asset expired; upload the reference again.","content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"},{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}]}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}},"429":{"description":"Concurrent job limit (MAX_CONCURRENT_JOBS) or request rate limit (RATE_LIMITED) reached.","headers":{"X-Request-ID":{"description":"Request ID. Include it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"503":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"},{"properties":{"code":{"title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"}},"required":["code","detail"],"title":"ServiceUnavailableResponse","type":"object"}]}}},"description":"Feature disabled or service temporarily unavailable; try again later","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} voice_bindings 将参考图片中的人物与音频素材绑定,指定该人物的声音。每张人物图片最多绑定一个音频素材;未绑定的人物由提示词描述其声音。 resolution 视频清晰度。minmax-h3-flash 和 minmax-h3-pro 支持 768p 和 2k(2k 输出会自动增强画质);其他模型的可用清晰度以 GET /v1/video/config 的返回为准。 model 模型 ID。图片和视频模型的可用状态、清晰度和费率以对应配置接口的返回为准;语音合成和音频编排可选 indextts-2(默认)或 indextts-2.5。 mode 生成模式。视频支持 t2va、fl2va、ref2va;图片支持 text-to-image 和 image-to-image。各模型支持的模式以对应配置接口为准。 duration 视频时长(秒)。所选模型的最短和最长时长见 GET /v1/video/config 返回的 models[]。 ratio 视频画幅。部分模型的首尾帧请求必须使用 adaptive,以所选模型的配置为准。 seed 可选的确定性种子,范围 0–2147483647;模型不支持时不要传入。 references 视频参考素材列表。kind 为 image、video 或 audio,role 为 reference、first 或 last;首尾帧模式最多使用一张首帧图片和一张尾帧图片。 quote_id POST /v1/video/quote 返回的报价 ID,绑定报价时的模型、素材、时长等请求参数。请求参数变化后须重新报价。 quote_version 报价响应中的 rate_version。费率变化后提交会被拒绝,需重新报价。 style_preset 风格预设。仅可传入 GET /v1/video/config 为所选模型返回的 style_presets 中的值。 ```curl curl -X POST 'https://shixux.com/api/v1/video/generate' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"model":"seedance-2.5-flash","mode":"t2va","prompt":"A lighthouse by the sea, a slow camera move, waves and wind.","duration":5,"ratio":"16:9","resolution":"720p","seed":42,"references":[],"quote_id":"quote_xxx","quote_version":1}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/video/generate", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "your-unique-business-action-id" }, body: JSON.stringify({ "model": "seedance-2.5-flash", "mode": "t2va", "prompt": "A lighthouse by the sea, a slow camera move, waves and wind.", "duration": 5, "ratio": "16:9", "resolution": "720p", "seed": 42, "references": [], "quote_id": "quote_xxx", "quote_version": 1 }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/video/generate", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json","Idempotency-Key":"your-unique-business-action-id"}, data="{\"model\":\"seedance-2.5-flash\",\"mode\":\"t2va\",\"prompt\":\"A lighthouse by the sea, a slow camera move, waves and wind.\",\"duration\":5,\"ratio\":\"16:9\",\"resolution\":\"720p\",\"seed\":42,\"references\":[],\"quote_id\":\"quote_xxx\",\"quote_version\":1}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/video/generate", strings.NewReader("{\"model\":\"seedance-2.5-flash\",\"mode\":\"t2va\",\"prompt\":\"A lighthouse by the sea, a slow camera move, waves and wind.\",\"duration\":5,\"ratio\":\"16:9\",\"resolution\":\"720p\",\"seed\":42,\"references\":[],\"quote_id\":\"quote_xxx\",\"quote_version\":1}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", "your-unique-business-action-id") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Get a video quote URL: https://docs.shixux.com/en/video/api/quote/ Get the credits required and the rate version for a model, mode, references, resolution and duration. Quoting does not create a job or reserve credits. When generating, pass the returned quote_id and rate_version as quote_id and quote_version; get a new quote whenever the request or its references change. POST /v1/video/quote {"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"estimated_reference_seconds":{"type":"number","minimum":0,"maximum":30,"description":"Optional estimate of the reference media length, for an early cost estimate. A quote that uses this field has no quote_id and cannot be used to submit a generation."},"operation":{"type":"string","enum":["generate"]},"request":{"type":"object","properties":{"mode":{"type":"string","description":"生成模式。t2va 为文生视频,fl2va 使用首帧和尾帧,ref2va 使用多模态参考素材。","enum":["t2va","fl2va","ref2va"]},"prompt":{"type":"string","description":"视频提示词。可使用请求中已登记的 Picture、Video 和 Audio 引用标记。","minLength":1,"maxLength":20000},"duration":{"type":"integer","description":"输出时长,具体范围由 GET /v1/video/config 返回的模型能力决定。","minimum":1,"maximum":30,"default":5},"ratio":{"type":"string","description":"输出画幅。部分模型的首尾帧请求必须使用 adaptive,以 GET /v1/video/config 为准。","enum":["16:9","9:16","1:1","4:3","3:4","21:9","adaptive"]},"seed":{"type":"integer","description":"可选的非负随机种子,用于需要稳定结果的请求。","minimum":0,"maximum":2147483647},"references":{"type":"array","description":"有序参考素材。kind 为 image、video 或 audio,role 为 reference、first 或 last。","maxItems":50,"items":{"type":"object","properties":{"asset_id":{"description":"当前账号拥有且已完成上传的素材 ID。","type":"string"},"kind":{"description":"素材类型。image、video 或 audio。","type":"string","enum":["image","video","audio"]},"role":{"description":"素材用途。reference 为普通参考,first 和 last 仅用于首尾帧模式。","type":"string","enum":["reference","first","last"]}},"required":["asset_id","kind","role"]}},"resolution":{"type":"string","description":"输出清晰度。模型支持的实际选项以 GET /v1/video/config 返回为准。","enum":["768p","2k","480p","720p","1080p","4k"],"default":"768p","title":"Resolution"},"model":{"type":"string","description":"视频模型 ID。省略时使用默认模型。提交前应先读取 GET /v1/video/config 并报价。","enum":["minmax-h3-flash","minmax-h3-pro","wan3.0-video","seedance-2.0","seedance-2.5","seedance-2.5-flash","kling-4.0","seedance-2.0-mini","seedance-2.0-fast"]},"quote_version":{"type":"integer","description":"报价配置版本。必须与 POST /v1/video/quote 返回的版本一致。","minimum":1},"style_preset":{"type":"string","description":"风格预设,仅可传入 GET /v1/video/config 为所选模型返回的 style_presets 中的值;没有可用预设时省略。"},"voice_bindings":{"type":"array","description":"将图片素材与声音素材绑定,用于指定角色的画面和声音。","maxItems":30,"items":{"type":"object","properties":{"image_asset_id":{"type":"string","format":"uuid"},"audio_asset_id":{"type":"string","format":"uuid"}},"required":["image_asset_id","audio_asset_id"]}},"generate_audio":{"type":"boolean","description":"Whether to generate audio with the video, for models whose supports_generate_audio is true. Defaults to true."},"quote_id":{"type":"string","description":"POST /v1/video/quote 返回的报价 ID,绑定本次模型、素材、提示词、时长和清晰度。"}},"required":["mode","prompt","duration","ratio","references","resolution"]}},"required":["operation","request"]}}}},"parameters":[],"responses":{"200":{"description":"Video quote","content":{"application/json":{"schema":{"type":"object","properties":{"estimated_tokens":{"type":"integer","description":"Estimated total billable video tokens for a token-priced model."},"credits_per_million_tokens":{"type":"number","description":"The token rate selected for this request, in credits per million tokens."},"model":{"type":"string"},"resolution":{"type":"string"},"billable_seconds":{"type":"number"},"credits_per_second":{"type":"number"},"credits":{"type":"number"},"rate_version":{"type":"integer"},"quote_id":{"type":"string"},"input_video_seconds":{"type":"number"},"output_credits":{"type":"number"},"input_video_credits":{"type":"number"}},"required":["model","resolution","billable_seconds","credits_per_second","credits","rate_version"]}}}},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"Idempotency-Key was already used for a different request (IDEMPOTENCY_CONFLICT).","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Reference asset expired; upload the reference again.","content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"},{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}]}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}},"503":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"},{"properties":{"code":{"title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"}},"required":["code","detail"],"title":"ServiceUnavailableResponse","type":"object"}]}}},"description":"Feature disabled or service temporarily unavailable; try again later","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} voice_bindings Binds a person in a reference image to an audio asset to set that person's voice. Each person image can be bound to at most one audio asset; for unbound people, describe the voice in the prompt. resolution Video resolution. minmax-h3-flash and minmax-h3-pro accept 768p or 2k (2k output is automatically enhanced). For other models, use the resolutions returned by GET /v1/video/config. model Model ID. For image and video models, use the corresponding settings endpoint for current availability, resolutions and rates. Speech synthesis and audio composition accept indextts-2 (default) or indextts-2.5. mode Generation mode. Video supports t2va, fl2va and ref2va; images support text-to-image and image-to-image. The modes each model supports are given by the corresponding settings endpoint. duration Video duration in seconds. The minimum and maximum for the selected model are given in models[] from GET /v1/video/config. ratio Video aspect ratio. Some models require adaptive for first/last-frame requests; follow the selected model's settings. seed Optional deterministic seed from 0 to 2147483647. Omit it when the selected model does not support seeds. references Video reference media. kind is image, video or audio, and role is reference, first or last. First/last-frame mode uses at most one first-frame image and one last-frame image. quote_id Quote ID returned by POST /v1/video/quote, bound to the model, media, duration and other parameters of the quoted request. Get a new quote whenever the request changes. quote_version The rate_version from the quote response. If the rate has changed, the submission is rejected and a new quote is required. style_preset Style preset. Only send a value from style_presets returned for the selected model by GET /v1/video/config. rate_version Rate version. For image generation, send billing.version from the settings endpoint. If the rate has changed, the submission is rejected; read the settings or quote again. ```curl curl -X POST 'https://shixux.com/api/v1/video/quote' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"operation":"generate","request":{"model":"seedance-2.5-flash","mode":"t2va","prompt":"A lighthouse by the sea, a slow camera move.","duration":5,"ratio":"16:9","resolution":"720p","seed":42,"references":[]}}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/video/quote", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json" }, body: JSON.stringify({ "operation": "generate", "request": { "model": "seedance-2.5-flash", "mode": "t2va", "prompt": "A lighthouse by the sea, a slow camera move.", "duration": 5, "ratio": "16:9", "resolution": "720p", "seed": 42, "references": [] } }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/video/quote", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json"}, data="{\"operation\":\"generate\",\"request\":{\"model\":\"seedance-2.5-flash\",\"mode\":\"t2va\",\"prompt\":\"A lighthouse by the sea, a slow camera move.\",\"duration\":5,\"ratio\":\"16:9\",\"resolution\":\"720p\",\"seed\":42,\"references\":[]}}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/video/quote", strings.NewReader("{\"operation\":\"generate\",\"request\":{\"model\":\"seedance-2.5-flash\",\"mode\":\"t2va\",\"prompt\":\"A lighthouse by the sea, a slow camera move.\",\"duration\":5,\"ratio\":\"16:9\",\"resolution\":\"720p\",\"seed\":42,\"references\":[]}}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # 查询视频报价 URL: https://docs.shixux.com/zh/video/api/quote/ 按模型、模式、参考素材、清晰度和时长查询所需积分及费率版本。报价不会创建任务或预扣积分。生成时将返回的 quote_id 和 rate_version 分别作为 quote_id 和 quote_version 传入;请求参数或参考素材变化后需重新报价。 POST /v1/video/quote {"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"estimated_reference_seconds":{"type":"number","minimum":0,"maximum":30,"description":"Optional estimate of the reference media length, for an early cost estimate. A quote that uses this field has no quote_id and cannot be used to submit a generation."},"operation":{"type":"string","enum":["generate"]},"request":{"type":"object","properties":{"mode":{"type":"string","description":"生成模式。t2va 为文生视频,fl2va 使用首帧和尾帧,ref2va 使用多模态参考素材。","enum":["t2va","fl2va","ref2va"]},"prompt":{"type":"string","description":"视频提示词。可使用请求中已登记的 Picture、Video 和 Audio 引用标记。","minLength":1,"maxLength":20000},"duration":{"type":"integer","description":"输出时长,具体范围由 GET /v1/video/config 返回的模型能力决定。","minimum":1,"maximum":30,"default":5},"ratio":{"type":"string","description":"输出画幅。部分模型的首尾帧请求必须使用 adaptive,以 GET /v1/video/config 为准。","enum":["16:9","9:16","1:1","4:3","3:4","21:9","adaptive"]},"seed":{"type":"integer","description":"可选的非负随机种子,用于需要稳定结果的请求。","minimum":0,"maximum":2147483647},"references":{"type":"array","description":"有序参考素材。kind 为 image、video 或 audio,role 为 reference、first 或 last。","maxItems":50,"items":{"type":"object","properties":{"asset_id":{"description":"当前账号拥有且已完成上传的素材 ID。","type":"string"},"kind":{"description":"素材类型。image、video 或 audio。","type":"string","enum":["image","video","audio"]},"role":{"description":"素材用途。reference 为普通参考,first 和 last 仅用于首尾帧模式。","type":"string","enum":["reference","first","last"]}},"required":["asset_id","kind","role"]}},"resolution":{"type":"string","description":"输出清晰度。模型支持的实际选项以 GET /v1/video/config 返回为准。","enum":["768p","2k","480p","720p","1080p","4k"],"default":"768p","title":"Resolution"},"model":{"type":"string","description":"视频模型 ID。省略时使用默认模型。提交前应先读取 GET /v1/video/config 并报价。","enum":["minmax-h3-flash","minmax-h3-pro","wan3.0-video","seedance-2.0","seedance-2.5","seedance-2.5-flash","kling-4.0","seedance-2.0-mini","seedance-2.0-fast"]},"quote_version":{"type":"integer","description":"报价配置版本。必须与 POST /v1/video/quote 返回的版本一致。","minimum":1},"style_preset":{"type":"string","description":"风格预设,仅可传入 GET /v1/video/config 为所选模型返回的 style_presets 中的值;没有可用预设时省略。"},"voice_bindings":{"type":"array","description":"将图片素材与声音素材绑定,用于指定角色的画面和声音。","maxItems":30,"items":{"type":"object","properties":{"image_asset_id":{"type":"string","format":"uuid"},"audio_asset_id":{"type":"string","format":"uuid"}},"required":["image_asset_id","audio_asset_id"]}},"generate_audio":{"type":"boolean","description":"Whether to generate audio with the video, for models whose supports_generate_audio is true. Defaults to true."},"quote_id":{"type":"string","description":"POST /v1/video/quote 返回的报价 ID,绑定本次模型、素材、提示词、时长和清晰度。"}},"required":["mode","prompt","duration","ratio","references","resolution"]}},"required":["operation","request"]}}}},"parameters":[],"responses":{"200":{"description":"Video quote","content":{"application/json":{"schema":{"type":"object","properties":{"estimated_tokens":{"type":"integer","description":"Estimated total billable video tokens for a token-priced model."},"credits_per_million_tokens":{"type":"number","description":"The token rate selected for this request, in credits per million tokens."},"model":{"type":"string"},"resolution":{"type":"string"},"billable_seconds":{"type":"number"},"credits_per_second":{"type":"number"},"credits":{"type":"number"},"rate_version":{"type":"integer"},"quote_id":{"type":"string"},"input_video_seconds":{"type":"number"},"output_credits":{"type":"number"},"input_video_credits":{"type":"number"}},"required":["model","resolution","billable_seconds","credits_per_second","credits","rate_version"]}}}},"401":{"description":"Authentication required.","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"409":{"description":"Idempotency-Key was already used for a different request (IDEMPOTENCY_CONFLICT).","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}},"content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"410":{"description":"Reference asset expired; upload the reference again.","content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}}}},"422":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"},"code":{"type":"string","const":"VALIDATION_ERROR"}},"title":"HTTPValidationError","type":"object"},{"type":"object","required":["detail"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code. Clients translate this code for display."},"detail":{"type":"string","description":"Diagnostic description; user interfaces should display a localized message using the code and request context."},"reference_audio_duration":{"type":"object","description":"Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.","required":["seconds","max_seconds"],"properties":{"seconds":{"type":"number"},"min_seconds":{"type":"integer"},"max_seconds":{"type":"integer"}}},"quota":{"type":"object","description":"The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.","required":["kind","limit","used","requested"],"properties":{"kind":{"type":"string","enum":["rate","daily_bytes"]},"limit":{"type":"integer","format":"int64","minimum":1},"used":{"type":"integer","format":"int64","minimum":0},"requested":{"type":"integer","format":"int64","minimum":1},"retry_at":{"type":"string","format":"date-time","description":"Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance."}}}}}]}}},"description":"Validation Error","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}},"503":{"content":{"application/json":{"schema":{"anyOf":[{"properties":{"code":{"const":"feature_disabled","title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"},"feature":{"title":"Feature","type":"string"}},"required":["detail","code","feature"],"title":"FeatureDisabledResponse","type":"object"},{"properties":{"code":{"title":"Code","type":"string"},"detail":{"title":"Detail","type":"string"}},"required":["code","detail"],"title":"ServiceUnavailableResponse","type":"object"}]}}},"description":"Feature disabled or service temporarily unavailable; try again later","headers":{"X-Request-ID":{"schema":{"type":"string"},"description":"Request ID. Include it when contacting support."}}}}} voice_bindings 将参考图片中的人物与音频素材绑定,指定该人物的声音。每张人物图片最多绑定一个音频素材;未绑定的人物由提示词描述其声音。 resolution 视频清晰度。minmax-h3-flash 和 minmax-h3-pro 支持 768p 和 2k(2k 输出会自动增强画质);其他模型的可用清晰度以 GET /v1/video/config 的返回为准。 model 模型 ID。图片和视频模型的可用状态、清晰度和费率以对应配置接口的返回为准;语音合成和音频编排可选 indextts-2(默认)或 indextts-2.5。 mode 生成模式。视频支持 t2va、fl2va、ref2va;图片支持 text-to-image 和 image-to-image。各模型支持的模式以对应配置接口为准。 duration 视频时长(秒)。所选模型的最短和最长时长见 GET /v1/video/config 返回的 models[]。 ratio 视频画幅。部分模型的首尾帧请求必须使用 adaptive,以所选模型的配置为准。 seed 可选的确定性种子,范围 0–2147483647;模型不支持时不要传入。 references 视频参考素材列表。kind 为 image、video 或 audio,role 为 reference、first 或 last;首尾帧模式最多使用一张首帧图片和一张尾帧图片。 quote_id POST /v1/video/quote 返回的报价 ID,绑定报价时的模型、素材、时长等请求参数。请求参数变化后须重新报价。 quote_version 报价响应中的 rate_version。费率变化后提交会被拒绝,需重新报价。 style_preset 风格预设。仅可传入 GET /v1/video/config 为所选模型返回的 style_presets 中的值。 rate_version 费率版本。图片生成传入配置接口返回的 billing.version;费率变化后提交会被拒绝,需重新读取配置或报价。 ```curl curl -X POST 'https://shixux.com/api/v1/video/quote' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"operation":"generate","request":{"model":"seedance-2.5-flash","mode":"t2va","prompt":"A lighthouse by the sea, a slow camera move.","duration":5,"ratio":"16:9","resolution":"720p","seed":42,"references":[]}}' ``` ```javascript const response = await fetch("https://shixux.com/api/v1/video/quote", { method: "POST", headers: { "X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json" }, body: JSON.stringify({ "operation": "generate", "request": { "model": "seedance-2.5-flash", "mode": "t2va", "prompt": "A lighthouse by the sea, a slow camera move.", "duration": 5, "ratio": "16:9", "resolution": "720p", "seed": 42, "references": [] } }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.text()); ``` ```python import json import urllib.request request = urllib.request.Request( "https://shixux.com/api/v1/video/quote", method="POST", headers={"X-API-Key":"yb_xxx_yyy","Content-Type":"application/json"}, data="{\"operation\":\"generate\",\"request\":{\"model\":\"seedance-2.5-flash\",\"mode\":\"t2va\",\"prompt\":\"A lighthouse by the sea, a slow camera move.\",\"duration\":5,\"ratio\":\"16:9\",\"resolution\":\"720p\",\"seed\":42,\"references\":[]}}".encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, err := http.NewRequest("POST", "https://shixux.com/api/v1/video/quote", strings.NewReader("{\"operation\":\"generate\",\"request\":{\"model\":\"seedance-2.5-flash\",\"mode\":\"t2va\",\"prompt\":\"A lighthouse by the sea, a slow camera move.\",\"duration\":5,\"ratio\":\"16:9\",\"resolution\":\"720p\",\"seed\":42,\"references\":[]}}")) if err != nil { panic(err) } req.Header.Set("X-API-Key", "yb_xxx_yyy") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(body)) } fmt.Println(string(body)) } ``` --- # Video guide URL: https://docs.shixux.com/en/video/guide/ ## Integration steps 1. Call [Get video generation settings](https://docs.shixux.com/en/video/api/config/) (no authentication required) to confirm the model is available and read its supported modes, durations, aspect ratios, resolutions and reference limits. 2. Call [Get a video quote](https://docs.shixux.com/en/video/api/quote/) for the credits required, `quote_id` and `rate_version`. 3. Call [Create a video](https://docs.shixux.com/en/video/api/generate/) with the same request parameters as the quote, plus `quote_id` and `quote_version`. 4. Learn when the job ends through [Retrieve a job](https://docs.shixux.com/en/common/api/jobs/retrieve/) or a [webhook](https://docs.shixux.com/en/common/webhooks/), then fetch the result. See [Video model overview](https://docs.shixux.com/en/video/) for a comparison of the models. In the settings response, `models[].available` tells you whether a model can be submitted now, and `available_resolutions` lists the resolutions you can submit. ## Minimal request parameters All models use the same quote and generation endpoints. A minimal text-to-video (`t2va`) request only changes `model` and `resolution` per model: | Model | Minimal request parameters | | --- | --- | | `minmax-h3-flash` | `mode=t2va, duration=5, ratio=16:9, resolution=768p, references=[]` | | `minmax-h3-pro` | `mode=t2va, duration=5, ratio=16:9, resolution=768p, references=[]` | | `wan3.0-video` | `mode=t2va, duration=5, ratio=16:9, resolution=720p, references=[]` | | `seedance-2.0` | `mode=t2va, duration=5, ratio=16:9, resolution=720p, references=[]` | | `seedance-2.0-mini` | `mode=t2va, duration=5, ratio=16:9, resolution=720p, references=[]` | | `seedance-2.0-fast` | `mode=t2va, duration=5, ratio=16:9, resolution=720p, references=[]` | | `seedance-2.5` | `mode=t2va, duration=5, ratio=16:9, resolution=720p, references=[]` | | `seedance-2.5-flash` | `mode=t2va, duration=5, ratio=16:9, resolution=720p, references=[]` | ## Get a quote The `request` field of a quote request takes the same parameters as the generation request. Quoting does not create a job or reserve credits. ```bash curl -X POST 'https://shixux.com/api/v1/video/quote' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"operation":"generate","request":{"model":"seedance-2.5","mode":"t2va","prompt":"A lighthouse by the sea with a slow push-in","duration":5,"ratio":"16:9","resolution":"720p","references":[]}}' ``` A successful response contains `quote_id`, `rate_version`, the billable duration `billable_seconds` and the credits required `credits`. The quote is bound to the model, mode, aspect ratio, duration, resolution, prompt and references; if any of them changes, get a new quote. ## Submit the generation Submit with the same parameters as the quote. Pass the quote's `quote_id` and `rate_version` as `quote_id` and `quote_version`, and send a unique `Idempotency-Key`. ```bash curl -X POST 'https://shixux.com/api/v1/video/generate' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: video-001' \ -d '{"model":"seedance-2.5","mode":"t2va","prompt":"A lighthouse by the sea with a slow push-in","duration":5,"ratio":"16:9","resolution":"720p","references":[],"quote_id":"quote_xxx","quote_version":1,"generate_audio":true}' ``` ```python import json import urllib.request body = { "model": "seedance-2.5", "mode": "t2va", "prompt": "A lighthouse by the sea with a slow push-in", "duration": 5, "ratio": "16:9", "resolution": "720p", "references": [], "quote_id": "quote_xxx", "quote_version": 1, } request = urllib.request.Request( "https://shixux.com/api/v1/video/generate", method="POST", headers={"X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "video-001"}, data=json.dumps(body).encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```js const response = await fetch("https://shixux.com/api/v1/video/generate", { method: "POST", headers: { "X-API-Key": process.env.YB_API_KEY, "Content-Type": "application/json", "Idempotency-Key": "video-001", }, body: JSON.stringify({ model: "seedance-2.5", mode: "t2va", prompt: "A lighthouse by the sea with a slow push-in", duration: 5, ratio: "16:9", resolution: "720p", references: [], quote_id: "quote_xxx", quote_version: 1, }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.json()); ``` If the rate changes after the quote, the submission returns `409 VIDEO_RATE_CONFLICT`. Get a new quote before submitting again. ## Generation modes and references | Mode | References | | --- | --- | | `t2va` | No references; `references` is an empty array | | `fl2va` | One first-frame image with `role: "first"`, optionally one last-frame image with `role: "last"` | | `ref2va` | Images, videos or audio with `role: "reference"`, within the selected model's limits | Each item in `references` contains the asset ID `asset_id`, the type `kind` (`image`, `video` or `audio`) and the role `role` (`reference`, `first` or `last`). References must belong to your account and be confirmed uploads, uploaded with `purpose` set to `video_image` (images), `video_clip` (videos) or `video_audio` (audio). See [Uploads](https://docs.shixux.com/en/common/uploads/). - `ratio: "adaptive"` applies only to models that support adaptive aspect ratios. Some models require `adaptive` for first/last-frame requests; see [Video model overview](https://docs.shixux.com/en/video/). - Reference markers in the prompt must correspond to media actually provided in `references`. - `voice_bindings` binds a person in a reference image to an audio asset to set that person's voice. Each person image can be bound to at most one audio asset. ## Jobs, results and stopping Video job states are `queued`, `processing`, `succeeded`, `failed` and `cancelled`. After success, call [Retrieve a job result](https://docs.shixux.com/en/common/api/jobs/result/) for the download URL, and call it again after the URL expires. `retained_until` gives how long the result file is retained. Call [Stop a generation job](https://docs.shixux.com/en/video/api/cancel/) to stop a job. If the job is stopped before generation starts, the reserved credits are refunded in full; if generation has already started, the reserved credits are not refunded. Pass `queued_only=true` to stop the job only while it is still queued, so that a job that has already started is not stopped by mistake. For more rules, see [Error handling](https://docs.shixux.com/en/operations/errors/), [Webhooks](https://docs.shixux.com/en/common/webhooks/), [Uploads](https://docs.shixux.com/en/common/uploads/) and [Asynchronous jobs](https://docs.shixux.com/en/common/jobs/). --- # 视频接入指南 URL: https://docs.shixux.com/zh/video/guide/ ## 接入流程 1. 调用[查询视频生成配置](https://docs.shixux.com/zh/video/api/config/)(无需认证),确认所选模型可用,并读取其支持的模式、时长、画幅、清晰度和参考素材上限。 2. 调用[查询视频报价](https://docs.shixux.com/zh/video/api/quote/),获取所需积分、`quote_id` 和 `rate_version`。 3. 调用[创建视频任务](https://docs.shixux.com/zh/video/api/generate/),提交与报价相同的请求参数,并回填 `quote_id` 和 `quote_version`。 4. 通过[查询任务](https://docs.shixux.com/zh/common/api/jobs/retrieve/)或 [Webhook](https://docs.shixux.com/zh/common/webhooks/) 获知任务结束,成功后获取结果。 各模型的能力对比见[视频模型总览](https://docs.shixux.com/zh/video/)。配置响应中,`models[].available` 表示模型当前是否可提交,`available_resolutions` 为当前可提交的清晰度。 ## 最小请求参数 所有模型使用相同的报价和生成接口。文生视频(`t2va`)的最小请求只需按模型替换 `model` 和 `resolution`: | 模型 | 最小请求参数示例 | | --- | --- | | `minmax-h3-flash` | `mode=t2va, duration=5, ratio=16:9, resolution=768p, references=[]` | | `minmax-h3-pro` | `mode=t2va, duration=5, ratio=16:9, resolution=768p, references=[]` | | `wan3.0-video` | `mode=t2va, duration=5, ratio=16:9, resolution=720p, references=[]` | | `seedance-2.0` | `mode=t2va, duration=5, ratio=16:9, resolution=720p, references=[]` | | `seedance-2.0-mini` | `mode=t2va, duration=5, ratio=16:9, resolution=720p, references=[]` | | `seedance-2.0-fast` | `mode=t2va, duration=5, ratio=16:9, resolution=720p, references=[]` | | `seedance-2.5` | `mode=t2va, duration=5, ratio=16:9, resolution=720p, references=[]` | | `seedance-2.5-flash` | `mode=t2va, duration=5, ratio=16:9, resolution=720p, references=[]` | ## 报价 报价请求的 `request` 字段与生成请求的参数相同。报价不会创建任务,也不会预扣积分。 ```bash curl -X POST 'https://shixux.com/api/v1/video/quote' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"operation":"generate","request":{"model":"seedance-2.5","mode":"t2va","prompt":"海边灯塔,镜头缓慢向前移动","duration":5,"ratio":"16:9","resolution":"720p","references":[]}}' ``` 成功响应包含 `quote_id`、`rate_version`、计费时长 `billable_seconds` 和所需积分 `credits`。报价绑定模型、模式、画幅、时长、清晰度、提示词和参考素材;其中任何一项变化后,都需要重新报价。 ## 提交生成 使用与报价相同的参数提交,将报价返回的 `quote_id` 和 `rate_version` 分别作为 `quote_id` 和 `quote_version` 传入,并携带唯一的 `Idempotency-Key`。 ```bash curl -X POST 'https://shixux.com/api/v1/video/generate' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: video-001' \ -d '{"model":"seedance-2.5","mode":"t2va","prompt":"海边灯塔,镜头缓慢向前移动","duration":5,"ratio":"16:9","resolution":"720p","references":[],"quote_id":"quote_xxx","quote_version":1,"generate_audio":true}' ``` ```python import json import urllib.request body = { "model": "seedance-2.5", "mode": "t2va", "prompt": "海边灯塔,镜头缓慢向前移动", "duration": 5, "ratio": "16:9", "resolution": "720p", "references": [], "quote_id": "quote_xxx", "quote_version": 1, } request = urllib.request.Request( "https://shixux.com/api/v1/video/generate", method="POST", headers={"X-API-Key": "yb_xxx_yyy", "Content-Type": "application/json", "Idempotency-Key": "video-001"}, data=json.dumps(body).encode("utf-8"), ) with urllib.request.urlopen(request) as response: print(response.read().decode("utf-8")) ``` ```js const response = await fetch("https://shixux.com/api/v1/video/generate", { method: "POST", headers: { "X-API-Key": process.env.YB_API_KEY, "Content-Type": "application/json", "Idempotency-Key": "video-001", }, body: JSON.stringify({ model: "seedance-2.5", mode: "t2va", prompt: "海边灯塔,镜头缓慢向前移动", duration: 5, ratio: "16:9", resolution: "720p", references: [], quote_id: "quote_xxx", quote_version: 1, }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.json()); ``` 费率在报价后发生变化时,提交返回 `409 VIDEO_RATE_CONFLICT`,请重新报价后再提交。 ## 生成模式与参考素材 | 模式 | 参考素材 | | --- | --- | | `t2va` | 不使用参考素材,`references` 为空数组 | | `fl2va` | 一张 `role: "first"` 的首帧图片,可再加一张 `role: "last"` 的尾帧图片 | | `ref2va` | `role: "reference"` 的图片、视频或音频,数量不超过所选模型的上限 | `references` 中每一项包含素材 ID `asset_id`、类型 `kind`(`image`、`video` 或 `audio`)和用途 `role`(`reference`、`first` 或 `last`)。参考素材须属于当前账号并已确认上传,上传时的 `purpose` 分别为 `video_image`(图片)、`video_clip`(视频)和 `video_audio`(音频),见[素材上传](https://docs.shixux.com/zh/common/uploads/)。 - `ratio: "adaptive"` 仅适用于支持自适应画幅的模型;部分模型的首尾帧请求必须使用 `adaptive`,见[视频模型总览](https://docs.shixux.com/zh/video/)。 - 提示词中引用参考素材的标记,必须与 `references` 中实际提供的素材对应。 - `voice_bindings` 用于将参考图片中的人物与音频素材绑定,以指定该人物的声音。每张人物图片最多绑定一个音频素材。 ## 任务、结果与停止 视频任务的状态包括 `queued`、`processing`、`succeeded`、`failed` 和 `cancelled`。成功后调用[获取任务结果](https://docs.shixux.com/zh/common/api/jobs/result/)获取下载地址;地址过期后再次调用即可,`retained_until` 表示结果文件的保留期限。 调用[停止生成任务](https://docs.shixux.com/zh/video/api/cancel/)可以停止任务。任务开始生成前停止,预扣积分全部退回;已开始生成的任务被停止时,预扣积分不予退回。传入 `queued_only=true` 时,仅在任务仍在排队时停止,避免误停已开始生成的任务。 更多规则见[错误处理](https://docs.shixux.com/zh/operations/errors/)、[Webhook](https://docs.shixux.com/zh/common/webhooks/)、[素材上传](https://docs.shixux.com/zh/common/uploads/)和[异步任务](https://docs.shixux.com/zh/common/jobs/)。 --- # Video model overview URL: https://docs.shixux.com/en/video/ ## Available models The table lists the capabilities of each video model. Current availability, submittable resolutions and rates are returned by the [video generation settings](https://docs.shixux.com/en/video/api/config/) endpoint; see `models[].available`, `modes`, `ratios`, `available_resolutions` and the reference count fields. | Model ID | Generation modes | Duration | Resolutions | Reference limits (image / video / audio) | | --- | --- | --- | --- | --- | | `minmax-h3-flash` | `t2va`, `ref2va` | 1–15 s | 768p, 2k | 9 / 0 / 3 | | `minmax-h3-pro` | `t2va`, `fl2va`, `ref2va` | 4–15 s | 768p, 2k | 9 / 3 / 3 | | `wan3.0-video` | `t2va`, `fl2va`, `ref2va` | 2–30 s | 480p, 720p, 1080p | 10 / 5 / 5; each reference video 1–15 s, reference videos 30 s in total at most | | `seedance-2.0` | `t2va`, `fl2va`, `ref2va` | 4–15 s | 480p, 720p, 1080p, 4k | 9 / 3 / 3 | | `seedance-2.0-mini` | `t2va`, `fl2va`, `ref2va` | 4–15 s | 480p, 720p | 9 / 3 / 3 | | `seedance-2.0-fast` | `t2va`, `fl2va`, `ref2va` | 4–15 s | 480p, 720p | 9 / 3 / 3 | | `seedance-2.5` | `t2va`, `fl2va`, `ref2va` | 4–30 s | 480p, 720p, 1080p | 30 / 10 / 10 | | `seedance-2.5-flash` | `t2va`, `fl2va`, `ref2va` | 4–30 s | 480p, 720p | 10 / 5 / 5 | | `kling-4.0` | `t2va`, `fl2va`, `ref2va` | 3–30 s | 720p, 1080p | 10 / 5 / 0 | - **Generation modes.** `t2va` generates from a prompt. `fl2va` uses fixed frames in the combinations supported by the model. `ref2va` uses image, video or audio references. - **Aspect ratios.** `minmax-h3-flash` supports `16:9` and `9:16`. `minmax-h3-pro` supports `16:9`, `9:16`, `1:1`, `4:3`, `3:4` and `21:9`. the available video model and the available video model also accept `adaptive`. Kling 4.0 accepts `16:9`, `9:16`, `1:1`, `21:9` and `adaptive`. Use `adaptive` for fixed frames with `seedance-2.5`, `seedance-2.5-flash` and `kling-4.0`. - **Ending frame only.** With Kling 4.0, submit one image with `role: "last"` in `fl2va` mode. Fixed frames and ordinary media references use separate generation modes. - **Audio-only references**: `ref2va` requests to `wan3.0-video`, `seedance-2.5` and `seedance-2.5-flash` may provide audio references only. - **Prompt length.** The limit is 7,000 characters for `minmax-h3-pro`, 8,000 for `kling-4.0`, and 20,000 for the other models. - **Audio.** Video includes audio by default. Kling 4.0 always generates native audio. Omit `generate_audio` or set it to `true`. - **Cost**: billed by model and resolution; the [video quote](https://docs.shixux.com/en/video/api/quote/) endpoint gives the exact amount. When `model` is omitted, the default model is used. To keep results consistent, always specify the model ID explicitly. ## API reference [Get video generation settings](https://docs.shixux.com/en/video/api/config/) · [Get a video quote](https://docs.shixux.com/en/video/api/quote/) · [Create a video](https://docs.shixux.com/en/video/api/generate/) · [Stop a generation job](https://docs.shixux.com/en/video/api/cancel/). See the [video guide](https://docs.shixux.com/en/video/guide/) for the full integration flow and examples. --- # 视频模型总览 URL: https://docs.shixux.com/zh/video/ ## 可用模型 下表列出各视频模型的能力。模型当前是否可用、可提交的清晰度和费率以[视频生成配置](https://docs.shixux.com/zh/video/api/config/)接口的返回为准,参见其中的 `models[].available`、`modes`、`ratios`、`available_resolutions` 和素材数量字段。 | 模型 ID | 生成模式 | 时长 | 清晰度 | 参考素材上限(图片 / 视频 / 音频) | | --- | --- | --- | --- | --- | | `minmax-h3-flash` | `t2va`、`ref2va` | 1–15 秒 | 768p、2k | 9 / 0 / 3 | | `minmax-h3-pro` | `t2va`、`fl2va`、`ref2va` | 4–15 秒 | 768p、2k | 9 / 3 / 3 | | `wan3.0-video` | `t2va`、`fl2va`、`ref2va` | 2–30 秒 | 480p、720p、1080p | 10 / 5 / 5;单个参考视频 1–15 秒,参考视频合计最长 30 秒 | | `seedance-2.0` | `t2va`、`fl2va`、`ref2va` | 4–15 秒 | 480p、720p、1080p、4k | 9 / 3 / 3 | | `seedance-2.0-mini` | `t2va`、`fl2va`、`ref2va` | 4–15 秒 | 480p、720p | 9 / 3 / 3 | | `seedance-2.0-fast` | `t2va`、`fl2va`、`ref2va` | 4–15 秒 | 480p、720p | 9 / 3 / 3 | | `seedance-2.5` | `t2va`、`fl2va`、`ref2va` | 4–30 秒 | 480p、720p、1080p | 30 / 10 / 10 | | `seedance-2.5-flash` | `t2va`、`fl2va`、`ref2va` | 4–30 秒 | 480p、720p | 10 / 5 / 5 | | `kling-4.0` | `t2va`、`fl2va`、`ref2va` | 3–30 秒 | 720p、1080p | 10 / 5 / 0 | - **生成模式** `t2va` 使用提示词生成。`fl2va` 使用指定的起止帧生成,支持的组合依模型而定。`ref2va` 使用图片、视频或音频参考生成。 - **画幅**:`minmax-h3-flash` 支持 `16:9`、`9:16`。`minmax-h3-pro` 支持 `16:9`、`9:16`、`1:1`、`4:3`、`3:4`、`21:9`,万相与 the available video model 还支持 `adaptive`(自适应)。Kling 4.0 支持 `16:9`、`9:16`、`1:1`、`21:9` 及 `adaptive`。`seedance-2.5`、`seedance-2.5-flash` 和 `kling-4.0` 的固定帧请求使用 `adaptive`。 - **单独指定尾帧**:Kling 4.0 的 `fl2va` 支持只提交一张 `role: "last"` 的图片。固定帧与普通参考素材分别使用对应的生成模式。 - **仅音频参考**:`wan3.0-video`、`seedance-2.5` 和 `seedance-2.5-flash` 的 `ref2va` 请求可以只提供音频参考。 - **提示词长度** `minmax-h3-pro` 最多 7000 个字符,`kling-4.0` 最多 8000 个字符,其余模型最多 20000 个字符。 - **音频** 默认同时生成音频。Kling 4.0 始终生成原生音频,提交时省略 `generate_audio` 或设为 `true`。 - **费用**:按模型和清晰度计费,以[视频报价](https://docs.shixux.com/zh/video/api/quote/)接口的结果为准。 省略 `model` 时使用默认模型。为保证结果稳定,建议始终显式指定模型 ID。 ## 接口参考 [查询视频生成配置](https://docs.shixux.com/zh/video/api/config/) · [查询视频报价](https://docs.shixux.com/zh/video/api/quote/) · [创建视频任务](https://docs.shixux.com/zh/video/api/generate/) · [停止生成任务](https://docs.shixux.com/zh/video/api/cancel/)。完整的接入流程和示例见[视频接入指南](https://docs.shixux.com/zh/video/guide/)。 # Public contract { "openapi": "3.1.0", "info": { "description": "时序科技公开 API,提供异步语音合成、音频编排、音色设计、图片和视频生成,以及任务、素材上传和 Webhook 接口。文本模型通过 OpenAI 兼容接口提供。", "title": "时序科技 API", "version": "0.1.0" }, "servers": [ { "description": "API Base URL", "url": "/api" } ], "paths": { "/voice-presets": { "get": { "operationId": "list_voice_presets_voice_presets_get", "parameters": [ { "in": "query", "name": "search", "schema": { "maxLength": 100, "title": "Search", "type": "string" } }, { "in": "query", "name": "language", "schema": { "maxLength": 40, "title": "Language", "type": "string" } }, { "in": "query", "name": "limit", "schema": { "default": 100, "maximum": 500, "minimum": 1, "title": "Limit", "type": "integer" } }, { "in": "query", "name": "offset", "schema": { "default": 0, "minimum": 0, "title": "Offset", "type": "integer" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VoicePresetListResponse" } } }, "description": "Successful Response" }, "422": { "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } }, "503": { "description": "Voice preset catalog unavailable", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } } }, "summary": "List preset voices", "tags": [ "generation" ] } }, "/voice-presets/{preset_id}/playback": { "get": { "operationId": "voice_preset_playback_voice_presets_preset_id_playback_get", "parameters": [ { "in": "path", "name": "preset_id", "required": true, "schema": { "pattern": "^vp_[a-f0-9]{24}$", "title": "Preset Id", "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VoiceAssetPlaybackResponse" } } }, "description": "Successful Response" }, "404": { "description": "Voice preset not found", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "422": { "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } }, "503": { "description": "Voice preset audio temporarily unavailable", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } } }, "summary": "Get a preset voice preview", "tags": [ "generation" ] } }, "/voice-presets/{preset_id}/use": { "post": { "summary": "Use a preset voice", "description": "Return a voice asset for the preset voice in the current account. Generation requests can reference it through voice_asset_id. This does not create a generation job or charge credits.", "operationId": "voice_preset_use_on_canvas", "parameters": [ { "in": "path", "name": "preset_id", "required": true, "schema": { "type": "string", "pattern": "^vp_[a-f0-9]{24}$" } } ], "responses": { "200": { "description": "Voice sample ready for use", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VoiceAssetRecord" } } } }, "401": { "description": "Authentication required", "headers": {} }, "404": { "description": "Voice preset not found" }, "409": { "description": "Credentials do not match the account" }, "410": { "description": "Voice asset preparation expired; call this endpoint again" }, "422": { "description": "Invalid voice preset identifier" }, "503": { "description": "Service temporarily unavailable; try again later" } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "tags": [ "generation" ] } }, "/voice-presets/{preset_id}/icon": { "get": { "operationId": "get_voice_preset_icon", "parameters": [ { "in": "path", "name": "preset_id", "required": true, "schema": { "pattern": "^vp_[a-f0-9]{24}$", "type": "string" } } ], "responses": { "302": { "description": "Redirect to a 96px WebP thumbnail URL that is valid for 15 minutes", "headers": { "Location": { "description": "Temporary thumbnail URL", "schema": { "type": "string", "format": "uri" } }, "Cache-Control": { "schema": { "type": "string" } } } }, "404": { "description": "Voice preset icon not found", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "422": { "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } }, "503": { "description": "Voice preset icon temporarily unavailable", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } } }, "summary": "Get a preset voice icon", "tags": [ "generation" ] } }, "/voice-assets": { "get": { "operationId": "list_voice_assets_voice_assets_get", "parameters": [ { "in": "query", "name": "search", "schema": { "maxLength": 100, "title": "Search", "type": "string" } }, { "in": "query", "name": "limit", "schema": { "default": 18, "maximum": 100, "minimum": 1, "title": "Limit", "type": "integer" } }, { "in": "query", "name": "offset", "schema": { "default": 0, "minimum": 0, "title": "Offset", "type": "integer" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VoiceAssetListResponse" } } }, "description": "Successful Response" }, "422": { "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "HTTPBearer": [] } ], "summary": "List voice assets", "tags": [ "assets" ] } }, "/voice-assets/{asset_id}": { "get": { "operationId": "get_voice_asset_voice_assets_asset_id_get", "parameters": [ { "in": "path", "name": "asset_id", "required": true, "schema": { "title": "Asset Id", "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VoiceAssetRecord" } } }, "description": "Successful Response" }, "404": { "description": "Voice asset not found", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "410": { "description": "Voice asset expired", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } } }, "security": [ { "HTTPBearer": [] } ], "summary": "Get a voice asset", "tags": [ "assets" ] }, "patch": { "operationId": "rename_voice_asset_voice_assets_asset_id_patch", "parameters": [ { "in": "path", "name": "asset_id", "required": true, "schema": { "title": "Asset Id", "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RenameVoiceAssetRequest" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VoiceAssetRecord" } } }, "description": "Successful Response" }, "404": { "description": "Voice asset not found", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "410": { "description": "Voice asset expired", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "422": { "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "HTTPBearer": [] } ], "summary": "Rename a voice asset", "tags": [ "assets" ] }, "delete": { "operationId": "delete_voice_asset_voice_assets_asset_id_delete", "parameters": [ { "in": "path", "name": "asset_id", "required": true, "schema": { "title": "Asset Id", "type": "string" } } ], "responses": { "204": { "description": "Successful Response" }, "404": { "description": "Voice asset not found", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "409": { "description": "Voice asset is in use", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "410": { "description": "Voice asset expired", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } } }, "security": [ { "HTTPBearer": [] } ], "summary": "Delete a voice asset", "tags": [ "assets" ] } }, "/voice-assets/{asset_id}/playback": { "get": { "operationId": "voice_asset_playback_voice_assets_asset_id_playback_get", "parameters": [ { "in": "path", "name": "asset_id", "required": true, "schema": { "title": "Asset Id", "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VoiceAssetPlaybackResponse" } } }, "description": "Successful Response" }, "404": { "description": "Voice asset not found", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "410": { "description": "Voice asset expired", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } } }, "security": [ { "HTTPBearer": [] } ], "summary": "Get a voice asset preview", "tags": [ "assets" ] } }, "/capabilities": { "get": { "operationId": "get_capabilities_capabilities_get", "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CapabilitiesResponse" } } }, "description": "Successful Response" }, "503": { "content": { "application/json": { "schema": { "properties": { "detail": { "title": "Detail", "type": "string" } }, "required": [ "detail" ], "title": "ErrorDetail", "type": "object" } } }, "description": "Feature Configuration Unavailable", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "summary": "Get available capabilities", "tags": [ "capabilities" ] } }, "/keys": { "get": { "operationId": "list_keys_keys_get", "responses": { "200": { "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/ApiKeyResponse" }, "title": "Response List Keys Keys Get", "type": "array" } } }, "description": "Successful Response" } }, "security": [ { "HTTPBearer": [] } ], "summary": "List API Keys", "tags": [ "api-keys" ] }, "post": { "operationId": "create_key_keys_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateApiKeyRequest" } } }, "required": true }, "responses": { "201": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiKeyCreatedResponse" } } }, "description": "Successful Response" }, "422": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } }, "503": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FeatureDisabledResponse" } } }, "description": "Feature Temporarily Unavailable", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "security": [ { "HTTPBearer": [] } ], "summary": "Create an API Key", "tags": [ "api-keys" ] } }, "/keys/{key_id}": { "delete": { "operationId": "revoke_key_keys__key_id__delete", "parameters": [ { "in": "path", "name": "key_id", "required": true, "schema": { "title": "Key Id", "type": "string" } } ], "responses": { "204": { "description": "Successful Response" }, "422": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "security": [ { "HTTPBearer": [] } ], "summary": "Revoke an API Key", "tags": [ "api-keys" ] } }, "/v1/avatar": { "post": { "operationId": "create_avatar_v1_avatar_post", "parameters": [ { "in": "header", "name": "Idempotency-Key", "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Idempotency-Key" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AvatarRequest" } } }, "required": true }, "responses": { "202": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JobAcceptedResponse" } } }, "description": "Successful Response" }, "409": { "description": "Idempotency-Key was already used for a different request", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "422": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } }, "429": { "description": "Concurrent job limit (MAX_CONCURRENT_JOBS) or request rate limit (RATE_LIMITED) reached.", "headers": { "X-Request-ID": { "description": "Request ID. Include it when contacting support.", "schema": { "type": "string" } } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "503": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FeatureDisabledResponse" } } }, "description": "Feature Temporarily Unavailable", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] } ], "summary": "Create an asynchronous audio-driven avatar video", "description": "Submit an owned driving-audio asset reference to the avatar video service. Optionally provide a portrait image, prompt, resolution and segment count. The response contains a job ID; retrieve its result through the shared job endpoints.", "tags": [ "generation" ] } }, "/v1/avatar/from-text": { "post": { "description": "Submit 1–5000 characters and an optional voice reference to the text-to-avatar service. The service synthesizes the driving audio with indextts-2, then renders an avatar video. Billing is recorded as one avatar job and the response contains a shared job ID.", "operationId": "create_avatar_from_text_v1_avatar_from_text_post", "parameters": [ { "in": "header", "name": "Idempotency-Key", "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Idempotency-Key" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AvatarFromTextRequest" } } }, "required": true }, "responses": { "202": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JobAcceptedResponse" } } }, "description": "Successful Response" }, "409": { "description": "Idempotency-Key was already used for a different request", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "410": { "description": "Selected voice reference has expired", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "422": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } }, "429": { "description": "Concurrent job limit (MAX_CONCURRENT_JOBS) or request rate limit (RATE_LIMITED) reached.", "headers": { "X-Request-ID": { "description": "Request ID. Include it when contacting support.", "schema": { "type": "string" } } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "503": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FeatureDisabledResponse" } } }, "description": "Feature Temporarily Unavailable", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] } ], "summary": "Create an asynchronous avatar video from text", "tags": [ "generation" ] } }, "/v1/models": { "get": { "operationId": "list_models_v1_models_get", "tags": [ "llm" ], "summary": "List text models", "description": "OpenAI-compatible list of the text models you can call, with the context window, output limit and credits per million tokens.", "security": [ { "APIKeyBearer": [] }, { "APIKeyHeader": [] } ], "responses": { "200": { "description": "Successful Response", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LLMModelList" } } } }, "401": { "description": "Invalid or revoked API key", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OpenAIErrorResponse" } } } }, "500": { "description": "Server error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OpenAIErrorResponse" } } } } } } }, "/v1/chat/completions": { "post": { "operationId": "create_chat_completion_v1_chat_completions_post", "tags": [ "llm" ], "summary": "Create chat completion", "description": "OpenAI-compatible chat completion. Set stream=true to receive server-sent events. Credits are reserved from max_tokens and settled against the usage reported by the model. API Keys only.", "security": [ { "APIKeyBearer": [] }, { "APIKeyHeader": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LLMChatCompletionRequest" } } } }, "responses": { "200": { "description": "Successful Response", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LLMChatCompletion" } }, "text/event-stream": { "schema": { "type": "string", "description": "Server-sent events. Each data line is a chat.completion.chunk JSON object; the stream ends with data: [DONE]." } } } }, "400": { "description": "Invalid request", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OpenAIErrorResponse" } } } }, "401": { "description": "Invalid or revoked API key", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OpenAIErrorResponse" } } } }, "402": { "description": "Insufficient credits", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OpenAIErrorResponse" } } } }, "404": { "description": "Model not found", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OpenAIErrorResponse" } } } }, "413": { "description": "Request too large", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OpenAIErrorResponse" } } } }, "429": { "description": "Rate or concurrency limit reached", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." }, "Retry-After": { "schema": { "type": "integer" }, "description": "Seconds to wait before retrying." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OpenAIErrorResponse" } } } }, "502": { "description": "Model service error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OpenAIErrorResponse" } } } }, "503": { "description": "Feature disabled or service unavailable", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OpenAIErrorResponse" } } } }, "504": { "description": "Model service timed out", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OpenAIErrorResponse" } } } } } } }, "/v1/jobs": { "get": { "operationId": "list_jobs_v1_jobs_get", "parameters": [ { "in": "query", "name": "limit", "schema": { "default": 20, "title": "Limit", "type": "integer" } }, { "name": "type", "in": "query", "schema": { "type": "string" }, "description": "Optional comma-separated job types: tts, video, image, voice_design, audio_composition." }, { "name": "status", "in": "query", "schema": { "type": "string" } }, { "name": "cursor", "in": "query", "schema": { "type": "string" } }, { "name": "idempotency_key", "in": "query", "schema": { "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/JobResponse" }, "title": "Response List Jobs V1 Jobs Get", "type": "array" } } }, "description": "Successful Response", "headers": { "X-Next-Cursor": { "description": "Opaque cursor for the next page. Absent on the last page.", "schema": { "type": "string" } } } }, "422": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "List jobs", "tags": [ "jobs" ] } }, "/v1/jobs/{job_id}": { "get": { "operationId": "get_job_v1_jobs__job_id__get", "parameters": [ { "in": "path", "name": "job_id", "required": true, "schema": { "title": "Job Id", "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JobResponse" } } }, "description": "Successful Response" }, "422": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Get a job", "tags": [ "jobs" ] } }, "/v1/jobs/{job_id}/result": { "get": { "operationId": "get_job_result_v1_jobs__job_id__result_get", "parameters": [ { "in": "path", "name": "job_id", "required": true, "schema": { "title": "Job Id", "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JobResultResponse" } } }, "description": "Successful Response" }, "410": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JobResultExpiredResponse" } } }, "description": "Generated result is unavailable or expired", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } }, "422": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Get a job result", "tags": [ "jobs" ] } }, "/v1/tts": { "post": { "operationId": "create_tts_v1_tts_post", "description": "Submit text for asynchronous speech synthesis. model selects indextts-2 (default) or indextts-2.5. indextts-2 accepts up to 2048 characters and exactly one voice selector, and supports an emotion reference or eight-dimensional emotion vector. indextts-2.5 requires language, accepts up to 2000 characters, an optional speed and an emo_text description, and uses a preset voice, saved voice or voice reference. Use Idempotency-Key for safe retries.", "parameters": [ { "in": "header", "name": "Idempotency-Key", "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Idempotency-Key" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TTSRequest" } } }, "required": true }, "responses": { "202": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JobAcceptedResponse" } } }, "description": "Successful Response" }, "401": { "description": "Authentication required.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "404": { "description": "Selected voice preset was not found", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "409": { "description": "Idempotency-Key was already used for a different request (IDEMPOTENCY_CONFLICT).", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "410": { "description": "Selected user voice asset has expired", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "422": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } }, "429": { "description": "Concurrent job limit (MAX_CONCURRENT_JOBS) or request rate limit (RATE_LIMITED) reached.", "headers": { "X-Request-ID": { "description": "Request ID. Include it when contacting support.", "schema": { "type": "string" } } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "503": { "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/FeatureDisabledResponse" }, { "$ref": "#/components/schemas/ServiceUnavailableResponse" } ] } } }, "description": "Feature disabled or service temporarily unavailable; try again later", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Create an asynchronous speech job", "tags": [ "generation" ] } }, "/v1/uploads": { "post": { "description": "Issue an upload URL valid for 300 seconds. PUT the file with every returned header, then call POST /v1/uploads/{asset_id}/complete before referencing the asset_id in a generation request. Each account can request up to 30 uploads per minute and upload up to 500 MiB in any rolling 24 hours; all API Keys of the account share this allowance.", "operationId": "create_upload_url_v1_uploads_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UploadUrlRequest" } } }, "required": true }, "parameters": [], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UploadUrlResponse" } } }, "description": "Successful Response" }, "401": { "description": "Authentication required.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "409": { "description": "The credentials do not match the account.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "422": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } }, "429": { "description": "UPLOAD_RATE_LIMITED (more than 30 upload requests per minute) or UPLOAD_QUOTA_EXCEEDED (more than 500 MiB in 24 hours). quota gives the current limit and usage.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." }, "Retry-After": { "schema": { "type": "string" }, "description": "Seconds until enough rolling quota expires for this request. Omitted when no retry time can be promised. Concurrent uploads may delay availability." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "503": { "content": { "application/json": { "schema": { "type": "object", "required": [ "code", "detail" ], "properties": { "code": { "type": "string" }, "detail": { "type": "string" }, "feature": { "type": "string" } } } } }, "description": "The upload service is unavailable; try again later.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Request an upload URL", "tags": [ "generation" ] } }, "/v1/uploads/{asset_id}/complete": { "post": { "operationId": "complete_upload_v1_uploads_asset_id_complete_post", "parameters": [ { "in": "path", "name": "asset_id", "required": true, "schema": { "title": "Asset Id", "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UploadCompleteResponse" } } }, "description": "Successful Response" }, "401": { "description": "Authentication required.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "404": { "description": "Upload not found", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "409": { "description": "The credentials do not match the account.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "410": { "description": "Upload completion window expired", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "422": { "description": "Upload incomplete or invalid", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/HTTPValidationError" }, { "$ref": "#/components/schemas/APIErrorResponse" } ] } } } }, "503": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FeatureDisabledResponse" } } }, "description": "Feature Temporarily Unavailable", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Complete an upload", "tags": [ "generation" ] } }, "/v1/webhook-endpoints": { "get": { "operationId": "list_webhook_endpoints_v1_webhook_endpoints_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/WebhookEndpointResponse" } } } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "List webhook endpoints", "tags": [ "webhooks" ] }, "post": { "operationId": "create_webhook_endpoint_v1_webhook_endpoints_post", "responses": { "201": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookEndpointCreatedResponse" } } } }, "422": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Create webhook endpoint", "tags": [ "webhooks" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateWebhookEndpointRequest" } } } } } }, "/v1/webhook-endpoints/{endpoint_id}": { "get": { "operationId": "get_webhook_endpoint_v1_webhook_endpoints_endpoint_id_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookEndpointResponse" } } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Get webhook endpoint", "tags": [ "webhooks" ], "parameters": [ { "in": "path", "name": "endpoint_id", "required": true, "schema": { "type": "string" } } ] }, "patch": { "operationId": "update_webhook_endpoint_v1_webhook_endpoints_endpoint_id_patch", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookEndpointResponse" } } } }, "422": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Update webhook endpoint", "tags": [ "webhooks" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateWebhookEndpointRequest" } } } }, "parameters": [ { "in": "path", "name": "endpoint_id", "required": true, "schema": { "type": "string" } } ] }, "delete": { "operationId": "delete_webhook_endpoint_v1_webhook_endpoints_endpoint_id_delete", "responses": { "204": { "description": "Successful Response" } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Delete webhook endpoint", "tags": [ "webhooks" ], "parameters": [ { "in": "path", "name": "endpoint_id", "required": true, "schema": { "type": "string" } } ] } }, "/v1/webhook-endpoints/{endpoint_id}/rotate-secret": { "post": { "operationId": "rotate_webhook_endpoint_secret_v1_webhook_endpoints_endpoint_id_rotate_secret_post", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookEndpointCreatedResponse" } } } }, "422": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Rotate webhook signing secret", "tags": [ "webhooks" ], "parameters": [ { "in": "path", "name": "endpoint_id", "required": true, "schema": { "type": "string" } } ] } }, "/v1/webhook-endpoints/{endpoint_id}/test": { "post": { "operationId": "test_webhook_endpoint_v1_webhook_endpoints_endpoint_id_test_post", "responses": { "202": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookActionResponse" } } } }, "422": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Send webhook test event", "tags": [ "webhooks" ], "parameters": [ { "in": "path", "name": "endpoint_id", "required": true, "schema": { "type": "string" } } ] } }, "/v1/webhook-endpoints/{endpoint_id}/deliveries": { "get": { "operationId": "list_webhook_deliveries_v1_webhook_endpoints_endpoint_id_deliveries_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookDeliveryPage" } } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "List webhook deliveries", "tags": [ "webhooks" ], "parameters": [ { "in": "path", "name": "endpoint_id", "required": true, "schema": { "type": "string" } }, { "in": "query", "name": "status", "schema": { "type": "string" } }, { "in": "query", "name": "cursor", "schema": { "type": "string" } } ] } }, "/v1/webhook-deliveries/{delivery_id}/redeliver": { "post": { "operationId": "redeliver_webhook_v1_webhook_deliveries_delivery_id_redeliver_post", "responses": { "202": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookActionResponse" } } } }, "422": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Redeliver failed webhook", "tags": [ "webhooks" ], "parameters": [ { "in": "path", "name": "delivery_id", "required": true, "schema": { "type": "string" } } ] } }, "/v1/video/config": { "get": { "operationId": "video_get_v1_video_config", "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VideoConfiguration" } } }, "description": "Successful Response" }, "503": { "content": { "application/json": { "schema": { "properties": { "detail": { "title": "Detail", "type": "string" } }, "required": [ "detail" ], "title": "ErrorDetail", "type": "object" } } }, "description": "Feature Configuration Unavailable", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "summary": "Read video model capabilities and billing", "tags": [ "capabilities" ], "description": "Read live video model availability, generation modes, duration and reference limits, supported resolutions, and billing rates. Use this response to choose a model before POST /v1/video/quote or /v1/video/generate." } }, "/v1/video/generate": { "post": { "operationId": "video_post_v1_video_generate", "parameters": [ { "in": "header", "name": "Idempotency-Key", "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Idempotency-Key" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VideoRequest" } } } }, "responses": { "202": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JobAcceptedResponse" } } }, "description": "Successful Response" }, "401": { "description": "Authentication required.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "409": { "description": "Idempotency-Key was already used for a different request (IDEMPOTENCY_CONFLICT).", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "410": { "description": "Reference asset expired; upload the reference again.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "422": { "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/HTTPValidationError" }, { "$ref": "#/components/schemas/APIErrorResponse" } ] } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } }, "429": { "description": "Concurrent job limit (MAX_CONCURRENT_JOBS) or request rate limit (RATE_LIMITED) reached.", "headers": { "X-Request-ID": { "description": "Request ID. Include it when contacting support.", "schema": { "type": "string" } } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "503": { "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/FeatureDisabledResponse" }, { "$ref": "#/components/schemas/ServiceUnavailableResponse" } ] } } }, "description": "Feature disabled or service temporarily unavailable; try again later", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Create an asynchronous video generation job", "tags": [ "generation" ], "description": "Create a video generation job with the selected model. Read GET /v1/video/config first, quote the request with POST /v1/video/quote, then submit the unchanged request with quote_id, quote_version and an Idempotency-Key." } }, "/v1/jobs/{job_id}/cancel": { "post": { "operationId": "video_post_v1_jobs_job_id_cancel", "parameters": [ { "in": "path", "name": "job_id", "required": true, "schema": { "title": "Job Id", "type": "string" } }, { "in": "query", "name": "queued_only", "description": "Stop the job only while it is still queued. If generation has started, return 409 and leave the job running.", "schema": { "type": "boolean" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JobCancellationResponse" } } }, "description": "Successful Response" }, "404": { "description": "Job not found or not owned by this account", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "409": { "description": "The job cannot be stopped, or generation started before a queued_only request took effect", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "422": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "summary": "Stop a generation job", "tags": [ "jobs" ], "description": "Stopping a job before generation starts refunds its reserved credits. Stopping a job after generation has started keeps the reservation. Repeated requests do not add a charge.", "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ] } }, "/v1/image/config": { "get": { "description": "Read enabled image models, supported sizes, reference-image limits and surcharges, and the current rate version. Use this response to build an ImageRequest and submit its rate_version unchanged.", "operationId": "image_get_v1_image_config", "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ImageConfiguration" } } }, "description": "Successful Response" }, "503": { "content": { "application/json": { "schema": { "properties": { "detail": { "title": "Detail", "type": "string" } }, "required": [ "detail" ], "title": "ErrorDetail", "type": "object" } } }, "description": "Feature Configuration Unavailable", "headers": { "X-Request-ID": { "description": "Request ID. Include it when contacting support.", "schema": { "type": "string" } } } } }, "summary": "Read image model capabilities and billing", "tags": [ "capabilities" ] } }, "/v1/image/generate": { "post": { "description": "Create one PNG image with an available image model, using text-to-image or image-to-image. Submit the current rate_version and a stable Idempotency-Key. If no response arrives, use POST /v1/image/submissions/resolve to confirm the outcome.", "operationId": "image_post_v1_image_generate", "parameters": [ { "in": "header", "name": "Idempotency-Key", "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Idempotency-Key" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ImageRequest" } } }, "required": true }, "responses": { "202": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JobAcceptedResponse" } } }, "description": "Successful Response" }, "401": { "description": "Authentication required", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "409": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } }, "description": "Idempotency-Key was already used for a different request, or the rate has changed; read the current rate before submitting again.", "headers": { "X-Request-ID": { "description": "Request ID. Include it when contacting support.", "schema": { "type": "string" } } } }, "410": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } }, "description": "Reference asset expired; upload the reference again." }, "422": { "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/HTTPValidationError" }, { "$ref": "#/components/schemas/APIErrorResponse" } ] } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "description": "Request ID. Include it when contacting support.", "schema": { "type": "string" } } } }, "429": { "description": "Concurrent job limit (MAX_CONCURRENT_JOBS), request rate limit (RATE_LIMITED) or upload allowance (UPLOAD_RATE_LIMITED, UPLOAD_QUOTA_EXCEEDED) reached.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." }, "Retry-After": { "schema": { "type": "string" }, "description": "Seconds until enough rolling quota expires for this request. Omitted when no retry time can be promised. Concurrent uploads may delay availability." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "503": { "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/FeatureDisabledResponse" }, { "$ref": "#/components/schemas/ServiceUnavailableResponse" } ] } } }, "description": "Feature disabled or service temporarily unavailable; try again later", "headers": { "X-Request-ID": { "description": "Request ID. Include it when contacting support.", "schema": { "type": "string" } } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Create an asynchronous image generation job", "tags": [ "generation" ] } }, "/v1/image/submissions/resolve": { "post": { "description": "Confirm the outcome of an image submission that received no response, using the original request and Idempotency-Key. If the original request was accepted, its job is returned; otherwise an uncharged failed job is returned and the original request can no longer be accepted. This endpoint never generates an image.", "operationId": "resolve_image_submission", "parameters": [ { "in": "header", "name": "Idempotency-Key", "required": true, "schema": { "type": "string", "maxLength": 128 } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "request" ], "properties": { "request": { "$ref": "#/components/schemas/ImageSubmissionRequest" }, "expected_job_id": { "type": "string", "description": "Job ID returned earlier for this submission, or an empty string if none was returned." } } } } } }, "responses": { "202": { "description": "The original job or an uncharged failed job", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JobAcceptedResponse" } } } }, "401": { "description": "Authentication required", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "409": { "description": "The Idempotency-Key belongs to a different request (IDEMPOTENCY_CONFLICT).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "422": { "description": "Invalid request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "503": { "description": "Service temporarily unavailable; retry this endpoint later instead of submitting a new image", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ServiceUnavailableResponse" } } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Resolve an uncertain image submission without generating", "tags": [ "generation" ] } }, "/v1/video/quote": { "post": { "operationId": "video_post_v1_video_quote", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VideoQuoteInput" } } } }, "parameters": [], "responses": { "200": { "description": "Video quote", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VideoQuote" } } } }, "401": { "description": "Authentication required.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "409": { "description": "Idempotency-Key was already used for a different request (IDEMPOTENCY_CONFLICT).", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "410": { "description": "Reference asset expired; upload the reference again.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "422": { "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/HTTPValidationError" }, { "$ref": "#/components/schemas/APIErrorResponse" } ] } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } }, "503": { "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/FeatureDisabledResponse" }, { "$ref": "#/components/schemas/ServiceUnavailableResponse" } ] } } }, "description": "Feature disabled or service temporarily unavailable; try again later", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Quote a video generation", "tags": [ "generation" ], "description": "Validate the video request and return the billable duration, credits, rate_version and, when applicable, quote_id. Quoting does not create a job or reserve credits. Submit the unchanged request with quote_id, and rate_version as quote_version." } }, "/v1/voice-design/config": { "get": { "description": "Read whether voice design is available, its current model, the per-candidate credit price and the billing version. Check this endpoint before POST /v1/voice-designs.", "operationId": "voice_design_configuration", "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VoiceDesignConfiguration" } } }, "description": "Successful Response" }, "503": { "content": { "application/json": { "schema": { "properties": { "detail": { "title": "Detail", "type": "string" } }, "required": [ "detail" ], "title": "ErrorDetail", "type": "object" } } }, "description": "Feature Configuration Unavailable", "headers": { "X-Request-ID": { "description": "Request ID. Include it when contacting support.", "schema": { "type": "string" } } } } }, "summary": "Read voice design availability and per-candidate price", "tags": [ "capabilities" ] } }, "/v1/voice-designs": { "post": { "description": "Create a voice_design job that generates one new voice from a description. No recording is required. Credits are reserved at the current per-candidate rate and refunded if no result is produced.", "operationId": "voice_design_create", "parameters": [ { "in": "header", "name": "Idempotency-Key", "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Idempotency-Key" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VoiceDesignRequest" } } }, "required": true }, "responses": { "202": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JobAcceptedResponse" } } }, "description": "Successful Response" }, "401": { "description": "Authentication required.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "409": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } }, "description": "Idempotency-Key was already used for a different request, or the rate has changed; read the current rate before submitting again.", "headers": { "X-Request-ID": { "description": "Request ID. Include it when contacting support.", "schema": { "type": "string" } } } }, "410": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } }, "description": "Reference asset expired; upload the reference again." }, "422": { "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/HTTPValidationError" }, { "$ref": "#/components/schemas/APIErrorResponse" } ] } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "description": "Request ID. Include it when contacting support.", "schema": { "type": "string" } } } }, "429": { "description": "Concurrent job limit (MAX_CONCURRENT_JOBS) or request rate limit (RATE_LIMITED) reached.", "headers": { "X-Request-ID": { "description": "Request ID. Include it when contacting support.", "schema": { "type": "string" } } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "503": { "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/FeatureDisabledResponse" }, { "$ref": "#/components/schemas/ServiceUnavailableResponse" } ] } } }, "description": "Feature disabled or service temporarily unavailable; try again later", "headers": { "X-Request-ID": { "description": "Request ID. Include it when contacting support.", "schema": { "type": "string" } } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Design one original voice from a description", "tags": [ "generation" ] } }, "/v1/voice-designs/{job_id}/save": { "post": { "description": "Save a successful candidate to the account voice library. Use the returned id as voice_asset_id. Saving again returns the same voice and charges no additional credits.", "operationId": "voice_design_save", "parameters": [ { "in": "path", "name": "job_id", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Saved voice", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VoiceAssetRecord" } } } }, "401": { "description": "Authentication required.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "409": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } }, "description": "Idempotency-Key was already used for a different request, or the rate has changed; read the current rate before submitting again.", "headers": { "X-Request-ID": { "description": "Request ID. Include it when contacting support.", "schema": { "type": "string" } } } }, "410": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } }, "description": "Reference asset expired; upload the reference again." }, "422": { "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/HTTPValidationError" }, { "$ref": "#/components/schemas/APIErrorResponse" } ] } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "description": "Request ID. Include it when contacting support.", "schema": { "type": "string" } } } }, "429": { "description": "Concurrent job limit (MAX_CONCURRENT_JOBS), request rate limit (RATE_LIMITED) or upload allowance (UPLOAD_RATE_LIMITED, UPLOAD_QUOTA_EXCEEDED) reached.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." }, "Retry-After": { "schema": { "type": "string" }, "description": "Seconds until enough rolling quota expires for this request. Omitted when no retry time can be promised. Concurrent uploads may delay availability." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "503": { "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/FeatureDisabledResponse" }, { "$ref": "#/components/schemas/ServiceUnavailableResponse" } ] } } }, "description": "Feature disabled or service temporarily unavailable; try again later", "headers": { "X-Request-ID": { "description": "Request ID. Include it when contacting support.", "schema": { "type": "string" } } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Save a designed voice to the account voice library", "tags": [ "generation" ] } }, "/v1/audio/compositions/quote": { "post": { "operationId": "audioCompositionQuote", "description": "Parse the v1 prompt_document or plain text, validate voice and audio references, and return the estimated credits and the number of speech segments. Quoting does not create a job or reserve credits.", "summary": "Quote an audio composition", "tags": [ "generation" ], "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "parameters": [], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AudioCompositionQuote" } } } }, "401": { "description": "Authentication required.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "409": { "description": "The credentials do not match the account.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AudioCompositionRequest" } } } } } }, "/v1/audio/compositions": { "post": { "operationId": "createAudioComposition", "description": "Create an audio composition job: each speech line is synthesized once, sound effects are trimmed to their ranges, music is looped, and the timeline is mixed into one WAV. An Idempotency-Key is required. A v1 prompt_document is recommended; text-only requests are parsed as a simple timeline. model selects the speech model for every speech line: indextts-2 (default) or indextts-2.5.", "summary": "Create an asynchronous audio composition job", "tags": [ "generation" ], "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "parameters": [ { "in": "header", "name": "Idempotency-Key", "required": true, "description": "Stable key for retries of the same composition request. Reusing it with different content returns 409.", "schema": { "type": "string", "minLength": 1, "maxLength": 128 } } ], "responses": { "202": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JobAcceptedResponse" } } } }, "401": { "description": "Authentication required.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "409": { "description": "The credentials do not match the account.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } }, "429": { "description": "UPLOAD_RATE_LIMITED (more than 30 upload requests per minute) or UPLOAD_QUOTA_EXCEEDED (more than 500 MiB in 24 hours). quota gives the current limit and usage.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." }, "Retry-After": { "schema": { "type": "string" }, "description": "Seconds until enough rolling quota expires for this request. Omitted when no retry time can be promised. Concurrent uploads may delay availability." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } } }, "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AudioCompositionRequest" } } } } } }, "/v1/audio/compositions/{job_id}/retry": { "post": { "operationId": "retryAudioComposition", "description": "Resume a failed or cancelled composition while retaining completed speech segments. Only unfinished segments or the final mix are retried.", "summary": "Resume an audio composition", "tags": [], "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JobAcceptedResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "parameters": [ { "name": "job_id", "in": "path", "required": true, "schema": { "type": "string" } } ] } }, "/v1/video/upscale/config": { "get": { "operationId": "video_upscale_configuration", "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VideoUpscaleConfiguration" } } } }, "503": { "content": { "application/json": { "schema": { "properties": { "detail": { "title": "Detail", "type": "string" } }, "required": [ "detail" ], "title": "ErrorDetail", "type": "object" } } }, "description": "Feature Configuration Unavailable", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "summary": "Enabled video upscale tiers and live service readiness", "tags": [ "capabilities" ], "description": "Enabled video upscale tiers and live service readiness" } }, "/v1/video/upscale": { "post": { "operationId": "create_video_upscale", "parameters": [ { "in": "header", "name": "Idempotency-Key", "schema": { "type": "string", "minLength": 1, "maxLength": 128 }, "required": true } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VideoUpscaleRequest" } } } }, "responses": { "202": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JobAcceptedResponse" } } }, "description": "Successful Response" }, "401": { "description": "Authentication required.", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "409": { "description": "Idempotency-Key was already used for a different request (IDEMPOTENCY_CONFLICT).", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "410": { "description": "Reference asset expired; upload the reference again.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "422": { "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/HTTPValidationError" }, { "$ref": "#/components/schemas/APIErrorResponse" } ] } } }, "description": "Validation Error", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } }, "429": { "description": "Concurrent job limit (MAX_CONCURRENT_JOBS) or request rate limit (RATE_LIMITED) reached.", "headers": { "X-Request-ID": { "description": "Request ID. Include it when contacting support.", "schema": { "type": "string" } } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/APIErrorResponse" } } } }, "503": { "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/FeatureDisabledResponse" }, { "$ref": "#/components/schemas/ServiceUnavailableResponse" } ] } } }, "description": "Feature disabled or service temporarily unavailable; try again later", "headers": { "X-Request-ID": { "schema": { "type": "string" }, "description": "Request ID. Include it when contacting support." } } } }, "security": [ { "APIKeyHeader": [] }, { "APIKeyBearer": [] }, { "HTTPBearer": [] } ], "summary": "Upscale an owned MP4 as an independent recoverable job", "tags": [ "generation" ], "description": "Requires a stable Idempotency-Key. Original video and audio are retained. Results are checked before credit settlement. No remote cancellation is supported." } } }, "components": { "schemas": { "VoicePresetListResponse": { "properties": { "catalog_version": { "title": "Catalog Version", "type": "string" }, "generated_at": { "format": "date-time", "title": "Generated At", "type": "string" }, "items": { "items": { "$ref": "#/components/schemas/VoicePresetRecord" }, "title": "Items", "type": "array" }, "total": { "title": "Total", "type": "integer" }, "limit": { "title": "Limit", "type": "integer" }, "offset": { "title": "Offset", "type": "integer" } }, "required": [ "catalog_version", "generated_at", "items", "total", "limit", "offset" ], "title": "VoicePresetListResponse", "type": "object" }, "VoicePresetRecord": { "properties": { "icon_url": { "description": "Icon path relative to the API Base URL. Requesting it redirects to a temporary thumbnail URL, so it can be loaded lazily.", "type": "string" }, "id": { "title": "Id", "type": "string", "pattern": "^vp_[a-f0-9]{24}$" }, "display_name": { "title": "Display Name", "type": "string" }, "language": { "title": "Language", "type": "string" }, "locale": { "title": "Locale", "type": "string" }, "duration_ms": { "title": "Duration Ms", "type": "integer", "minimum": 1 }, "size_bytes": { "title": "Size Bytes", "type": "integer", "minimum": 1 }, "usage_count": { "description": "Number of speech synthesis jobs completed successfully with this preset.", "minimum": 0, "title": "Usage Count", "type": "integer" } }, "required": [ "id", "display_name", "language", "locale", "duration_ms", "size_bytes", "usage_count" ], "title": "VoicePresetRecord", "type": "object" }, "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "title": "Detail", "type": "array" }, "code": { "type": "string", "const": "VALIDATION_ERROR" } }, "title": "HTTPValidationError", "type": "object" }, "ValidationError": { "properties": { "ctx": { "title": "Context", "type": "object" }, "input": { "title": "Input" }, "loc": { "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] }, "title": "Location", "type": "array" }, "msg": { "title": "Message", "type": "string" }, "type": { "title": "Error Type", "type": "string" } }, "required": [ "loc", "msg", "type" ], "title": "ValidationError", "type": "object" }, "APIErrorResponse": { "type": "object", "required": [ "detail" ], "properties": { "code": { "type": "string", "description": "Stable machine-readable error code. Clients translate this code for display." }, "detail": { "type": "string", "description": "Diagnostic description; user interfaces should display a localized message using the code and request context." }, "reference_audio_duration": { "type": "object", "description": "Present for VIDEO_INPUT_INVALID when reference audio fails a duration check. Without min_seconds, the duration is the sum of the reference audio clips.", "required": [ "seconds", "max_seconds" ], "properties": { "seconds": { "type": "number" }, "min_seconds": { "type": "integer" }, "max_seconds": { "type": "integer" } } }, "quota": { "$ref": "#/components/schemas/UploadQuota" } } }, "UploadQuota": { "type": "object", "description": "The upload allowance that blocked this request, for the authenticated account only. Counts are integers and capacities are bytes. Copies created by the service, such as saved voices, do not use this allowance. There is no daily limit on the number of uploads.", "required": [ "kind", "limit", "used", "requested" ], "properties": { "kind": { "type": "string", "enum": [ "rate", "daily_bytes" ] }, "limit": { "type": "integer", "format": "int64", "minimum": 1 }, "used": { "type": "integer", "format": "int64", "minimum": 0 }, "requested": { "type": "integer", "format": "int64", "minimum": 1 }, "retry_at": { "type": "string", "format": "date-time", "description": "Estimated earliest time this request can succeed, assuming no new uploads. Omitted when no estimate is available or the request is larger than the entire allowance." } } }, "VoiceAssetPlaybackResponse": { "properties": { "url": { "title": "Url", "type": "string" }, "expires_in": { "title": "Expires In", "type": "integer" } }, "required": [ "url", "expires_in" ], "title": "VoiceAssetPlaybackResponse", "type": "object" }, "VoiceAssetRecord": { "properties": { "id": { "title": "Id", "type": "string" }, "display_name": { "title": "Display Name", "type": "string" }, "original_filename": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Original Filename" }, "size_bytes": { "anyOf": [ { "minimum": 0, "type": "integer" }, { "type": "null" } ], "title": "Size Bytes" }, "uploaded_at": { "format": "date-time", "title": "Uploaded At", "type": "string" }, "retained_until": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "description": "Media retention deadline, or null for permanent retention. Signed URL lifetime is independent." }, "permanent": { "type": "boolean" }, "source": { "type": "string", "enum": [ "uploaded", "designed", "preset" ] }, "preset_id": { "type": "string", "description": "ID of the preset voice this voice comes from, when applicable." }, "description": { "type": "string" }, "duration_seconds": { "type": "number" } }, "required": [ "id", "display_name", "original_filename", "size_bytes", "uploaded_at", "retained_until" ], "title": "VoiceAssetRecord", "type": "object" }, "VoiceAssetListResponse": { "properties": { "items": { "items": { "$ref": "#/components/schemas/VoiceAssetRecord" }, "title": "Items", "type": "array" }, "total": { "title": "Total", "type": "integer" }, "limit": { "title": "Limit", "type": "integer" }, "offset": { "title": "Offset", "type": "integer" } }, "required": [ "items", "total", "limit", "offset" ], "title": "VoiceAssetListResponse", "type": "object" }, "RenameVoiceAssetRequest": { "properties": { "display_name": { "maxLength": 80, "minLength": 1, "title": "Display Name", "type": "string" } }, "required": [ "display_name" ], "title": "RenameVoiceAssetRequest", "type": "object" }, "CapabilitiesResponse": { "properties": { "features": { "additionalProperties": { "$ref": "#/components/schemas/PublicFeatureCapability" }, "title": "Features", "type": "object" }, "read_only": { "title": "Read Only", "type": "boolean" }, "audio": { "$ref": "#/components/schemas/AudioGenerationCapability" } }, "required": [ "read_only", "features", "audio" ], "title": "CapabilitiesResponse", "type": "object" }, "PublicFeatureCapability": { "properties": { "enabled": { "title": "Enabled", "type": "boolean" }, "message": { "title": "Message", "type": "string" } }, "required": [ "enabled", "message" ], "title": "PublicFeatureCapability", "type": "object" }, "AudioGenerationCapability": { "type": "object", "properties": { "max_text_length": { "type": "integer" }, "chars_per_second": { "type": "number" }, "credits_per_second": { "type": "number" }, "minimum_credits": { "type": "number" }, "emotion_text_supported": { "type": "boolean" }, "emotion_weight_max": { "type": "number" } }, "required": [ "max_text_length", "chars_per_second", "credits_per_second", "minimum_credits", "emotion_text_supported", "emotion_weight_max" ] }, "ApiKeyResponse": { "properties": { "created_at": { "format": "date-time", "title": "Created At", "type": "string" }, "id": { "title": "Id", "type": "string" }, "is_active": { "title": "Is Active", "type": "boolean" }, "last_used_at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "title": "Last Used At" }, "name": { "title": "Name", "type": "string" }, "public_prefix": { "title": "Public Prefix", "type": "string" } }, "required": [ "id", "name", "public_prefix", "is_active", "last_used_at", "created_at" ], "title": "ApiKeyResponse", "type": "object" }, "CreateApiKeyRequest": { "properties": { "name": { "default": "default", "maxLength": 120, "title": "Name", "type": "string" } }, "title": "CreateApiKeyRequest", "type": "object" }, "ApiKeyCreatedResponse": { "properties": { "created_at": { "format": "date-time", "title": "Created At", "type": "string" }, "id": { "title": "Id", "type": "string" }, "is_active": { "title": "Is Active", "type": "boolean" }, "key": { "title": "Key", "type": "string" }, "last_used_at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "title": "Last Used At" }, "name": { "title": "Name", "type": "string" }, "public_prefix": { "title": "Public Prefix", "type": "string" } }, "required": [ "id", "name", "public_prefix", "is_active", "last_used_at", "created_at", "key" ], "title": "ApiKeyCreatedResponse", "type": "object" }, "FeatureDisabledResponse": { "properties": { "code": { "const": "feature_disabled", "title": "Code", "type": "string" }, "detail": { "title": "Detail", "type": "string" }, "feature": { "title": "Feature", "type": "string" } }, "required": [ "detail", "code", "feature" ], "title": "FeatureDisabledResponse", "type": "object" }, "AvatarRequest": { "properties": { "audio_ref_key": { "description": "Driving audio asset references", "title": "Audio Ref Key", "type": "string" }, "image_ref_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Reference portrait image asset references", "title": "Image Ref Key" }, "prompt": { "default": "", "maxLength": 2000, "description": "可选的视频提示词,最多 2000 个字符。", "title": "Prompt", "type": "string" }, "resolution": { "$ref": "#/components/schemas/Resolution", "default": "480p" }, "webhook_endpoint_id": { "anyOf": [ { "type": "string", "pattern": "^whe_[a-f0-9]{32}$" }, { "type": "null" } ], "description": "Registered webhook endpoint to notify when the job succeeds or fails.", "title": "Webhook Endpoint Id" } }, "required": [ "audio_ref_key" ], "title": "AvatarRequest", "type": "object" }, "Resolution": { "enum": [ "480p", "720p" ], "title": "Resolution", "type": "string" }, "JobAcceptedResponse": { "properties": { "estimate_detail": { "additionalProperties": true, "title": "Estimate Detail", "type": "object" }, "id": { "title": "Id", "type": "string" }, "reserved_credits": { "title": "Reserved Credits", "type": "number" }, "status": { "$ref": "#/components/schemas/JobStatus" }, "type": { "$ref": "#/components/schemas/JobType" } }, "required": [ "id", "type", "status", "reserved_credits", "estimate_detail" ], "title": "JobAcceptedResponse", "type": "object" }, "JobStatus": { "enum": [ "queued", "processing", "succeeded", "failed", "cancelled" ], "title": "JobStatus", "type": "string" }, "JobType": { "enum": [ "tts", "avatar", "video", "video_analysis", "image", "voice_design", "audio_composition" ], "title": "JobType", "type": "string" }, "AvatarFromTextRequest": { "description": "One call: text -> (service indextts-2) -> the avatar video service.", "properties": { "image_ref_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Image Ref Key", "description": "可选的人物图像资源引用。" }, "prompt": { "default": "", "maxLength": 2000, "description": "可选的视频提示词,最多 2000 个字符。", "title": "Prompt", "type": "string" }, "resolution": { "$ref": "#/components/schemas/Resolution", "default": "480p" }, "text": { "maxLength": 5000, "minLength": 1, "description": "要合成的台词,1–5000 个字符。", "title": "Text", "type": "string" }, "voice_ref_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Voice Ref Key", "description": "可选的声音参考资源引用。" }, "webhook_endpoint_id": { "anyOf": [ { "type": "string", "pattern": "^whe_[a-f0-9]{32}$" }, { "type": "null" } ], "description": "Registered webhook endpoint to notify when the job succeeds or fails.", "title": "Webhook Endpoint Id" } }, "required": [ "text" ], "title": "AvatarFromTextRequest", "type": "object" }, "LLMModelList": { "type": "object", "properties": { "object": { "type": "string", "const": "list" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/LLMModel" } } }, "required": [ "object", "data" ], "additionalProperties": false }, "LLMModel": { "type": "object", "properties": { "id": { "type": "string" }, "object": { "type": "string", "const": "model" }, "created": { "type": "integer" }, "display_name": { "type": "string" }, "context_window": { "type": "integer" }, "max_output_tokens": { "type": "integer" }, "supports_stream": { "type": "boolean" }, "supports_thinking": { "type": "boolean" }, "pricing": { "$ref": "#/components/schemas/LLMModelPricing" } }, "required": [ "id", "object", "created", "display_name", "context_window", "max_output_tokens", "supports_stream", "supports_thinking", "pricing" ], "additionalProperties": false }, "LLMModelPricing": { "type": "object", "properties": { "input_credits_per_million": { "type": "string" }, "cached_input_credits_per_million": { "type": "string" }, "output_credits_per_million": { "type": "string" } }, "required": [ "input_credits_per_million", "cached_input_credits_per_million", "output_credits_per_million" ], "additionalProperties": false, "description": "Credits per million tokens as decimal strings with four decimals." }, "OpenAIErrorResponse": { "type": "object", "properties": { "error": { "type": "object", "properties": { "message": { "type": "string" }, "type": { "type": "string" }, "code": { "type": "string" }, "param": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "message", "type", "code", "param" ], "additionalProperties": false } }, "required": [ "error" ], "additionalProperties": false, "description": "Error body used by the OpenAI-compatible routes." }, "LLMChatCompletionRequest": { "type": "object", "properties": { "model": { "type": "string", "description": "A model id from GET /v1/models." }, "messages": { "type": "array", "minItems": 1, "items": { "$ref": "#/components/schemas/LLMChatMessage" } }, "stream": { "type": "boolean" }, "stream_options": { "type": "object", "properties": { "include_usage": { "type": "boolean" } } }, "max_tokens": { "type": "integer", "minimum": 1 }, "max_completion_tokens": { "type": "integer", "minimum": 1 }, "temperature": { "type": "number" }, "top_p": { "type": "number" }, "presence_penalty": { "type": "number" }, "frequency_penalty": { "type": "number" }, "seed": { "type": "integer" }, "stop": { "oneOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" }, "maxItems": 4 } ] }, "response_format": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "text", "json_object" ] } } }, "reasoning_effort": { "type": "string", "enum": [ "low", "medium", "high" ] }, "user": { "type": "string" } }, "required": [ "model", "messages" ], "description": "OpenAI chat completion request. Unknown fields are ignored. n greater than 1, tools and non-text content are not supported." }, "LLMChatMessage": { "type": "object", "properties": { "role": { "type": "string", "enum": [ "system", "user", "assistant" ] }, "content": { "type": "string" }, "name": { "type": "string" } }, "required": [ "role", "content" ] }, "LLMChatCompletion": { "type": "object", "properties": { "id": { "type": "string" }, "object": { "type": "string", "const": "chat.completion" }, "created": { "type": "integer" }, "model": { "type": "string" }, "choices": { "type": "array", "items": { "type": "object", "properties": { "index": { "type": "integer" }, "message": { "type": "object", "properties": { "role": { "type": "string" }, "content": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "reasoning_content": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } } }, "finish_reason": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } } } }, "usage": { "$ref": "#/components/schemas/LLMUsage" } }, "required": [ "id", "object", "created", "model", "choices" ] }, "LLMUsage": { "type": "object", "properties": { "prompt_tokens": { "type": "integer" }, "completion_tokens": { "type": "integer" }, "total_tokens": { "type": "integer" }, "prompt_tokens_details": { "type": "object", "properties": { "cached_tokens": { "type": "integer" } } }, "completion_tokens_details": { "type": "object", "properties": { "reasoning_tokens": { "type": "integer" } } } }, "required": [ "prompt_tokens", "completion_tokens", "total_tokens" ] }, "JobResponse": { "properties": { "provider_failure": { "description": "User-facing reason and recovery action derived from a failed video generation receipt. Includes only safe service identifiers. Portrait enrollment is indicated only when explicitly requested in the receipt.", "type": "object", "properties": { "code": { "type": "string" }, "request_id": { "type": "string" }, "stage": { "type": "string", "enum": [ "submission", "generation" ] }, "reason": { "type": "string" }, "reason_en": { "type": "string" }, "action": { "type": "string" }, "action_en": { "type": "string" } }, "required": [ "stage", "reason", "reason_en", "action", "action_en" ] }, "actual_credits": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "title": "Actual Credits" }, "created_at": { "format": "date-time", "title": "Created At", "type": "string" }, "error_code": { "description": "Failure reason code. IMAGE_REFERENCE_COPYRIGHT, IMAGE_PROMPT_COPYRIGHT and IMAGE_OUTPUT_COPYRIGHT mean the reference image, prompt or generated image was rejected in copyright review. IMAGE_PROVIDER_INVALID_PARAMETERS means the image model rejected the request parameters. In these cases reserved credits are refunded. IMAGE_PROVIDER_NO_RESULT means the job ended without a result and any remaining reserved credits were refunded. IMAGE_SUBMISSION_NOT_ACCEPTED means the image submission was closed before it was accepted, and no credits were charged.", "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Error Code" }, "error_message": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Error Message" }, "finished_at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "title": "Finished At" }, "id": { "title": "Id", "type": "string" }, "reserved_credits": { "title": "Reserved Credits", "type": "number" }, "started_at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "title": "Started At" }, "status": { "$ref": "#/components/schemas/JobStatus" }, "type": { "$ref": "#/components/schemas/JobType" }, "webhook_endpoint_id": { "anyOf": [ { "type": "string", "pattern": "^whe_[a-f0-9]{32}$" }, { "type": "null" } ], "title": "Webhook Endpoint Id" }, "progress": { "type": "number", "minimum": 0, "maximum": 1 } }, "required": [ "id", "type", "status", "reserved_credits", "actual_credits", "error_code", "error_message", "created_at", "started_at", "finished_at" ], "title": "JobResponse", "type": "object" }, "JobResultResponse": { "properties": { "expires_in": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Expires In" }, "id": { "title": "Id", "type": "string" }, "result_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Result Url" }, "retained_until": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "description": "Media retention deadline, or null for permanent retention. Signed URL lifetime is independent." }, "status": { "$ref": "#/components/schemas/JobStatus" }, "preview_url": { "type": "string" }, "preview_status": { "type": "string", "enum": [ "pending", "ready", "expired" ] }, "thumbnail_url": { "type": "string", "description": "Optional signed, aspect-preserving image thumbnail for canvas display." } }, "required": [ "id", "status" ], "title": "JobResultResponse", "type": "object" }, "JobResultExpiredResponse": { "properties": { "code": { "enum": [ "JOB_RESULT_EXPIRED" ], "title": "Code", "type": "string" }, "detail": { "title": "Detail", "type": "string" } }, "required": [ "code", "detail" ], "title": "JobResultExpiredResponse", "type": "object" }, "TTSRequest": { "properties": { "emo_alpha": { "default": 1, "maximum": 1, "minimum": 0, "description": "情绪参考或情绪向量的强度,范围 0–1。当前只有情绪向量允许使用非 1 值。", "title": "Emo Alpha", "type": "number" }, "emo_ref_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Emo Ref Key", "description": "情绪参考 WAV 的引用值,与 emo_asset_id、emo_vector 互斥。通过上传接口登记的情绪参考请使用 emo_asset_id。" }, "model": { "type": "string", "enum": [ "indextts-2", "indextts-2.5" ], "default": "indextts-2", "description": "语音模型 ID。省略时使用 indextts-2。indextts-2.5 需要同时提供 language,并用 emo_text 控制情绪。", "title": "Model" }, "language": { "type": "string", "enum": [ "ZH", "EN", "JA" ], "description": "文本语言,仅 model 为 indextts-2.5 时可用,且必须提供。", "title": "Language" }, "speed": { "type": "number", "minimum": 0.5, "maximum": 2, "default": 1, "description": "语速倍率,仅 model 为 indextts-2.5 时可用,范围 0.5–2。", "title": "Speed" }, "emo_vector": { "anyOf": [ { "items": { "type": "number", "minimum": 0, "maximum": 1.4 }, "type": "array", "minItems": 8, "maxItems": 8 }, { "type": "null" } ], "description": "八维情绪向量,顺序为 happy、angry、sad、afraid、disgusted、melancholic、surprised、calm,每项范围 0–1.4。", "title": "Emo Vector" }, "text": { "maxLength": 2048, "minLength": 1, "description": "要合成的文本。indextts-2 最多 2048 个字符,indextts-2.5 最多 2000 个字符,且必须包含文字或数字。", "title": "Text", "type": "string" }, "voice_asset_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Voice Asset Id", "description": "当前账号拥有的音色资产 ID。与 voice_preset_id、voice_ref_key 互斥。" }, "voice_preset_id": { "anyOf": [ { "type": "string", "pattern": "^vp_[a-f0-9]{24}$" }, { "type": "null" } ], "description": "Preset voice ID from GET /voice-presets. Mutually exclusive with voice_asset_id and voice_ref_key.", "title": "Voice Preset Id" }, "voice_ref_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Voice Ref Key", "description": "声音参考 WAV 的引用值,与 voice_preset_id、voice_asset_id 互斥。通过上传接口登记的声音参考请使用 voice_asset_id。" }, "webhook_endpoint_id": { "anyOf": [ { "type": "string", "pattern": "^whe_[a-f0-9]{32}$" }, { "type": "null" } ], "description": "Registered webhook endpoint to notify when the job succeeds or fails.", "title": "Webhook Endpoint Id" }, "emo_asset_id": { "type": "string", "format": "uuid", "description": "Emotion reference asset ID, uploaded with purpose emotion_reference. Mutually exclusive with emo_ref_key." } }, "required": [ "text" ], "title": "TTSRequest", "type": "object" }, "ServiceUnavailableResponse": { "properties": { "code": { "title": "Code", "type": "string" }, "detail": { "title": "Detail", "type": "string" } }, "required": [ "code", "detail" ], "title": "ServiceUnavailableResponse", "type": "object" }, "UploadUrlRequest": { "properties": { "content_type": { "title": "Content Type", "type": "string", "description": "Must match the filename extension. Supported formats include WAV, MP3, FLAC, M4A, OGG, PNG, JPEG, WebP and MP4, subject to the selected purpose. Video references are limited to 50 MiB, video audio references to 15 MiB, and images and voice WAV files to 20 MiB." }, "filename": { "title": "Filename", "type": "string", "maxLength": 255 }, "display_name": { "maxLength": 80, "title": "Display Name", "type": "string" }, "purpose": { "default": "input", "pattern": "^(input|api_input|voice_reference|emotion_reference|audio_material|image_reference|video_image|video_clip|video_audio)$", "title": "Purpose", "type": "string", "description": "Intended use of the asset: voice_reference, emotion_reference, audio_material, image_reference, video_image, video_clip or video_audio. Generation endpoints accept only assets whose purpose matches the use." }, "rights_confirmed": { "default": false, "description": "Optional explicit rights confirmation. A confirmation timestamp is recorded only when this is supplied as true.", "title": "Rights Confirmed", "type": "boolean" }, "size_bytes": { "type": "integer", "minimum": 1, "maximum": 104857600, "description": "Actual file size in bytes, required for every upload. The uploaded file must match it. Per-purpose limits also apply; audio_material accepts WAV or MP3 up to 100 MiB.", "title": "Size Bytes" } }, "required": [ "filename", "content_type", "size_bytes" ], "title": "UploadUrlRequest", "type": "object" }, "UploadUrlResponse": { "properties": { "asset_id": { "type": "string", "title": "Asset Id" }, "delete_after": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "title": "Delete After", "description": "When this upload is deleted if it has not been confirmed." }, "expires_in": { "title": "Expires In", "type": "integer", "description": "Upload authorization expires after 300 seconds. Complete the upload within one hour." }, "upload_url": { "title": "Upload Url", "type": "string" }, "headers": { "type": "object", "additionalProperties": { "type": "string" }, "description": "Send every returned header unchanged with the PUT request. Content-Length is the declared size; browsers set it automatically." } }, "required": [ "upload_url", "expires_in", "asset_id", "headers", "delete_after" ], "title": "UploadUrlResponse", "type": "object" }, "UploadCompleteResponse": { "properties": { "asset_id": { "title": "Asset Id", "type": "string" }, "uploaded_at": { "format": "date-time", "title": "Uploaded At", "type": "string" }, "retained_until": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "description": "Media retention deadline, or null for permanent retention. Signed URL lifetime is independent." } }, "required": [ "asset_id", "uploaded_at", "retained_until" ], "title": "UploadCompleteResponse", "type": "object" }, "WebhookEndpointResponse": { "type": "object", "title": "WebhookEndpointResponse", "properties": { "id": { "type": "string", "pattern": "^whe_[a-f0-9]{32}$" }, "name": { "type": "string", "maxLength": 120 }, "url": { "type": "string", "format": "uri", "maxLength": 2083 }, "enabled": { "type": "boolean" }, "secret_version": { "type": "integer", "minimum": 1 }, "last_delivery_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "last_success_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "last_failure_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } }, "required": [ "id", "name", "url", "enabled", "secret_version", "created_at", "updated_at" ] }, "WebhookEndpointCreatedResponse": { "allOf": [ { "$ref": "#/components/schemas/WebhookEndpointResponse" }, { "type": "object", "properties": { "signing_secret": { "type": "string", "pattern": "^whsec_" } }, "required": [ "signing_secret" ] } ], "title": "WebhookEndpointCreatedResponse" }, "CreateWebhookEndpointRequest": { "type": "object", "title": "CreateWebhookEndpointRequest", "additionalProperties": false, "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 120 }, "url": { "type": "string", "format": "uri", "minLength": 1, "maxLength": 2083 } }, "required": [ "name", "url" ] }, "UpdateWebhookEndpointRequest": { "type": "object", "title": "UpdateWebhookEndpointRequest", "additionalProperties": false, "minProperties": 1, "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 120 }, "url": { "type": "string", "format": "uri", "minLength": 1, "maxLength": 2083 }, "enabled": { "type": "boolean" } } }, "WebhookActionResponse": { "type": "object", "title": "WebhookActionResponse", "properties": { "delivery_id": { "type": "string" }, "status": { "type": "string", "const": "pending" } }, "required": [ "delivery_id", "status" ] }, "WebhookDeliveryPage": { "type": "object", "title": "WebhookDeliveryPage", "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/WebhookDeliveryResponse" } }, "next_cursor": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "items" ] }, "WebhookDeliveryResponse": { "type": "object", "title": "WebhookDeliveryResponse", "properties": { "id": { "type": "string" }, "event_id": { "type": "string" }, "event_type": { "type": "string", "enum": [ "job.succeeded", "job.failed", "endpoint.test" ] }, "job_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "pending", "processing", "delivered", "failed", "suppressed" ] }, "attempt_count": { "type": "integer", "minimum": 0 }, "last_http_status": { "anyOf": [ { "type": "integer" }, { "type": "null" } ] }, "last_duration_ms": { "anyOf": [ { "type": "integer" }, { "type": "null" } ] }, "next_attempt_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "last_attempt_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "delivered_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "last_error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "created_at": { "type": "string", "format": "date-time" } }, "required": [ "id", "event_id", "event_type", "status", "attempt_count", "created_at" ] }, "VideoConfiguration": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "available": { "type": "boolean" }, "available_resolutions": { "type": "array", "items": { "type": "string", "enum": [ "768p", "2k" ] } }, "message": { "type": "string" }, "billing": { "$ref": "#/components/schemas/VideoBillingSettings" }, "available_modes": { "type": "array", "items": { "type": "string", "enum": [ "t2va", "fl2va", "ref2va" ] } }, "models": { "type": "array", "items": { "$ref": "#/components/schemas/VideoModel" } } }, "required": [ "enabled", "available", "available_resolutions", "message", "billing", "available_modes" ] }, "VideoBillingSettings": { "type": "object", "properties": { "credits_per_second": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "version": { "type": "integer" }, "updated_at": { "type": "string", "format": "date-time" }, "rates": { "type": "array", "items": { "$ref": "#/components/schemas/VideoRate" } }, "official_enabled": { "type": "object", "additionalProperties": { "type": "boolean" } } }, "required": [ "credits_per_second", "version", "updated_at" ] }, "VideoRate": { "type": "object", "properties": { "model": { "type": "string", "description": "模型 ID。", "enum": [ "minmax-h3-flash", "minmax-h3-pro", "wan3.0-video", "seedance-2.0", "seedance-2.5", "seedance-2.5-flash", "kling-4.0", "seedance-2.0-mini", "seedance-2.0-fast" ] }, "resolution": { "type": "string", "description": "该模型的输出清晰度。", "enum": [ "768p", "2k", "480p", "720p", "1080p", "4k" ] }, "credits_per_second": { "description": "按输出秒数计费的积分。Token 计费模型返回 null。", "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "input_video_credits_per_second": { "description": "带参考视频时按输入视频秒数计费的积分。", "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "credits_per_million_tokens": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "description": "Credits per million generated video tokens for requests without video input." }, "credits_per_million_tokens_with_video": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "description": "Credits per million billable tokens for requests with video input." } }, "required": [ "model", "resolution", "credits_per_second" ] }, "VideoModel": { "type": "object", "properties": { "id": { "type": "string", "description": "模型 ID,用于 VideoRequest.model。" }, "name": { "type": "string", "description": "模型显示名称。" }, "modes": { "type": "array", "description": "模型支持的生成模式。", "items": { "type": "string", "enum": [ "t2va", "fl2va", "ref2va" ] } }, "ratios": { "type": "array", "description": "模型支持的输出画幅。", "items": { "type": "string" } }, "min_duration": { "type": "integer", "description": "单个输出允许的最短时长,单位为秒。" }, "max_duration": { "type": "integer", "description": "单个输出允许的最长时长,单位为秒。" }, "max_prompt_chars": { "type": "integer", "description": "提示词最大字符数。" }, "supports_seed": { "type": "boolean", "description": "是否接受 VideoRequest.seed。" }, "style_presets": { "type": "array", "description": "模型允许提交的风格预设值。", "items": { "type": "string" } }, "available": { "type": "boolean", "description": "模型当前是否可以提交。" }, "available_resolutions": { "type": "array", "description": "当前可以提交的清晰度。", "items": { "type": "string" } }, "rates": { "type": "array", "description": "该模型的费率列表。列表中的规格不一定都可提交,以 available_resolutions 为准。", "items": { "$ref": "#/components/schemas/VideoRate" } }, "max_images": { "type": "integer", "description": "最多可提交的图片参考数量。", "minimum": 0 }, "max_videos": { "type": "integer", "description": "最多可提交的视频参考数量。", "minimum": 0 }, "max_audios": { "type": "integer", "description": "最多可提交的音频参考数量。", "minimum": 0 }, "max_references": { "type": "integer", "description": "参考素材总数上限。", "minimum": 0 }, "resolutions": { "type": "array", "description": "模型支持的全部清晰度;当前可以提交的清晰度见 available_resolutions。", "items": { "type": "string" } }, "supports_generate_audio": { "type": "boolean", "description": "是否支持请求中控制生成音频。" }, "supports_audio_only": { "type": "boolean", "description": "是否允许仅使用音频参考素材。" }, "keyframe_adaptive_only": { "type": "boolean", "description": "首尾帧模式是否必须使用 adaptive 画幅。" }, "min_clip_seconds": { "type": "integer", "description": "参考视频片段的最短时长,单位为秒。" }, "max_clip_seconds": { "type": "integer", "description": "参考视频片段的最长时长,单位为秒。" }, "max_combined_seconds": { "type": "integer", "description": "多个参考视频合计时长上限,单位为秒。" } }, "required": [ "id", "name", "modes", "ratios", "min_duration", "max_duration", "max_prompt_chars", "supports_seed", "style_presets", "available", "available_resolutions", "rates", "max_images", "max_videos", "max_audios", "max_references" ] }, "VideoRequest": { "type": "object", "properties": { "mode": { "type": "string", "description": "生成模式。t2va 为文生视频,fl2va 使用首帧和尾帧,ref2va 使用多模态参考素材。", "enum": [ "t2va", "fl2va", "ref2va" ] }, "prompt": { "type": "string", "description": "视频提示词。可使用请求中已登记的 Picture、Video 和 Audio 引用标记。", "minLength": 1, "maxLength": 20000 }, "duration": { "type": "integer", "description": "输出时长,具体范围由 GET /v1/video/config 返回的模型能力决定。", "minimum": 1, "maximum": 30, "default": 5 }, "ratio": { "type": "string", "description": "输出画幅。部分模型的首尾帧请求必须使用 adaptive,以 GET /v1/video/config 为准。", "enum": [ "16:9", "9:16", "1:1", "4:3", "3:4", "21:9", "adaptive" ] }, "seed": { "type": "integer", "description": "可选的非负随机种子,用于需要稳定结果的请求。", "minimum": 0, "maximum": 2147483647 }, "references": { "type": "array", "description": "有序参考素材。kind 为 image、video 或 audio,role 为 reference、first 或 last。", "maxItems": 50, "items": { "$ref": "#/components/schemas/VideoReference" } }, "resolution": { "type": "string", "description": "输出清晰度。模型支持的实际选项以 GET /v1/video/config 返回为准。", "enum": [ "768p", "2k", "480p", "720p", "1080p", "4k" ], "default": "768p", "title": "Resolution" }, "model": { "type": "string", "description": "视频模型 ID。省略时使用默认模型。提交前应先读取 GET /v1/video/config 并报价。", "enum": [ "minmax-h3-flash", "minmax-h3-pro", "wan3.0-video", "seedance-2.0", "seedance-2.5", "seedance-2.5-flash", "kling-4.0", "seedance-2.0-mini", "seedance-2.0-fast" ] }, "quote_version": { "type": "integer", "description": "报价配置版本。必须与 POST /v1/video/quote 返回的版本一致。", "minimum": 1 }, "style_preset": { "type": "string", "description": "风格预设,仅可传入 GET /v1/video/config 为所选模型返回的 style_presets 中的值;没有可用预设时省略。" }, "voice_bindings": { "type": "array", "description": "将图片素材与声音素材绑定,用于指定角色的画面和声音。", "maxItems": 30, "items": { "$ref": "#/components/schemas/VideoVoiceBinding" } }, "generate_audio": { "type": "boolean", "description": "Whether to generate audio with the video, for models whose supports_generate_audio is true. Defaults to true." }, "quote_id": { "type": "string", "description": "POST /v1/video/quote 返回的报价 ID,绑定本次模型、素材、提示词、时长和清晰度。" } }, "required": [ "mode", "prompt", "duration", "ratio", "references", "resolution" ] }, "VideoReference": { "type": "object", "properties": { "asset_id": { "description": "当前账号拥有且已完成上传的素材 ID。", "type": "string" }, "kind": { "description": "素材类型。image、video 或 audio。", "type": "string", "enum": [ "image", "video", "audio" ] }, "role": { "description": "素材用途。reference 为普通参考,first 和 last 仅用于首尾帧模式。", "type": "string", "enum": [ "reference", "first", "last" ] } }, "required": [ "asset_id", "kind", "role" ] }, "VideoVoiceBinding": { "type": "object", "properties": { "image_asset_id": { "type": "string", "format": "uuid" }, "audio_asset_id": { "type": "string", "format": "uuid" } }, "required": [ "image_asset_id", "audio_asset_id" ] }, "JobCancellationResponse": { "properties": { "job_status": { "anyOf": [ { "$ref": "#/components/schemas/JobStatus" }, { "type": "null" } ] }, "ok": { "default": true, "title": "Ok", "type": "boolean" } }, "title": "JobCancellationResponse", "type": "object" }, "ImageConfiguration": { "properties": { "reference_rates": { "type": "object", "description": "Per-model reference image surcharge in credits. Models absent from this map do not charge for reference images.", "additionalProperties": { "type": "object", "required": [ "credits", "free_images" ], "properties": { "credits": { "type": "number", "minimum": 0 }, "free_images": { "type": "integer", "minimum": 0 } } } }, "max_reference_images": { "type": "object", "description": "Maximum number of input images per model.", "additionalProperties": { "type": "integer", "minimum": 1, "maximum": 10 } }, "available": { "type": "boolean" }, "billing": { "$ref": "#/components/schemas/ImageBillingSettings" }, "enabled": { "type": "boolean" }, "message": { "type": "string" }, "models": { "items": { "enum": [ "doubao-seedream-5-0-pro-260628", "doubao-seedream-5-0-flash-260915", "doubao-seedream-5-5-261028", "sx-image-2.6-sunburst" ], "type": "string" }, "type": "array" }, "sizes": { "items": { "enum": [ "1024x1024", "1536x1024", "1024x1536", "2048x2048", "2048x1152", "1152x2048", "1776x2368", "2368x1776" ], "type": "string" }, "type": "array" } }, "required": [ "enabled", "available", "message", "models", "sizes", "billing" ], "type": "object" }, "ImageBillingSettings": { "properties": { "rates": { "items": { "$ref": "#/components/schemas/ImageRate" }, "type": "array" }, "updated_at": { "format": "date-time", "type": "string" }, "version": { "type": "integer" } }, "required": [ "rates", "version", "updated_at" ], "type": "object" }, "ImageRate": { "properties": { "credits": { "anyOf": [ { "exclusiveMinimum": 0, "maximum": 1000000, "type": "number" }, { "type": "null" } ] }, "model": { "enum": [ "doubao-seedream-5-0-pro-260628", "doubao-seedream-5-0-flash-260915", "doubao-seedream-5-5-261028", "sx-image-2.6-sunburst" ], "type": "string" }, "size": { "enum": [ "1024x1024", "1536x1024", "1024x1536", "2048x2048", "2048x1152", "1152x2048" ], "type": "string" } }, "required": [ "model", "size", "credits" ], "type": "object" }, "ImageRequest": { "properties": { "reference_asset_ids": { "type": "array", "description": "按顺序排列的参考图片素材 ID,与 reference_asset_id 二选一,最多 10 张。", "maxItems": 10, "items": { "type": "string" } }, "mode": { "enum": [ "text-to-image", "image-to-image" ], "description": "生成模式。text-to-image 不接受参考图,image-to-image 至少需要一张参考图。", "type": "string" }, "model": { "enum": [ "doubao-seedream-5-0-pro-260628", "doubao-seedream-5-0-flash-260915", "doubao-seedream-5-5-261028", "sx-image-2.6-sunburst" ], "type": "string", "description": "图片模型 ID。可用模型以 GET /v1/image/config 返回为准。" }, "prompt": { "maxLength": 32000, "minLength": 1, "description": "图片提示词,长度为 1–32000 个字符。", "type": "string" }, "rate_version": { "minimum": 1, "description": "GET /v1/image/config 返回的费率版本,提交时必须保持一致。", "type": "integer" }, "reference_asset_id": { "type": "string", "description": "Asset ID of a single reference image. Use either this field or reference_asset_ids." }, "size": { "enum": [ "1024x1024", "1536x1024", "1024x1536", "2048x2048", "2048x1152", "1152x2048", "1776x2368", "2368x1776" ], "type": "string", "description": "Output dimensions. 1776x2368 and 2368x1776 use the reported 1024x1536 and 1536x1024 rates respectively." } }, "required": [ "mode", "model", "prompt", "size", "rate_version" ], "type": "object" }, "ImageSubmissionRequest": { "properties": { "reference_asset_ids": { "type": "array", "description": "Ordered original reference images for image-to-image. Use either this field or reference_asset_id.", "maxItems": 16, "items": { "type": "string" } }, "mode": { "enum": [ "text-to-image", "image-to-image" ], "type": "string" }, "model": { "type": "string" }, "prompt": { "maxLength": 32000, "minLength": 1, "type": "string" }, "quality": { "type": "string" }, "rate_version": { "minimum": 1, "type": "integer" }, "reference_asset_id": { "type": "string" }, "size": { "type": "string" } }, "required": [ "mode", "model", "prompt", "size", "rate_version" ], "type": "object", "description": "The original image request that received no response. It must match the original request body." }, "VideoQuoteInput": { "type": "object", "properties": { "estimated_reference_seconds": { "type": "number", "minimum": 0, "maximum": 30, "description": "Optional estimate of the reference media length, for an early cost estimate. A quote that uses this field has no quote_id and cannot be used to submit a generation." }, "operation": { "type": "string", "enum": [ "generate" ] }, "request": { "$ref": "#/components/schemas/VideoRequest" } }, "required": [ "operation", "request" ] }, "VideoQuote": { "type": "object", "properties": { "estimated_tokens": { "type": "integer", "description": "Estimated total billable video tokens for a token-priced model." }, "credits_per_million_tokens": { "type": "number", "description": "The token rate selected for this request, in credits per million tokens." }, "model": { "type": "string" }, "resolution": { "type": "string" }, "billable_seconds": { "type": "number" }, "credits_per_second": { "type": "number" }, "credits": { "type": "number" }, "rate_version": { "type": "integer" }, "quote_id": { "type": "string" }, "input_video_seconds": { "type": "number" }, "output_credits": { "type": "number" }, "input_video_credits": { "type": "number" } }, "required": [ "model", "resolution", "billable_seconds", "credits_per_second", "credits", "rate_version" ] }, "VoiceDesignConfiguration": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "available": { "type": "boolean" }, "model": { "type": "string", "description": "百炼音色设计和试听合成使用的模型。" }, "languages": { "type": "array", "items": { "type": "string", "enum": [ "zh", "en", "ja", "ko" ] }, "description": "当前已配置并可连接的音色设计语种。提交前同时检查 available。" }, "message": { "type": "string" }, "billing": { "$ref": "#/components/schemas/VoiceDesignBilling" } }, "required": [ "enabled", "available", "model", "billing" ] }, "VoiceDesignBilling": { "type": "object", "properties": { "credits": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "version": { "type": "integer", "format": "int64" }, "updated_at": { "type": "string", "format": "date-time" } }, "required": [ "credits", "version", "updated_at" ] }, "VoiceDesignRequest": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 80, "description": "候选音色名称,1–80 个字符。" }, "description": { "type": "string", "minLength": 1, "maxLength": 500, "description": "声音特征描述,1–500 个字符。" }, "preview_text": { "type": "string", "minLength": 15, "maxLength": 200, "description": "用于试听候选音色的文本,15–200 个字符。" }, "language": { "type": "string", "enum": [ "zh", "en", "ja", "ko" ], "description": "候选音色语言。可用语种以音色设计配置返回的 languages 为准。" }, "quote_version": { "type": "integer", "format": "int64", "description": "Billing version from GET /v1/voice-design/config. A mismatch returns 409 before any credits are reserved." } }, "required": [ "name", "description", "preview_text", "language" ] }, "AudioCompositionQuote": { "type": "object", "properties": { "credits": { "type": "number" }, "estimated": { "type": "boolean" }, "segments": { "type": "integer" } }, "additionalProperties": false, "required": [ "credits", "estimated", "segments" ] }, "AudioCompositionRequest": { "type": "object", "properties": { "model": { "type": "string", "enum": [ "indextts-2", "indextts-2.5" ], "default": "indextts-2", "description": "语音模型 ID。省略时使用 indextts-2。indextts-2.5 需要同时提供 language,使用 voice_preset_id 或 voice_asset_id 选择音色,并用 emo_text 控制情绪。" }, "speed": { "type": "number", "minimum": 0.5, "maximum": 2, "default": 1, "description": "语速倍率,仅 model 为 indextts-2.5 时可用,范围 0.5–2。" }, "prompt_document": { "$ref": "#/components/schemas/PromptDocument", "description": "可选的 v1 结构化时间轴文档。省略时根据 text 解析简单时间轴。" }, "text": { "type": "string", "description": "台词文本。使用 prompt_document 时,建议同时提供与文档一致的文本。" }, "voice_preset_id": { "type": "string", "description": "默认人声音色预置 ID,与 voice_asset_id、voice_ref_key 互斥。" }, "voice_asset_id": { "type": "string", "description": "默认人声音色资产 ID,与 voice_preset_id、voice_ref_key 互斥。" }, "emo_asset_id": { "type": "string", "description": "默认情绪参考素材 ID,与 emo_ref_key、emo_vector 互斥。" }, "voice_ref_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Voice Ref Key", "description": "默认人声的声音参考引用值。model 为 indextts-2.5 时不支持该字段,请使用 voice_asset_id。" }, "emo_ref_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Emo Ref Key", "description": "默认人声的情绪参考 WAV 引用值,与 emo_asset_id、emo_vector 互斥。" }, "emo_alpha": { "default": 1, "maximum": 1, "minimum": 0, "description": "情绪参考或向量强度,范围 0–1。", "title": "Emo Alpha", "type": "number" }, "emo_vector": { "anyOf": [ { "items": { "type": "number", "minimum": 0, "maximum": 1.4 }, "type": "array", "minItems": 8, "maxItems": 8 }, { "type": "null" } ], "description": "八维情绪向量,顺序为 happy、angry、sad、afraid、disgusted、melancholic、surprised、calm。", "title": "Emo Vector" } }, "additionalProperties": false, "required": [ "text" ] }, "PromptDocument": { "type": "object", "properties": { "version": { "type": "integer", "const": 1 }, "parts": { "type": "array", "maxItems": 2048, "items": { "$ref": "#/components/schemas/PromptPart" } } }, "additionalProperties": false, "required": [ "version", "parts" ] }, "PromptPart": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "additionalProperties": false, "required": [ "type", "text" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "reference" }, "reference_id": { "type": "string", "format": "uuid" }, "label": { "type": "string", "maxLength": 240 } }, "additionalProperties": false, "required": [ "type", "reference_id", "label" ] } ] }, "VideoUpscaleConfiguration": { "type": "object", "required": [ "available", "presets", "reason" ], "properties": { "available": { "type": "boolean" }, "reason": { "type": "string" }, "presets": { "type": "array", "items": { "type": "object", "required": [ "id", "credits_per_second" ], "properties": { "id": { "type": "string", "enum": [ "1080p", "2k", "4k" ] }, "credits_per_second": { "type": "number" } } } } } }, "VideoUpscaleRequest": { "type": "object", "required": [ "preset" ], "properties": { "source_job_id": { "type": "string" }, "source_asset_id": { "type": "string" }, "preset": { "type": "string", "enum": [ "1080p", "2k", "4k" ] } }, "description": "Exactly one owned generated job or uploaded MP4 source; immutable source and tier are bound to Idempotency-Key." } }, "securitySchemes": { "APIKeyHeader": { "in": "header", "name": "X-API-Key", "type": "apiKey" }, "APIKeyBearer": { "type": "http", "scheme": "bearer", "bearerFormat": "APIKey", "description": "API Key sent as Authorization: Bearer. This is not a console login credential." }, "HTTPBearer": { "scheme": "bearer", "type": "http", "description": "Console login credential sent as Authorization: Bearer." } } } }