Grok 任务查询
curl --request GET \
--url https://www.geeknow.top/v1/videos/{task_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"task_id": "<string>"
}
'import requests
url = "https://www.geeknow.top/v1/videos/{task_id}"
payload = { "task_id": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({task_id: '<string>'})
};
fetch('https://www.geeknow.top/v1/videos/{task_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.geeknow.top/v1/videos/{task_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'task_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.geeknow.top/v1/videos/{task_id}"
payload := strings.NewReader("{\n \"task_id\": \"<string>\"\n}")
req, _ := http.NewRequest("GET", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://www.geeknow.top/v1/videos/{task_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"task_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.geeknow.top/v1/videos/{task_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"task_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "video_abc123",
"object": "video",
"model": "grok-imagine-video",
"status": "processing",
"progress": 42,
"created_at": 1735689600,
"completed_at": 0,
"expires_at": 1735776000,
"seconds": "10",
"size": "720P",
"remixed_from_video_id": "",
"error": {
"message": "",
"code": ""
},
"video_url": ""
}
{
"id": "task_abc123",
"object": "video",
"model": "grok-imagine-video-1.5",
"status": "completed",
"progress": 100,
"created_at": 1735689600,
"completed_at": 1735689900,
"expires_at": 1735776000,
"seconds": "10",
"size": "720P",
"remixed_from_video_id": "",
"error": {
"message": "",
"code": ""
},
"video_url": "https://example.com/video.mp4"
}
{
"id": "video_abc123",
"object": "video",
"model": "grok-imagine-video-1.5-preview",
"status": "failed",
"progress": 100,
"created_at": 1735689600,
"completed_at": 1735689700,
"expires_at": 1735776000,
"seconds": "10",
"size": "720P",
"remixed_from_video_id": "",
"error": {
"message": "Content policy violation",
"code": "content_policy"
},
"video_url": ""
}
Grok 视频
Grok 任务查询
使用 GET /v1/videos/{task_id} 查询 Grok 视频任务进度、结果与错误信息。
GET
https://www.geeknow.top
/
v1
/
videos
/
{task_id}
Grok 任务查询
curl --request GET \
--url https://www.geeknow.top/v1/videos/{task_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"task_id": "<string>"
}
'import requests
url = "https://www.geeknow.top/v1/videos/{task_id}"
payload = { "task_id": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({task_id: '<string>'})
};
fetch('https://www.geeknow.top/v1/videos/{task_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.geeknow.top/v1/videos/{task_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'task_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.geeknow.top/v1/videos/{task_id}"
payload := strings.NewReader("{\n \"task_id\": \"<string>\"\n}")
req, _ := http.NewRequest("GET", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://www.geeknow.top/v1/videos/{task_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"task_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.geeknow.top/v1/videos/{task_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"task_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "video_abc123",
"object": "video",
"model": "grok-imagine-video",
"status": "processing",
"progress": 42,
"created_at": 1735689600,
"completed_at": 0,
"expires_at": 1735776000,
"seconds": "10",
"size": "720P",
"remixed_from_video_id": "",
"error": {
"message": "",
"code": ""
},
"video_url": ""
}
{
"id": "task_abc123",
"object": "video",
"model": "grok-imagine-video-1.5",
"status": "completed",
"progress": 100,
"created_at": 1735689600,
"completed_at": 1735689900,
"expires_at": 1735776000,
"seconds": "10",
"size": "720P",
"remixed_from_video_id": "",
"error": {
"message": "",
"code": ""
},
"video_url": "https://example.com/video.mp4"
}
{
"id": "video_abc123",
"object": "video",
"model": "grok-imagine-video-1.5-preview",
"status": "failed",
"progress": 100,
"created_at": 1735689600,
"completed_at": 1735689700,
"expires_at": 1735776000,
"seconds": "10",
"size": "720P",
"remixed_from_video_id": "",
"error": {
"message": "Content policy violation",
"code": "content_policy"
},
"video_url": ""
}
Grok 任务查询
Grok Imagine 系列任务提交后,通过GET /v1/videos/{task_id} 轮询状态,并共用同一组查询与下载接口。
- 接口路径是
GET /v1/videos/{task_id}。 - 任务完成后,优先从响应中的视频 URL 字段读取结果地址。
- 如果响应没有公开 URL,或直接下载公开 URL 失败,可回退到
GET /v1/videos/{task_id}/content。 /content端点需要携带同一个Authorization: Bearer YOUR_API_KEY。
方法与路径
GET /v1/videos/{task_id}
请求示例
curl https://www.geeknow.top/v1/videos/video_abc123 \
-H "Authorization: Bearer YOUR_API_KEY"
import requests
resp = requests.get(
"https://www.geeknow.top/v1/videos/video_abc123",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=30,
)
print(resp.json())
const response = await fetch("https://www.geeknow.top/v1/videos/video_abc123", {
headers: {
Authorization: "Bearer YOUR_API_KEY",
},
});
console.log(await response.json());
响应示例
{
"id": "video_abc123",
"object": "video",
"model": "grok-imagine-video",
"status": "processing",
"progress": 42,
"created_at": 1735689600,
"completed_at": 0,
"expires_at": 1735776000,
"seconds": "10",
"size": "720P",
"remixed_from_video_id": "",
"error": {
"message": "",
"code": ""
},
"video_url": ""
}
{
"id": "task_abc123",
"object": "video",
"model": "grok-imagine-video-1.5",
"status": "completed",
"progress": 100,
"created_at": 1735689600,
"completed_at": 1735689900,
"expires_at": 1735776000,
"seconds": "10",
"size": "720P",
"remixed_from_video_id": "",
"error": {
"message": "",
"code": ""
},
"video_url": "https://example.com/video.mp4"
}
{
"id": "video_abc123",
"object": "video",
"model": "grok-imagine-video-1.5-preview",
"status": "failed",
"progress": 100,
"created_at": 1735689600,
"completed_at": 1735689700,
"expires_at": 1735776000,
"seconds": "10",
"size": "720P",
"remixed_from_video_id": "",
"error": {
"message": "Content policy violation",
"code": "content_policy"
},
"video_url": ""
}
认证
Authorization: Bearer YOUR_API_KEY
Path Parameters
视频任务 ID。
Response
任务 ID。
任务状态。常见值有
processing、failed、completed。任务对应的模型名。该字段用于展示和排查,不应用作任务 ID。
进度百分比。
完成时间戳。
结果过期时间戳。
输出时长。
输出清晰度档位。
视频地址。完成时通常可直接下载;如果为空或不可下载,按下方兼容顺序读取其他字段,或回退到
/content。失败原因对象。
轮询建议
建议客户端将以下状态视为处理中并继续轮询:queued、pending、processing、in_progress、running、generating。
建议将以下状态视为完成:completed、succeeded、success。
建议将以下状态视为失败或终止:failed、fail、error、cancelled、canceled、expired、deleted。
任务完成后,结果地址可按以下兼容顺序读取:
content.video_urlcontent.urloutput.urlvideo_urlurldetail.urldata[0].url
GET /v1/videos/{task_id}/content
/content 时需要继续携带鉴权头:
curl https://www.geeknow.top/v1/videos/video_abc123/content \
-H "Authorization: Bearer YOUR_API_KEY" \
--output result.mp4
相关接口
⌘I