feat(openai): cover gpt-5.6 -pro variants (PR #61587 complement)

PR #61587 adds sol-pro/terra-pro/luna-pro to the aggregator lists.
Complete those on the native surfaces the same way this PR completes
the base tiers:

- hermes_cli/models.py: -pro variants in _PROVIDER_MODELS[openai-api].
- agent/usage_pricing.py: alias ("openai", "gpt-5.6-*-pro") onto the
  base-tier PricingEntry rows — the -pro high-effort modes bill at the
  SAME per-token rates (verified against OpenRouter live pricing
  2026-07-09: identical prompt/completion prices for base and -pro);
  they cost more per task by consuming more tokens, not a higher rate.
- Context lengths need no new entries: "gpt-5.6-sol" et al. are
  substrings of their -pro variants and both lookup tables match
  longest-key-first (verified: sol-pro -> 1.05M direct / 272K codex).
- model_switch sort: -pro variants parse as suffix "sol-pro" (rank 1),
  so /model gpt still defaults to base sol — pinned by test.
- Not added to DEFAULT_CODEX_MODELS: only confirmed routable via API/
  OpenRouter so far; codex live discovery will surface them if ChatGPT
  exposes them, same policy as other unconfirmed codex slugs.

Tests: invariant tests extended (pro aliases share base entries, base
sol outranks sol-pro); 191 targeted tests pass.
This commit is contained in:
Kshitij Kapoor 2026-07-09 23:42:12 +05:30 committed by kshitij
parent db117af478
commit a3828a94d0
3 changed files with 34 additions and 1 deletions

View file

@ -109,7 +109,11 @@ _OFFICIAL_DOCS_PRICING: Dict[tuple[str, str], PricingEntry] = {
# writes are billed at 1.25x the uncached input rate; cache reads get the
# standard 90% discount (0.10x input, confirmed: Sol $0.50/M cached).
# Note: "Sol Fast mode" ($12.5/$75, up to 750 tok/s via Cerebras) is a
# separate serving tier, not covered by these entries.
# separate serving tier, not covered by these entries. The "-pro"
# variants (high-effort modes, GA alongside base tiers) bill at the
# SAME per-token rates and are aliased onto these entries below the
# dict (they cost more per task by consuming more tokens, not by a
# higher rate — verified against OpenRouter's live pricing 2026-07-09).
# Source: https://openai.com/index/previewing-gpt-5-6-sol/
(
"openai",
@ -607,6 +611,15 @@ _OFFICIAL_DOCS_PRICING: Dict[tuple[str, str], PricingEntry] = {
),
}
# GPT-5.6 "-pro" high-effort variants bill at the same per-token rates as
# their base tiers (more tokens per task, not a higher rate). Alias them
# onto the base entries so the snapshot stays single-source.
for _base_56 in ("gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna"):
_OFFICIAL_DOCS_PRICING[("openai", f"{_base_56}-pro")] = _OFFICIAL_DOCS_PRICING[
("openai", _base_56)
]
del _base_56
def _to_decimal(value: Any) -> Optional[Decimal]:
if value is None:

View file

@ -240,8 +240,11 @@ _PROVIDER_MODELS: dict[str, list[str]] = {
],
"openai-api": [
"gpt-5.6-sol",
"gpt-5.6-sol-pro",
"gpt-5.6-terra",
"gpt-5.6-terra-pro",
"gpt-5.6-luna",
"gpt-5.6-luna-pro",
"gpt-5.5",
"gpt-5.5-pro",
"gpt-5.4",

View file

@ -38,6 +38,14 @@ class TestGpt56SortInvariants:
assert models[0] == "openai/gpt-5.6-sol"
def test_base_sol_outranks_sol_pro_for_alias_default(self):
# "-pro" high-effort variants parse as suffix "sol-pro" (rank 1), so
# `/model gpt` defaults to base Sol rather than the high-effort mode.
models = ["gpt-5.6-sol-pro", "gpt-5.6-sol"]
models.sort(key=lambda m: _model_sort_key(m, "gpt"))
assert models[0] == "gpt-5.6-sol"
class TestGpt56PricingRoute:
def test_official_pricing_reachable_from_openai(self):
route = resolve_billing_route("gpt-5.6-sol", provider="openai")
@ -64,3 +72,12 @@ class TestGpt56PricingRoute:
assert entry.cache_read_cost_per_million == (
entry.input_cost_per_million * Decimal("0.10")
), slug
def test_pro_variants_alias_to_base_tier_pricing(self):
# -pro high-effort modes bill at the same per-token rates as their
# base tiers; the snapshot aliases them rather than duplicating rows.
for base in ("gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna"):
assert (
_OFFICIAL_DOCS_PRICING[("openai", f"{base}-pro")]
is _OFFICIAL_DOCS_PRICING[("openai", base)]
), base