Fix cost calculation
This commit is contained in:
parent
a09ee757a3
commit
e1c903ee42
2 changed files with 5 additions and 5 deletions
|
|
@ -49,7 +49,7 @@ _ACTOR_MAP_CACHE_LOCK = threading.Lock()
|
|||
_VAR_ACTOR_RE = re.compile(r"\\n\[(\d+)\]", re.IGNORECASE)
|
||||
|
||||
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
|
||||
LANGREGEX = r"[\u3000\u3002-\u3009\u300C-\u303F\u3040-\u309A\u309C-\u30FA\u30FC-\u30FF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\uFF61-\uFF9F]+"
|
||||
LANGREGEX = r"[\u3000\u3002-\u3009\u300C-\u303F\u3040-\u309A\u309C-\u30FA\u31F0-\u31FF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\uFF61-\uFF9F]+"
|
||||
|
||||
# Get pricing configuration based on the model
|
||||
PRICING_CONFIG = getPricingConfig(MODEL)
|
||||
|
|
|
|||
|
|
@ -1236,7 +1236,7 @@ def calculateCost(inputTokens, outputTokens, model):
|
|||
pricing = getPricingConfig(model)
|
||||
br = pricing["inputAPICost"] / 1_000_000
|
||||
orr = pricing["outputAPICost"] / 1_000_000
|
||||
cost = cr * br * 0.10 + cw * br * 1.25 + reg * br + out * orr
|
||||
cost = cr * br * 0.10 + cw * br * 2.00 + reg * br + out * orr
|
||||
_thread_local.file_cache_read = 0
|
||||
_thread_local.file_cache_write = 0
|
||||
_thread_local.file_regular = 0
|
||||
|
|
@ -1565,13 +1565,13 @@ def translateAI(text, history, fullPromptFlag, config, filename=None, pbar=None,
|
|||
|
||||
batch_cost = (
|
||||
batch_cache_read * base_rate * 0.10 +
|
||||
batch_cache_write * base_rate * 1.25 +
|
||||
batch_cache_write * base_rate * 2.00 +
|
||||
batch_regular * base_rate +
|
||||
batch_output * out_rate
|
||||
)
|
||||
total_cost = (
|
||||
_dbg_cache_read * base_rate * 0.10 +
|
||||
_dbg_cache_write * base_rate * 1.25 +
|
||||
_dbg_cache_write * base_rate * 2.00 +
|
||||
_dbg_regular_input * base_rate +
|
||||
_dbg_output * out_rate
|
||||
)
|
||||
|
|
@ -1805,7 +1805,7 @@ def translateAI(text, history, fullPromptFlag, config, filename=None, pbar=None,
|
|||
_delta_out = getattr(_thread_local, 'file_output', 0) - _prev_out
|
||||
_call_cost = (
|
||||
_delta_cr * _br * 0.10 +
|
||||
_delta_cw * _br * 1.25 +
|
||||
_delta_cw * _br * 2.00 +
|
||||
_delta_reg * _br +
|
||||
_delta_out * _or
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue