phase1-billing-skillruntime
This commit is contained in:
1 parent
65440d91ee
commit
89ce7d80dc
1 file changed
+14
@@ -1612,6 +1612,20 @@ async def _send_message_core(
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Phase 1: Bill tokens on stream completion
|
||||
try:
|
||||
_pt = prompt_tokens if "prompt_tokens" in dir() else 0
|
||||
_ct = completion_tokens if "completion_tokens" in dir() else 0
|
||||
_uid = user_id if "user_id" in dir() else "unknown"
|
||||
if _pt or _ct:
|
||||
import asyncio
|
||||
asyncio.create_task(_bill_tokens(
|
||||
_uid, _pt, _ct,
|
||||
ai_model if "ai_model" in dir() else "unknown",
|
||||
conv_id))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return {
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user