跳转到内容
EN

查询生成记录

先调用「对话」,从响应头 X-Praxis-Generation-Id 取得 id,替换 gen_123。

GET/model/v1/generation● 支持

官方文档 ↗

请求参数

  • idstring必填◐ 部分支持

    query: Generation ID from the X-Praxis-Generation-Id response header of the model request.

    使用 /model 响应头 X-Praxis-Generation-Id;响应体 id 和 X-Request-Id 不能查询,返回 404。

返回

200

鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码

请求示例

curl
# 先调用「对话」,从响应头 X-Praxis-Generation-Id 取得 id,替换 gen_123。
curl "https://api.deepraxis.com/model/v1/generation?id=gen_123" \
  -H "Authorization: Bearer $PRAXIS_API_KEY"
Python
# 先调用「对话」,从响应头 X-Praxis-Generation-Id 取得 id,替换 gen_123。
import requests

opts = dict(
    base_url="https://api.deepraxis.com/model/v1",
    api_key="$PRAXIS_API_KEY",
)

# 官方 SDK 没有这个端点;直接用 HTTP 调用,id 取自对话响应头 X-Praxis-Generation-Id
resp = requests.get(
    f"{opts['base_url']}/generation",
    params={"id": "gen_123"},
    headers={"Authorization": f"Bearer {opts['api_key']}"},
)
print(resp.json())
TypeScript
// 先调用「对话」,从响应头 X-Praxis-Generation-Id 取得 id,替换 gen_123。
const opts = {
  baseURL: "https://api.deepraxis.com/model/v1",
  apiKey: "$PRAXIS_API_KEY",
};

// 官方 SDK 没有这个端点;直接用 HTTP 调用,id 取自对话响应头 X-Praxis-Generation-Id
const resp = await fetch(`${opts.baseURL}/generation?id=gen_123`, {
  headers: { Authorization: `Bearer ${opts.apiKey}` },
});
console.log(await resp.json());

响应示例 200

{
  "id": "04cf3931-3eca-4e11-8f87-d18d2bb4fde4",
  "model": "deepseek-flash",
  "cost": 0.000075,
  "usage": {
    "prompt_tokens": 31,
    "completion_tokens": 55,
    "total_tokens": 86,
    "cached_input_tokens": 0
  },
  "latency_ms": 3736,
  "created": 1790305588
}

响应

HTTP 200

Generation record

application/json

名称 类型 说明
id string Generation id that was queried.
model string Model that served the generation.
cost number | null Cost charged for the generation in USD; null when not yet priced.
usage object Token usage of the generation.
usage.prompt_tokens number Number of prompt tokens.
usage.completion_tokens number Number of tokens in the completion.
usage.total_tokens number Prompt plus completion tokens.
usage.cached_input_tokens number Prompt tokens served from the prompt cache; null when not reported.
latency_ms number | null Latency of the generation in milliseconds; null when not recorded.
created number Unix time in seconds at which the generation was recorded.