AI 追踪视图把模型调用按运行分组:一次 agent 循环、一轮 Studio、一次 Copilot 回答或一次 API 调用,显示每次调用的 token、RQ 和耗时,网关开启了提示词记录时还能看到提示词和回复。给自己的调用一个运行 id 即可分组:
js
// Group an agent's calls into one run so the trace view and budgets see them together
const ai = env.AI.withBudget({ runId: `job-${jobId}`, maxRq: 50 });
await ai.chat({ model: "claude-sonnet-5-5", messages });
// Tag a direct API call the same way
curl https://ai.randallflare.com/v1/chat/completions -H 'authorization: Bearer rfa_…' -H 'x-rf-run-id: nightly-digest' -d '…'