MCPcopy Create free account
hub / github.com/acking-you/static_flow / extract_usage

Function extract_usage

scripts/test_llm_gateway_chat.py:171–174  ·  view source on GitHub ↗

Extract the top-level usage block when present.

(response_json: dict)

Source from the content-addressed store, hash-verified

169
170
171def extract_usage(response_json: dict) -> dict | None:
172 """Extract the top-level usage block when present."""
173 usage = response_json.get("usage")
174 return usage if isinstance(usage, dict) else None
175
176
177def nested_usage_int(value: object, *path: str) -> int | None:

Callers 2

extract_response_usageFunction · 0.85
mainFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected