Skip to content

Get a media generation task

GEThttps://gptunnel.ru/api/v2/media/tasks/:id

Returns the task by ID. Poll until the status is done or failed, or receive the result through a webhook.

Path parameters

ParameterTypeDescription
id*stringIdentifier from the creation response, 24 characters

Set GPTUNNEL_API_KEY to your API key and TASK_ID to the id field from the task creation response.

import json
import os
from urllib.request import Request, urlopen
task_id = os.environ['TASK_ID']
url = f'https://gptunnel.ru/api/v2/media/tasks/{task_id}'
request = Request(url, headers={'Authorization': os.environ['GPTUNNEL_API_KEY']})
with urlopen(request, timeout=30) as response:
print(json.load(response)['status'])
{
"code": 0,
"id": "6a61e021a6e77553a989c41d",
"model": "kling-v3",
"status": "done",
"prompt": "a red fox running through snow, cinematic",
"params": { "resolution": "1080p", "duration": 5, "aspect_ratio": "16:9" },
"price": 210,
"result": [
{ "url": "https://cdn.gptunnel.com/predication/6a61e021a6e77553a989c41d_result.mp4" }
],
"created_at": 1784799265
}

Example of response (music, multiple tracks)

Section titled “Example of response (music, multiple tracks)”
{
"code": 0,
"id": "6a61e021a6e77553a989c41e",
"model": "suno",
"status": "done",
"prompt": "lo-fi beat for late night coding",
"price": 16.8,
"result": [
{
"url": "https://cdn.gptunnel.com/suno/..._1.mp3",
"id": "9f2c1b7a-...",
"cover_url": "https://cdn.gptunnel.com/suno/..._1.jpg",
"duration": 128,
"title": "Late Night Compile",
"lyric": "[Verse]\n...",
"tags": "lo-fi, mellow, rainy"
},
{
"url": "https://cdn.gptunnel.com/suno/..._2.mp3",
"id": "4d81ea03-...",
"cover_url": "https://cdn.gptunnel.com/suno/..._2.jpg",
"duration": 131,
"title": "Late Night Compile",
"tags": "lo-fi, mellow, rainy"
}
],
"created_at": 1784799265
}

Suno returns two tracks for each task in result. The id field identifies each track at the provider.

{
"code": 0,
"id": "6a61e021a6e77553a989c41d",
"model": "kling-v3",
"status": "failed",
"error": { "code": 1001, "title": "SENSITIVE_CONTENT", "message": "Sensitive content has been detected in your request or uploaded files. Please check the text and media and try again." },
"result": [],
"created_at": 1784799265
}
ParameterTypeDescription
id*stringTask Identifier
modelstringID of the requested model. If a retired model was replaced, this remains the ID you originally sent. The x-model-served header in the task creation response identifies the model that ran it.
status*stringqueued | running | done | failed
paramsobjectGeneration parameters applied to the task
pricenumberAmount charged in rubles
result*arrayArray of results when status is done. Otherwise it is empty. Each item has a url. Models that produce multiple files return items in the order they become available. Music items also include id, cover_url, duration, title, lyric and tags.
errorobjectFailure details when status is failed. Use code as a stable value when handling failures. The title field gives a machine-readable reason that can be more specific than code. The message field is a human-readable description.
webhookobjectPresent if the creation request included webhook_url. The url field is the recipient URL. The status is pending, delivered, or failed.
trace_idstringTrace ID, if available. Include it with the task id when contacting support.
created_atnumberTime of creation (Unix, seconds)