dograh/api/tests/test_run_usage_response.py
Abhishek 1f1149f4d5
feat: billing and credit management v2 (#429)
* feat: use mps generated correlation ID

* chore: update pipecat submodule

* feat: add credit purchase URL

* feat: carve out billing page and show credit ledger

* feat: deprecate dograh based quota tracking

* fix: remove cost calculation from dograh codebase

* fix: create mps account on migrate to v2

* chore: update pipecat
2026-06-12 14:55:30 +05:30

23 lines
769 B
Python

from api.services.workflow.run_usage_response import format_public_usage_info
def test_format_public_usage_info():
usage_info = {
"llm": {
"SarvamLLMService#0|||sarvam-30b": {
"prompt_tokens": 100,
"completion_tokens": 50,
"total_tokens": 150,
}
},
"tts": {"ElevenLabsTTSService#0|||eleven_flash_v2_5": 42},
"stt": {},
"call_duration_seconds": 12.4,
}
result = format_public_usage_info(usage_info)
assert result["llm"]["SarvamLLMService#0|||sarvam-30b"]["prompt_tokens"] == 100
assert result["tts"]["ElevenLabsTTSService#0|||eleven_flash_v2_5"] == 42
assert result["stt"] == {}
assert result["call_duration_seconds"] == 12.4