pipeline-llm/wwwroot/api/llm_project_cost_query.dspy

12 lines
618 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# llm_project_cost_query.dspy — 按项目统计费用(2026-09-10 用户定夺)
# 入参 params_kw: org_id? / date_from? / date_to? / status?
# 出参: rows[{project_id, project_name, calls, cost, charge, req_tokens, resp_tokens}]
# + summary{project_count, calls, cost, charge}
# project_id 过滤:不传/null = 不区分项目(全部分组都出)
# 非项目调用(哨兵 project_id='0')归为「(非项目调用)」一组
uid = await get_user()
if not uid:
return {"success": False, "message": "未登录"}
pk = dict(params_kw or {})
return json.loads(await llm_project_cost_query(pk))