Poll Kling tasks submitted on the native pass-through.
curl --request GET \
--url https://api.comfy.org/v2/native/kling/tasks \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.comfy.org/v2/native/kling/tasks"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.comfy.org/v2/native/kling/tasks', 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://api.comfy.org/v2/native/kling/tasks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.comfy.org/v2/native/kling/tasks"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.comfy.org/v2/native/kling/tasks")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.comfy.org/v2/native/kling/tasks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"code": 123,
"message": "<string>",
"request_id": "<string>",
"data": [
{
"id": "<string>",
"status": "<string>",
"message": "<string>",
"create_time": 123,
"update_time": 123,
"external_id": "<string>",
"outputs": [
{
"type": "<string>",
"id": "<string>",
"url": "<string>",
"watermark_url": "<string>",
"duration": "<string>",
"group_id": "<string>",
"mp3_url": "<string>",
"wav_url": "<string>",
"mp3_duration": "<string>",
"wav_duration": "<string>",
"name": "<string>",
"owned_by": "<string>",
"status": "<string>"
}
],
"billing": [
{
"charge_type": "<string>",
"amount": "<string>",
"package_type": "<string>",
"list_price": "<string>",
"cash_type": "<string>",
"currency": "<string>"
}
]
}
]
}{
"detail": "<string>",
"error_type": "invalid_input",
"upstream_detail": "<string>",
"refusal_subject": "<string>",
"budget": {
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
},
"blocking_budgets": [
{
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
}
],
"denied_reason": "<string>",
"billed_workspace": {
"type": "<string>",
"id": "<string>",
"rail": "<string>"
},
"credential_kind": "<string>"
}{
"detail": "<string>",
"error_type": "invalid_input",
"upstream_detail": "<string>",
"refusal_subject": "<string>",
"budget": {
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
},
"blocking_budgets": [
{
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
}
],
"denied_reason": "<string>",
"billed_workspace": {
"type": "<string>",
"id": "<string>",
"rail": "<string>"
},
"credential_kind": "<string>"
}{
"detail": "<string>",
"error_type": "invalid_input",
"upstream_detail": "<string>",
"refusal_subject": "<string>",
"budget": {
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
},
"blocking_budgets": [
{
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
}
],
"denied_reason": "<string>",
"billed_workspace": {
"type": "<string>",
"id": "<string>",
"rail": "<string>"
},
"credential_kind": "<string>"
}{
"detail": "<string>",
"error_type": "invalid_input",
"upstream_detail": "<string>",
"refusal_subject": "<string>",
"budget": {
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
},
"blocking_budgets": [
{
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
}
],
"denied_reason": "<string>",
"billed_workspace": {
"type": "<string>",
"id": "<string>",
"rail": "<string>"
},
"credential_kind": "<string>"
}{
"detail": "<string>",
"error_type": "invalid_input",
"upstream_detail": "<string>",
"refusal_subject": "<string>",
"budget": {
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
},
"blocking_budgets": [
{
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
}
],
"denied_reason": "<string>",
"billed_workspace": {
"type": "<string>",
"id": "<string>",
"rail": "<string>"
},
"credential_kind": "<string>"
}{
"detail": "<string>",
"error_type": "invalid_input",
"upstream_detail": "<string>",
"refusal_subject": "<string>",
"budget": {
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
},
"blocking_budgets": [
{
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
}
],
"denied_reason": "<string>",
"billed_workspace": {
"type": "<string>",
"id": "<string>",
"rail": "<string>"
},
"credential_kind": "<string>"
}{
"detail": "<string>",
"error_type": "invalid_input",
"upstream_detail": "<string>",
"refusal_subject": "<string>",
"budget": {
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
},
"blocking_budgets": [
{
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
}
],
"denied_reason": "<string>",
"billed_workspace": {
"type": "<string>",
"id": "<string>",
"rail": "<string>"
},
"credential_kind": "<string>"
}{
"detail": "<string>",
"error_type": "invalid_input",
"upstream_detail": "<string>",
"refusal_subject": "<string>",
"budget": {
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
},
"blocking_budgets": [
{
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
}
],
"denied_reason": "<string>",
"billed_workspace": {
"type": "<string>",
"id": "<string>",
"rail": "<string>"
},
"credential_kind": "<string>"
}Comfy Router
Poll Kling tasks submitted on the native pass-through.
Polls tasks submitted on /v2/native/kling/... and answers in Kling’s own query response shape. Pass the task ids the submits returned (data.id) in task_ids; a task can only be polled by the account that submitted it, and only here. external_task_ids is refused, because external_task_id is never forwarded on submit. When the poll returns a task finished, X-Comfy-Credits-Used carries the credits Comfy charges for it at the Kling 4.0 Router list price. It is absent whenever no cost is reported (an unfinished task, for one), and absent means “not reported”, not “free”. This pass-through is enabled per workspace; where it is not enabled the route answers 404.
GET
/
v2
/
native
/
kling
/
tasks
Poll Kling tasks submitted on the native pass-through.
curl --request GET \
--url https://api.comfy.org/v2/native/kling/tasks \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.comfy.org/v2/native/kling/tasks"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.comfy.org/v2/native/kling/tasks', 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://api.comfy.org/v2/native/kling/tasks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.comfy.org/v2/native/kling/tasks"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.comfy.org/v2/native/kling/tasks")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.comfy.org/v2/native/kling/tasks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"code": 123,
"message": "<string>",
"request_id": "<string>",
"data": [
{
"id": "<string>",
"status": "<string>",
"message": "<string>",
"create_time": 123,
"update_time": 123,
"external_id": "<string>",
"outputs": [
{
"type": "<string>",
"id": "<string>",
"url": "<string>",
"watermark_url": "<string>",
"duration": "<string>",
"group_id": "<string>",
"mp3_url": "<string>",
"wav_url": "<string>",
"mp3_duration": "<string>",
"wav_duration": "<string>",
"name": "<string>",
"owned_by": "<string>",
"status": "<string>"
}
],
"billing": [
{
"charge_type": "<string>",
"amount": "<string>",
"package_type": "<string>",
"list_price": "<string>",
"cash_type": "<string>",
"currency": "<string>"
}
]
}
]
}{
"detail": "<string>",
"error_type": "invalid_input",
"upstream_detail": "<string>",
"refusal_subject": "<string>",
"budget": {
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
},
"blocking_budgets": [
{
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
}
],
"denied_reason": "<string>",
"billed_workspace": {
"type": "<string>",
"id": "<string>",
"rail": "<string>"
},
"credential_kind": "<string>"
}{
"detail": "<string>",
"error_type": "invalid_input",
"upstream_detail": "<string>",
"refusal_subject": "<string>",
"budget": {
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
},
"blocking_budgets": [
{
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
}
],
"denied_reason": "<string>",
"billed_workspace": {
"type": "<string>",
"id": "<string>",
"rail": "<string>"
},
"credential_kind": "<string>"
}{
"detail": "<string>",
"error_type": "invalid_input",
"upstream_detail": "<string>",
"refusal_subject": "<string>",
"budget": {
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
},
"blocking_budgets": [
{
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
}
],
"denied_reason": "<string>",
"billed_workspace": {
"type": "<string>",
"id": "<string>",
"rail": "<string>"
},
"credential_kind": "<string>"
}{
"detail": "<string>",
"error_type": "invalid_input",
"upstream_detail": "<string>",
"refusal_subject": "<string>",
"budget": {
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
},
"blocking_budgets": [
{
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
}
],
"denied_reason": "<string>",
"billed_workspace": {
"type": "<string>",
"id": "<string>",
"rail": "<string>"
},
"credential_kind": "<string>"
}{
"detail": "<string>",
"error_type": "invalid_input",
"upstream_detail": "<string>",
"refusal_subject": "<string>",
"budget": {
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
},
"blocking_budgets": [
{
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
}
],
"denied_reason": "<string>",
"billed_workspace": {
"type": "<string>",
"id": "<string>",
"rail": "<string>"
},
"credential_kind": "<string>"
}{
"detail": "<string>",
"error_type": "invalid_input",
"upstream_detail": "<string>",
"refusal_subject": "<string>",
"budget": {
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
},
"blocking_budgets": [
{
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
}
],
"denied_reason": "<string>",
"billed_workspace": {
"type": "<string>",
"id": "<string>",
"rail": "<string>"
},
"credential_kind": "<string>"
}{
"detail": "<string>",
"error_type": "invalid_input",
"upstream_detail": "<string>",
"refusal_subject": "<string>",
"budget": {
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
},
"blocking_budgets": [
{
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
}
],
"denied_reason": "<string>",
"billed_workspace": {
"type": "<string>",
"id": "<string>",
"rail": "<string>"
},
"credential_kind": "<string>"
}{
"detail": "<string>",
"error_type": "invalid_input",
"upstream_detail": "<string>",
"refusal_subject": "<string>",
"budget": {
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
},
"blocking_budgets": [
{
"scope_kind": "<string>",
"resets_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"id": "<string>",
"scope_id": "<string>",
"mode": "<string>",
"limit_micro_usd": 123,
"spent_micro_usd": 123,
"limit_credits": 123,
"spent_credits": 123
}
],
"denied_reason": "<string>",
"billed_workspace": {
"type": "<string>",
"id": "<string>",
"rail": "<string>"
},
"credential_kind": "<string>"
}인증
BearerAuthApiKeyAuth