跳到主要内容

aidy.v2.ext.usage

Messages

message UsageStat

请求级 usage / credit 统计结果,由独立统计插件写入 ext_fields.usage。

message UsageStat {
// Usage 可用性状态:available / estimated / unavailable。
string status = 1;
// 最终发往上游并用于计价的模型。
string billed_model = 3;
// Usage 中的未缓存输入 token 数;缓存输入会单独记录到 cached_* 字段。
int32 input_tokens = 6;
// Usage 中的输出 token 数。
int32 output_tokens = 7;
// Usage 中的总 token 数。
int32 total_tokens = 8;
// Usage 中的缓存读取输入 token 数。
int32 cached_read_tokens = 9;
// Usage 中的缓存写入输入 token 数。
int32 cached_creation_tokens = 10;
// Usage 中的 reasoning token 数;当前仅用于 telemetry,不单独计费。
int32 reasoning_tokens = 11;
// Usage 中的图片输入 token 数。
int32 image_input_tokens = 12;
// Usage 中的音频输入 token 数。
int32 audio_input_tokens = 13;
// Usage 中的音频输出 token 数。
int32 audio_output_tokens = 14;
// 基于 pricing 计算得到的本次 credit 消耗。
int32 billed_credit = 15;
// 计费错误信息;成功或未尝试计费时输出 null。
google.protobuf.Value billed_error = 16;
// 是否有可用于计费的 usage。兼容字段,等价于 status != "unavailable"。
bool usage_available = 17;
// 计费计算状态:calculated / failed / skipped。
string billed_status = 18;
}