用量与分析
获取生成记录
根据 ID 获取指定的生成记录。
GET
/
generations
获取生成记录
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.phaseo.app/v1/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.phaseo.app/v1/generations"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)curl --request GET \
--url https://api.phaseo.app/v1/generations \
--header 'Authorization: Bearer <token>'package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.phaseo.app/v1/generations"
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.phaseo.app/v1/generations")
.header("Authorization", "Bearer <token>")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.phaseo.app/v1/generations",
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;
}require 'uri'
require 'net/http'
url = URI("https://api.phaseo.app/v1/generations")
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{
"created_at": "2023-11-07T05:31:56Z",
"request_id": "<string>",
"team_id": "<string>",
"app_id": "<string>",
"endpoint": "<string>",
"model_id": "<string>",
"provider": "<string>",
"native_response_id": "<string>",
"stream": true,
"byok": true,
"status_code": 123,
"success": true,
"error_code": "<string>",
"error_message": "<string>",
"latency_ms": 123,
"generation_ms": 123,
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
},
"cost_nanos": 123,
"currency": "<string>",
"pricing_lines": [
{}
],
"key_id": "<string>",
"throughput": 123,
"replay_supported": true,
"replay_request": {}
}{
"ok": true,
"error": "<string>",
"reason": "<string>"
}{
"ok": true,
"error": "<string>"
}调用
工作区可以将存储的内容限制为仅所有者和管理员可见。此时其他调用方(包括成员创建的 API 密钥)会得到
GET /v1/generations?id=<request_id>,获取你工作区中某个请求已存储的审计记录。它需要 generations:read 范围;缺少 id 会返回 400 missing_id。
新请求会获得服务器生成的 G- 生成 ID,通过 x-request-id 响应标头和生成响应返回。请使用此 ID 查询请求日志、查找生成记录和联系支持。调用方提供的 x-request-id 不会替换生成 ID。旧的 UUID 日志 ID 仍可用于查找。
重放请求
每个响应都包含replay_supported。当 I/O 日志存储了请求正文,且你有权读取存储的内容时,replay_supported 为 true,replay_request 中保存着可发回以受控重新运行的正文:
1
读取生成记录
调用
GET /v1/generations?id=<request_id>。2
确认可以重放
只有在
replay_supported 为 true 时才继续。3
再次发送
将
replay_request 发送到 endpoint 中指定的端点,例如 /v1/chat/completions 或 /v1/responses。replay_request: null,以及不含内容的请求详情。响应
生成记录数据
最后修改于 2026年11月16日
⌘I
获取生成记录
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.phaseo.app/v1/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.phaseo.app/v1/generations"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)curl --request GET \
--url https://api.phaseo.app/v1/generations \
--header 'Authorization: Bearer <token>'package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.phaseo.app/v1/generations"
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.phaseo.app/v1/generations")
.header("Authorization", "Bearer <token>")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.phaseo.app/v1/generations",
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;
}require 'uri'
require 'net/http'
url = URI("https://api.phaseo.app/v1/generations")
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{
"created_at": "2023-11-07T05:31:56Z",
"request_id": "<string>",
"team_id": "<string>",
"app_id": "<string>",
"endpoint": "<string>",
"model_id": "<string>",
"provider": "<string>",
"native_response_id": "<string>",
"stream": true,
"byok": true,
"status_code": 123,
"success": true,
"error_code": "<string>",
"error_message": "<string>",
"latency_ms": 123,
"generation_ms": 123,
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
},
"cost_nanos": 123,
"currency": "<string>",
"pricing_lines": [
{}
],
"key_id": "<string>",
"throughput": 123,
"replay_supported": true,
"replay_request": {}
}{
"ok": true,
"error": "<string>",
"reason": "<string>"
}{
"ok": true,
"error": "<string>"
}