MCPcopy Create free account
hub / github.com/CJackHwang/AIstudioProxyAPI / _load_usage_data

Function _load_usage_data

api_utils/utils_ext/usage_tracker.py:13–22  ·  view source on GitHub ↗

Internal function to load usage data from disk.

()

Source from the content-addressed store, hash-verified

11
12
13def _load_usage_data() -> Dict[str, int]:
14 """Internal function to load usage data from disk."""
15 if not os.path.exists(USAGE_FILE):
16 return {}
17 try:
18 with open(USAGE_FILE, "r", encoding="utf-8") as f:
19 return json.load(f)
20 except (json.JSONDecodeError, IOError) as e:
21 logger.error(f"Failed to load profile usage data: {e}")
22 return {}
23
24
25def _save_usage_data(data: Dict[str, int]) -> None:

Callers 2

increment_profile_usageFunction · 0.85
get_profile_usageFunction · 0.85

Calls 2

loadMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected