账单使用历史
Get billing usage data for the authenticated user as a cursor-paginated walk in ascending timestamp order. The first request takes filter parameters; while more entries remain, each response carries a nextCursor token that fetches the next page. A continuation request sends the cursor and nothing else — the filters travel inside the cursor, and filter parameters sent alongside one are rejected. A rejected cursor (expired, tampered with, or issued to another user) yields a 400 response; restart the walk from the first page. Page contents are stable while new usage is recorded, and no result totals are reported. Include text/csv in the Accept header to receive the page as a CSV export instead of JSON.
curl --request GET \
--url https://api.venice.ai/api/v1/billing/usage-history \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.venice.ai/api/v1/billing/usage-history"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.venice.ai/api/v1/billing/usage-history', 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.venice.ai/api/v1/billing/usage-history",
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.venice.ai/api/v1/billing/usage-history"
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.venice.ai/api/v1/billing/usage-history")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.venice.ai/api/v1/billing/usage-history")
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{
"data": [
{
"amount": -0.1,
"currency": "DIEM",
"inferenceDetails": null,
"notes": "API Inference",
"pricePerUnitUsd": 0.1,
"sku": "grok-imagine-image-image-unit",
"timestamp": "2026-06-14T19:52:45.087Z",
"units": 1
},
{
"amount": -0.06356,
"currency": "DIEM",
"inferenceDetails": {
"completionTokens": 227,
"inferenceExecutionTime": 2964,
"promptTokens": 339,
"requestId": "chatcmpl-4007fd29f42b7d3c4107f4345e8d174a"
},
"notes": "API Inference",
"pricePerUnitUsd": 2.8,
"sku": "zai-org-glm-5-1-llm-output-mtoken",
"timestamp": "2026-06-15T19:05:10.504Z",
"units": 0.000227
}
],
"nextCursor": "AZq3fK9tXhIVDm2j4vN8cQwYt1sB6uEoLxRgPzKaJdHfM5nC7yW0K3w"
}{
"error": "<string>",
"details": {
"_errors": [],
"field": {
"_errors": [
"Field is required"
]
}
}
}{
"error": "<string>"
}{
"error": "<string>"
}授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
查询参数
Filter by consumable currency
USD, DIEM, BUNDLED_CREDITS "USD"
Opaque continuation token from a previous response's nextCursor. The cursor carries the filters of the walk it continues, so no filter parameters may be sent alongside it.
512^[A-Za-z0-9_-]+$"AZq3fK9tXhIVDm2j4vN8cQwYt1sB6uEoLxRgPzKaJdHfM5nC7yW0K3w"
Exclusive upper bound on entry timestamps (ISO 8601 UTC, "Z" suffix). Must be later than startTimestamp; consecutive windows sharing a boundary walk the history without gaps or overlaps. Carried forward by the cursor.
40"2026-07-01T00:00:00.000Z"
Number of entries per page. Carried forward by the cursor.
10 <= x <= 10001000
Inclusive lower bound on entry timestamps (ISO 8601 UTC, "Z" suffix). First page only: a continuation resumes from the cursor position instead.
40"2026-06-01T00:00:00.000Z"
响应
Successful response
The response schema for the billing usage history endpoint
curl --request GET \
--url https://api.venice.ai/api/v1/billing/usage-history \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.venice.ai/api/v1/billing/usage-history"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.venice.ai/api/v1/billing/usage-history', 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.venice.ai/api/v1/billing/usage-history",
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.venice.ai/api/v1/billing/usage-history"
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.venice.ai/api/v1/billing/usage-history")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.venice.ai/api/v1/billing/usage-history")
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{
"data": [
{
"amount": -0.1,
"currency": "DIEM",
"inferenceDetails": null,
"notes": "API Inference",
"pricePerUnitUsd": 0.1,
"sku": "grok-imagine-image-image-unit",
"timestamp": "2026-06-14T19:52:45.087Z",
"units": 1
},
{
"amount": -0.06356,
"currency": "DIEM",
"inferenceDetails": {
"completionTokens": 227,
"inferenceExecutionTime": 2964,
"promptTokens": 339,
"requestId": "chatcmpl-4007fd29f42b7d3c4107f4345e8d174a"
},
"notes": "API Inference",
"pricePerUnitUsd": 2.8,
"sku": "zai-org-glm-5-1-llm-output-mtoken",
"timestamp": "2026-06-15T19:05:10.504Z",
"units": 0.000227
}
],
"nextCursor": "AZq3fK9tXhIVDm2j4vN8cQwYt1sB6uEoLxRgPzKaJdHfM5nC7yW0K3w"
}{
"error": "<string>",
"details": {
"_errors": [],
"field": {
"_errors": [
"Field is required"
]
}
}
}{
"error": "<string>"
}{
"error": "<string>"
}