MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / calculate_cost

Function calculate_cost

experiments/token_cost/token_usage_tracker.py:160–163  ·  view source on GitHub ↗

计算单次调用成本

(task_type: str, model: str, input_tokens: int, output_tokens: int)

Source from the content-addressed store, hash-verified

158
159
160def calculate_cost(task_type: str, model: str, input_tokens: int, output_tokens: int) -> float:
161 """计算单次调用成本"""
162 pricing = MODEL_PRICES.get(model, {"input": 0, "output": 0})
163 return (input_tokens * pricing["input"] + output_tokens * pricing["output"]) / 1000
164
165
166def get_usage_stats(

Callers 1

get_usage_statsFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected