mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-05 02:41:56 +00:00
* chore(lens): remove deployment screenshots * refactor(lens)!: rename internal engine package and API * fix(lens): pin worker image for renamed API * test(lens): cover fresh and populated rename migrations * fix(lens): protect db-push upgrades and restore routing and CI * fix(lens): resolve migration tables across schemas and include database driver
19 lines
708 B
Python
19 lines
708 B
Python
from typing import Final
|
|
|
|
import pytest
|
|
|
|
from litellm.proxy.lens.inference import Deployment, DeploymentParams, completion_charge, quote
|
|
from litellm.types.utils import ModelResponse
|
|
|
|
|
|
def test_custom_priced_model_charges_reported_tokens() -> None:
|
|
deployment: Final = Deployment(
|
|
litellm_params=DeploymentParams(
|
|
model="openai/lens-test", input_cost_per_token=0.001, output_cost_per_token=0.002
|
|
)
|
|
)
|
|
response: Final = ModelResponse(
|
|
model="lens-test", usage={"prompt_tokens": 20, "completion_tokens": 10, "total_tokens": 30}
|
|
)
|
|
assert completion_charge((deployment,), response, 10) == pytest.approx(0.04)
|
|
assert quote((deployment,), "hello") > 0.04
|