관리자 사용량 근거를 정교화
This commit is contained in:
parent
ccdcfcd2f5
commit
707dba4f8f
10 changed files with 1136 additions and 209 deletions
|
|
@ -1,17 +1,45 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
from datetime import date
|
||||
|
||||
from .services.llm_pricing import estimate_reference_cost
|
||||
|
||||
|
||||
class LlmPricingTest(unittest.TestCase):
|
||||
def test_agy_gemini_36_is_unavailable_before_model_release(self) -> None:
|
||||
estimate = estimate_reference_cost(
|
||||
provider="agy_cli",
|
||||
model="gemini-3.6-flash-high",
|
||||
tokens_in=1_000,
|
||||
tokens_out=100,
|
||||
priced_at=date(2026, 7, 20),
|
||||
)
|
||||
|
||||
self.assertIsNone(estimate)
|
||||
|
||||
def test_agy_gemini_36_rate_starts_on_model_release_date(self) -> None:
|
||||
estimate = estimate_reference_cost(
|
||||
provider="agy_cli",
|
||||
model="gemini-3.6-flash-high",
|
||||
tokens_in=1_000,
|
||||
tokens_out=100,
|
||||
priced_at=date(2026, 7, 21),
|
||||
)
|
||||
|
||||
self.assertIsNotNone(estimate)
|
||||
assert estimate is not None
|
||||
self.assertEqual(estimate.cost_usd, 0.00225)
|
||||
self.assertIn("2026-07-21~2026-08-12", estimate.rate_label)
|
||||
self.assertTrue(estimate.rate_id.endswith("@2026-07-21"))
|
||||
|
||||
def test_agy_gemini_reasoning_suffix_uses_base_model_standard_rate(self) -> None:
|
||||
estimate = estimate_reference_cost(
|
||||
provider="agy_cli",
|
||||
model="gemini-3.6-flash-high",
|
||||
tokens_in=35_703,
|
||||
tokens_out=1_129,
|
||||
priced_at=date(2026, 7, 31),
|
||||
)
|
||||
|
||||
self.assertIsNotNone(estimate)
|
||||
|
|
@ -19,6 +47,59 @@ class LlmPricingTest(unittest.TestCase):
|
|||
self.assertEqual(estimate.cost_usd, 0.062022)
|
||||
self.assertIn("Gemini 3.6 Flash", estimate.rate_label)
|
||||
|
||||
def test_agy_gemini_36_uses_introductory_rate_from_august_13(self) -> None:
|
||||
estimate = estimate_reference_cost(
|
||||
provider="agy_cli",
|
||||
model="gemini-3.6-flash-medium",
|
||||
tokens_in=35_703,
|
||||
tokens_out=1_129,
|
||||
priced_at=date(2026, 8, 13),
|
||||
)
|
||||
|
||||
self.assertIsNotNone(estimate)
|
||||
assert estimate is not None
|
||||
self.assertEqual(estimate.cost_usd, 0.031011)
|
||||
self.assertIn("2026-12-31까지", estimate.rate_label)
|
||||
|
||||
def test_agy_gemini_37_uses_introductory_rate_and_reasoning_suffix(self) -> None:
|
||||
estimate = estimate_reference_cost(
|
||||
provider="agy_cli",
|
||||
model="gemini-3.7-flash-high",
|
||||
tokens_in=115_950,
|
||||
tokens_out=4_407,
|
||||
priced_at=date(2026, 8, 28),
|
||||
)
|
||||
|
||||
self.assertIsNotNone(estimate)
|
||||
assert estimate is not None
|
||||
self.assertEqual(estimate.cost_usd, 0.10348875)
|
||||
self.assertIn("Gemini 3.7 Flash", estimate.rate_label)
|
||||
|
||||
def test_agy_gemini_37_is_unavailable_before_model_release(self) -> None:
|
||||
estimate = estimate_reference_cost(
|
||||
provider="agy_cli",
|
||||
model="gemini-3.7-flash-high",
|
||||
tokens_in=1_000,
|
||||
tokens_out=100,
|
||||
priced_at=date(2026, 8, 12),
|
||||
)
|
||||
|
||||
self.assertIsNone(estimate)
|
||||
|
||||
def test_agy_gemini_37_switches_to_standard_rate_in_2027(self) -> None:
|
||||
estimate = estimate_reference_cost(
|
||||
provider="agy_cli",
|
||||
model="gemini-3.7-flash-low",
|
||||
tokens_in=115_950,
|
||||
tokens_out=4_407,
|
||||
priced_at=date(2027, 1, 1),
|
||||
)
|
||||
|
||||
self.assertIsNotNone(estimate)
|
||||
assert estimate is not None
|
||||
self.assertEqual(estimate.cost_usd, 0.2069775)
|
||||
self.assertIn("2027-01-01부터", estimate.rate_label)
|
||||
|
||||
def test_codex_credit_rate_accounts_for_cached_input(self) -> None:
|
||||
estimate = estimate_reference_cost(
|
||||
provider="codex_cli",
|
||||
|
|
@ -26,6 +107,7 @@ class LlmPricingTest(unittest.TestCase):
|
|||
tokens_in=12,
|
||||
cached_input_tokens=2,
|
||||
tokens_out=3,
|
||||
priced_at=date(2026, 8, 28),
|
||||
)
|
||||
|
||||
self.assertIsNotNone(estimate)
|
||||
|
|
@ -39,6 +121,7 @@ class LlmPricingTest(unittest.TestCase):
|
|||
model="gpt-oss-120b-medium",
|
||||
tokens_in=1000,
|
||||
tokens_out=100,
|
||||
priced_at=date(2026, 8, 28),
|
||||
)
|
||||
|
||||
self.assertIsNone(estimate)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue