Much cheaper API

This commit is contained in:
NovaOSS Admins 2023-10-16 21:55:54 +00:00
parent 30bd5616b8
commit a16ba559fb

View file

@ -225,9 +225,12 @@ async def respond(
if is_chat: if is_chat:
model_multiplier = model_multipliers['chat-models'].get(payload.get('model'), model_multiplier) model_multiplier = model_multipliers['chat-models'].get(payload.get('model'), model_multiplier)
total_tokens = input_tokens + output_tokens total_tokens = input_tokens + output_tokens
credits_cost = total_tokens / 10 credits_cost = total_tokens / 60
credits_cost = round(credits_cost * model_multiplier) credits_cost = round(credits_cost * model_multiplier)
if credits_cost < 1:
credits_cost = 1
tokens = { tokens = {
'input': input_tokens, 'input': input_tokens,
'output': output_tokens, 'output': output_tokens,