179 lines
3.6 KiB
JSON
179 lines
3.6 KiB
JSON
{
|
|
"summary": [
|
|
{
|
|
"name": "llm_usage",
|
|
"title": "用量流水(双维度记账)",
|
|
"primary": [
|
|
"id"
|
|
],
|
|
"catelog": "entity"
|
|
}
|
|
],
|
|
"fields": [
|
|
{
|
|
"name": "id",
|
|
"title": "主键ID",
|
|
"type": "str",
|
|
"length": 32,
|
|
"nullable": "no"
|
|
},
|
|
{
|
|
"name": "org_id",
|
|
"title": "机构ID",
|
|
"type": "str",
|
|
"length": 32
|
|
},
|
|
{
|
|
"name": "user_id",
|
|
"title": "用户ID",
|
|
"type": "str",
|
|
"length": 32
|
|
},
|
|
{
|
|
"name": "model_id",
|
|
"title": "模型ID",
|
|
"type": "str",
|
|
"length": 32
|
|
},
|
|
{
|
|
"name": "account_id",
|
|
"title": "账号ID",
|
|
"type": "str",
|
|
"length": 32
|
|
},
|
|
{
|
|
"name": "endpoint_region",
|
|
"title": "端点区域",
|
|
"type": "str",
|
|
"length": 20
|
|
},
|
|
{
|
|
"name": "cost",
|
|
"title": "成本金额(账号)",
|
|
"type": "float",
|
|
"length": 12,
|
|
"dec": 6,
|
|
"default": "0"
|
|
},
|
|
{
|
|
"name": "charge",
|
|
"title": "客户应付(异步三方账计算)",
|
|
"type": "float",
|
|
"length": 12,
|
|
"dec": 6,
|
|
"default": "0"
|
|
},
|
|
{
|
|
"name": "accounting_status",
|
|
"title": "记账状态(created待记账/accounted记账成功/failed记账失败;仅status=SUCCEEDED时有意义,否则NULL)",
|
|
"type": "str",
|
|
"length": 20,
|
|
"nullable": "yes"
|
|
},
|
|
{
|
|
"name": "ppid",
|
|
"title": "定价项目ID",
|
|
"type": "str",
|
|
"length": 32
|
|
},
|
|
{
|
|
"name": "project_id",
|
|
"title": "项目ID(sd_projects.id; 0=非项目调用哨兵值,按项目统计费用,查询不传=不区分项目)",
|
|
"type": "str",
|
|
"length": 32,
|
|
"nullable": "no",
|
|
"default": "'0'"
|
|
},
|
|
{
|
|
"name": "task_ref",
|
|
"title": "调用来源",
|
|
"type": "str",
|
|
"length": 100
|
|
},
|
|
{
|
|
"name": "call_id",
|
|
"title": "调用批次ID(关联llm_call_trace原文追踪,一次调用=N个往返)",
|
|
"type": "str",
|
|
"length": 32
|
|
},
|
|
{
|
|
"name": "status",
|
|
"title": "调用状态(SUCCEEDED/FAILED/PENDING/RUNNING/其他如recharge)",
|
|
"type": "str",
|
|
"length": 20,
|
|
"nullable": "no",
|
|
"default": "'SUCCEEDED'"
|
|
},
|
|
{
|
|
"name": "usages",
|
|
"title": "用量原文JSON(计费唯一事实源:token计数+按量因子,全量不截断)",
|
|
"type": "text",
|
|
"nullable": "yes"
|
|
},
|
|
{
|
|
"name": "note",
|
|
"title": "备注/原因",
|
|
"type": "str",
|
|
"length": 200
|
|
},
|
|
{
|
|
"name": "created_at",
|
|
"title": "创建时间",
|
|
"type": "timestamp",
|
|
"nullable": "no"
|
|
}
|
|
],
|
|
"indexes": [
|
|
{
|
|
"name": "idx_llm_usage_org",
|
|
"idxtype": "index",
|
|
"idxfields": [
|
|
"org_id",
|
|
"created_at"
|
|
]
|
|
},
|
|
{
|
|
"name": "idx_llm_usage_model",
|
|
"idxtype": "index",
|
|
"idxfields": [
|
|
"model_id"
|
|
]
|
|
},
|
|
{
|
|
"name": "idx_llm_usage_call",
|
|
"idxtype": "index",
|
|
"idxfields": [
|
|
"call_id"
|
|
]
|
|
},
|
|
{
|
|
"name": "idx_llm_usage_project",
|
|
"idxtype": "index",
|
|
"idxfields": [
|
|
"project_id",
|
|
"created_at"
|
|
]
|
|
}
|
|
],
|
|
"codes": [
|
|
{
|
|
"field": "model_id",
|
|
"table": "llm_model",
|
|
"valuefield": "id",
|
|
"textfield": "name"
|
|
},
|
|
{
|
|
"field": "account_id",
|
|
"table": "llm_account",
|
|
"valuefield": "id",
|
|
"textfield": "name"
|
|
},
|
|
{
|
|
"field": "status",
|
|
"table": "appcodes_kv",
|
|
"valuefield": "k",
|
|
"textfield": "v",
|
|
"cond": "parentid='llm_usage_status'"
|
|
}
|
|
]
|
|
} |