查询对话账单
curl --request GET \
--url https://geekai.co/api/chat/transaction/{uuid} \
--header 'Authorization: Bearer <token>'import requests
url = "https://geekai.co/api/chat/transaction/{uuid}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://geekai.co/api/chat/transaction/{uuid}', 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://geekai.co/api/chat/transaction/{uuid}",
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://geekai.co/api/chat/transaction/{uuid}"
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://geekai.co/api/chat/transaction/{uuid}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://geekai.co/api/chat/transaction/{uuid}")
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{
"request_id": "<string>",
"amount": 123,
"tokens": 123,
"input_tokens": 123,
"output_tokens": 123,
"cache_hit_tokens": 123,
"cache_write_tokens": 123,
"billed_units": 123,
"times": 123,
"event": "<string>",
"channel": "<string>",
"discount": 123
}{
"code": "unauthorized",
"message": "Invalid API key or token"
}{
"code": "invalid_request",
"message": "请求参数不合法"
}账单信息
查询对话账单
GET
/
chat
/
transaction
/
{uuid}
查询对话账单
curl --request GET \
--url https://geekai.co/api/chat/transaction/{uuid} \
--header 'Authorization: Bearer <token>'import requests
url = "https://geekai.co/api/chat/transaction/{uuid}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://geekai.co/api/chat/transaction/{uuid}', 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://geekai.co/api/chat/transaction/{uuid}",
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://geekai.co/api/chat/transaction/{uuid}"
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://geekai.co/api/chat/transaction/{uuid}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://geekai.co/api/chat/transaction/{uuid}")
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{
"request_id": "<string>",
"amount": 123,
"tokens": 123,
"input_tokens": 123,
"output_tokens": 123,
"cache_hit_tokens": 123,
"cache_write_tokens": 123,
"billed_units": 123,
"times": 123,
"event": "<string>",
"channel": "<string>",
"discount": 123
}{
"code": "unauthorized",
"message": "Invalid API key or token"
}{
"code": "invalid_request",
"message": "请求参数不合法"
}查询指定对话的账单明细信息,对话ID
uuid可以通过对话接口响应数据中的id字段获取,对于画图、视频生成等场景,需要通过响应数据的task_id进行查询。
查询结果中的 amount 字段表示此次对话消耗的金币数,单位为金币,100金币=1元。
注意:调用此接口需要通过系统 KEY 进行认证。此外,由于账单是异步生成的,拿到对话/任务响应结果后可能需要等待一段时间才能查询到对应的账单信息,这个时间通常是1-3s左右。
授权
系统KEY
路径参数
资源唯一标识符
响应
成功响应
对话请求ID
本次请求消耗金币值,100金币=1元
使用的总Token数量
输入Token数量
输出Token数量
缓存命中Token数量
缓存写入Token数量
计费单位数量,适用于按次收费模型,如搜索、画图、视频生成等
计费倍率,适用于不同分辨率、质量的画图、视频生成等模型,默认为1
事件类型,表示此次对话的具体操作类型
代理线路渠道类型枚举值,如低价、均衡、高可用等
折扣率,消耗金币=官方价*折扣率
此页面对您有帮助吗?
⌘I
