mirror of
https://github.com/NovaOSS/nova-api.git
synced 2024-11-25 16:43:58 +01:00
Much cheaper API
This commit is contained in:
parent
30bd5616b8
commit
a16ba559fb
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue