Get Prediction
curl --request GET \
--url https://api.shuyou.ai/v1/predictions/{prediction_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.shuyou.ai/v1/predictions/{prediction_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.shuyou.ai/v1/predictions/{prediction_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"code": "0",
"usage": {
"upstream_cost": 0.039,
"discount": 0.00975,
"discount_percent": 0.75,
"cost": 0.02925
},
"data": {
"task_id": "fa746cb19082452b82fea4f496f4065a",
"task_status": "success",
"output": [
{
"type": "image",
"image": "https://cdn.shuyou.ai/model/20a60c33ba954d85a669ee0f24da8e38.png?e=1778427598&token=Lk3Kb36M3K8oq2d5pU6CaYyoud2Au-APFP-ThE8B:cZUtU2t4yclXCeW0X3j0gJ8Oc58="
}
]
},
"request_id": "8bd6b5784a1e42b79bf172607f476f56"
}
Task Management
Get Prediction
Poll an asynchronous prediction task by task_id via GET /v1/predictions/.
GET
/
v1
/
predictions
/
{prediction_id}
Get Prediction
curl --request GET \
--url https://api.shuyou.ai/v1/predictions/{prediction_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.shuyou.ai/v1/predictions/{prediction_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.shuyou.ai/v1/predictions/{prediction_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"code": "0",
"usage": {
"upstream_cost": 0.039,
"discount": 0.00975,
"discount_percent": 0.75,
"cost": 0.02925
},
"data": {
"task_id": "fa746cb19082452b82fea4f496f4065a",
"task_status": "success",
"output": [
{
"type": "image",
"image": "https://cdn.shuyou.ai/model/20a60c33ba954d85a669ee0f24da8e38.png?e=1778427598&token=Lk3Kb36M3K8oq2d5pU6CaYyoud2Au-APFP-ThE8B:cZUtU2t4yclXCeW0X3j0gJ8Oc58="
}
]
},
"request_id": "8bd6b5784a1e42b79bf172607f476f56"
}
Use the
data.task_id returned from Create Prediction as the path parameter prediction_id.
Response fields
| Field | Type | Description |
|---|---|---|
code | string | Response status code. "0" indicates success. |
usage | object | Billing summary. May be omitted while the task is still processing. |
usage.upstream_cost | number | Upstream cost before discount (USD). |
usage.discount | number | Discount amount (USD). |
usage.discount_percent | number | Discount rate as a decimal (e.g. 0.75 = 75% off). |
usage.cost | number | Final billed cost after discount (USD). |
data.task_id | string | Async task ID. |
data.task_status | string | Task status, e.g. processing, success, or failed. |
data.output | array | Generated outputs when the task succeeds. |
data.output[].type | string | Output media type, e.g. image or video. |
data.output[].image | string | Image URL when type is image. URLs may be time-limited. |
request_id | string | Unique request identifier for support and debugging. |
{
"code": "0",
"usage": {
"upstream_cost": 0.039,
"discount": 0.00975,
"discount_percent": 0.75,
"cost": 0.02925
},
"data": {
"task_id": "fa746cb19082452b82fea4f496f4065a",
"task_status": "success",
"output": [
{
"type": "image",
"image": "https://cdn.shuyou.ai/model/20a60c33ba954d85a669ee0f24da8e38.png?e=1778427598&token=Lk3Kb36M3K8oq2d5pU6CaYyoud2Au-APFP-ThE8B:cZUtU2t4yclXCeW0X3j0gJ8Oc58="
}
]
},
"request_id": "8bd6b5784a1e42b79bf172607f476f56"
}
Authorizations
Authorization: Bearer YOUR_API_KEY
Path Parameters
Task ID (data.task_id) returned when the prediction was created.
Response
Prediction detail
Response status code. "0" indicates success.
Example:
"0"
Show child attributes
Show child attributes
Unique request identifier for support and debugging.
Example:
"8bd6b5784a1e42b79bf172607f476f56"
Billing summary for the prediction. May be omitted while the task is still processing.
Show child attributes
Show child attributes