Skip to content

The agent that grows with you

test(openai): Astra pricing/capability tests assert contracts, not snapshots

kshitijk4poor233757037df1
diff --git a/tests/agent/test_models_dev.py b/tests/agent/test_models_dev.py
index 658efb346f3..40fc1031e9c 100644
--- a/tests/agent/test_models_dev.py
+++ b/tests/agent/test_models_dev.py
@@ -831,11 +831,7 @@ class TestGetModelCapabilities:
caps = get_model_capabilities("openai", "gpt-6-astra")
assert caps is not None
- assert caps.context_window == 1_050_000
- assert caps.max_output_tokens == 128_000
- assert caps.supports_tools is True
- assert caps.supports_vision is True
- assert caps.supports_reasoning is True
+ assert caps.supports_vision is True # the one thing _UNKNOWN_MODEL_BASE could not supply
api_caps = get_model_capabilities("openai-api", "gpt-6-astra")
assert api_caps == caps
diff --git a/tests/agent/test_usage_pricing.py b/tests/agent/test_usage_pricing.py
index 346731df1ef..b103ade6df3 100644
--- a/tests/agent/test_usage_pricing.py
+++ b/tests/agent/test_usage_pricing.py
@@ -1,6 +1,7 @@
from types import SimpleNamespace
from agent.usage_pricing import (
+ _OFFICIAL_DOCS_PRICING,
CanonicalUsage,
format_cost_label,
estimate_usage_cost,
@@ -23,9 +24,16 @@ def test_astra_whole_request_price_tier_includes_cache_writes():
provider="openai",
)
- assert below.amount_usd == Decimal("1.635")
- assert above.amount_usd == Decimal("5.450025")
- assert above.pricing_version == "openai-gpt-6-astra-2026-09"
+ # Whole-request tier: crossing 272K prompt tokens re-prices every component of the request,
+ # including cache writes, at the *_above rates — so the cost ratio exceeds the token ratio.
+ entry = _OFFICIAL_DOCS_PRICING[("openai", "gpt-6-astra")]
+ assert above.amount_usd == (
+ Decimal(100_000) * entry.input_cost_per_million_above
+ + Decimal(10_000) * entry.output_cost_per_million_above
+ + Decimal(100_000) * entry.cache_read_cost_per_million_above
+ + Decimal(100_001) * entry.cache_write_cost_per_million_above
+ ) / Decimal(1_000_000)
+ assert below.amount_usd < above.amount_usd