aidy.v2.ext.usage
Messages
message UsageStat
请求级 usage / credit 统计结果,由独立统计插件写入 ext_fields.usage。
message UsageStat { // 统计状态,例如 calculated / calculate_failed。 string status = 1; // 客户端原始请求模型。 string requested_model = 2; // 最终发往上游并用于计价的模型。 string billed_model = 3; // 最终命中的 upstream ID。 string upstream_id = 4; // 最终命中的 upstream API key ID;为空时输出 null。 google.protobuf.Value upstream_api_key_id = 5; // Usage 中的输入 token 数。 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 数。 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 charged_credit = 15; // 错误信息;成功时输出 null。 google.protobuf.Value error = 16;}