計費
獲取用量
獲取 API 用量分析和成本追蹤數據。
GET
/
api
/
v1
/
usage
獲取用量
curl --request GET \
--url https://api.example.com/api/v1/usageimport requests
url = "https://api.example.com/api/v1/usage"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/usage', 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.example.com/api/v1/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.example.com/api/v1/usage"
req, _ := http.NewRequest("GET", url, nil)
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.example.com/api/v1/usage")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body獲取用量分析數據,包括請求次數、令牌消耗、按模式/模型劃分的成本明細,以及延遲百分位數。
身份驗證
需要 Bearer 令牌。參見身份驗證。查詢參數
string
起始日期(ISO 8601 格式,例如
"2026-04-01")。string
結束日期(ISO 8601 格式,例如
"2026-04-14")。string
"user"(在團隊之外時為默認值)或 "org"(在團隊內部時為默認值)。當取值為
"org" 時,響應會反映團隊的共享額度池、所有成員的交易記錄,以及每一行對應操作者的顯示名稱
/ 郵箱。需要在當前團隊中擁有 viewUsage 權限。請求示例
curl "https://www.hitheo.ai/api/v1/usage?from=2026-04-01&to=2026-04-14&scope=org" \
-H "Authorization: Bearer $THEO_API_KEY"
const usage = await theo.usage({ from: "2026-04-01", to: "2026-04-14", scope: "org" });
響應
返回的用量數據包括:- 總請求數 —— 按天/周/月統計
- 成本明細 —— 按模式、模型和技能劃分
- 模型分佈 —— 處理你請求的引擎分佈情況
- 延遲百分位數 —— p50、p95、p99 響應時間
- 緩存命中率 —— 由語義緩存提供服務的請求所佔比例
端點
GET /api/v1/usage
需要通過 Bearer 令牌進行身份驗證。參見身份驗證。這個頁面有幫助嗎?
獲取用量
curl --request GET \
--url https://api.example.com/api/v1/usageimport requests
url = "https://api.example.com/api/v1/usage"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/usage', 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.example.com/api/v1/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.example.com/api/v1/usage"
req, _ := http.NewRequest("GET", url, nil)
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.example.com/api/v1/usage")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body