Update models.py

This commit is contained in:
Shunyu Yao 2023-07-13 16:05:39 -04:00 committed by GitHub
parent b91033902c
commit f10dd7a586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,5 +41,5 @@ def gpt_usage(backend="gpt-4"):
if backend == "gpt-4":
cost = completion_tokens / 1000 * 0.06 + prompt_tokens / 1000 * 0.03
elif backend == "gpt-3.5-turbo":
cost = (completion_tokens + prompt_tokens) / 1000 * 0.0002
return {"completion_tokens": completion_tokens, "prompt_tokens": prompt_tokens, "cost": cost}
cost = completion_tokens / 1000 * 0.002 + prompt_tokens / 1000 * 0.0015
return {"completion_tokens": completion_tokens, "prompt_tokens": prompt_tokens, "cost": cost}