G-01ABC...)传给 SDK 的生成记录方法,即可从 GET /v1/generations?id=<id> 获取该请求的存储记录。
const record = await client.getGeneration("G-01ABC...");
record = client.get_generation("G-01ABC...")
print(record["model_id"], record["cost_nanos"])
client, err := phaseo.NewFromEnv()
if err != nil {
panic(err)
}
record, err := client.GetGeneration(context.Background(), "G-01ABC...")
if err != nil {
panic(err)
}
fmt.Println(record["status_code"], record["cost_nanos"])
using PhaseoSdk;
var client = new Phaseo();
var record = await client.GetGeneration("G-01ABC...");
<?php
require 'vendor/autoload.php';
use Phaseo\Sdk\Phaseo;
$client = new Phaseo();
$record = $client->getGeneration('G-01ABC...');
require 'phaseo_sdk'
client = PhaseoSdk::Phaseo.new
record = client.get_generation('G-01ABC...')
import app.phaseo.sdk.Phaseo;
Phaseo client = new Phaseo(System.getenv("PHASEO_API_KEY"));
var record = client.getGeneration("G-01ABC...");
System.out.println(record);
| 语言 | 方法 | 返回值 |
|---|---|---|
| TypeScript | client.getGeneration(id) | 记录对象 |
| Python | client.get_generation(id) | APIResponse dict |
| Go | client.GetGeneration(ctx, id) | map[string]interface{} |
| C# | client.GetGeneration(id) | Dictionary<string, object>? |
| PHP | $client->getGeneration($id) | 数组 |
| Ruby | client.get_generation(id) | Hash |
| Java | client.getGeneration(id) | Jackson JsonNode |
| Rust | 没有辅助方法;请调用 client.request("GET", "/generations?id=<id>", None, &RequestOptions::default()) | PhaseoResponse,记录在 body 中(一个 serde_json::Value) |
id 时返回 400(missing_id),ID 不在你的工作区中时返回 404(not_found)。
重放已存储的请求
如果网关存储了完整请求,记录中的replay_supported 为 true,并带有 replay_request,你可以把它发回原始端点,进行受控的重新运行。
读取计时字段
latency_ms:到第一个 token、第一个输出字节或第一帧的时间(有跟踪时)。generation_ms:从那一刻起的生成时间(有跟踪时)。
响应
{
"created_at": "2026-05-05T12:00:00.000Z",
"request_id": "G-01ABC123",
"team_id": "team-123",
"app_id": "app-123",
"endpoint": "chat/completions",
"model_id": "openai/gpt-6-astra",
"provider": "openai",
"native_response_id": "chatcmpl-123",
"stream": false,
"byok": false,
"status_code": 200,
"success": true,
"error_code": null,
"error_message": null,
"latency_ms": 1500,
"generation_ms": 1400,
"usage": {
"prompt_tokens": 9,
"completion_tokens": 9,
"total_tokens": 18
},
"cost_nanos": 1000000,
"currency": "USD",
"pricing_lines": [],
"key_id": "key-123",
"throughput": null,
"replay_supported": true,
"replay_request": {
"model": "openai/gpt-6-astra",
"messages": [
{ "role": "user", "content": "Say hello" }
]
}
}