Skip to content
Merged
21 changes: 21 additions & 0 deletions model_registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,27 @@ models:
context_length: 128000
max_output_tokens: 16384

# Pricing (USD per 1M tokens) is informational only; SkillSpector does not
# compute cost. Prompts over 272K input tokens bill at 2x input / 1.5x output.
# Source: https://developers.openai.com/api/docs/models/<model> (as of 2026-09-21)

# $4.00 input / $0.40 cached input / $20.00 output (promotional through
# 2026-11-21). Input is capped at 922K tokens; the 75% input budget
# (~787K) stays under it.
"gpt-5.6-sol":
context_length: 1050000
max_output_tokens: 128000

# $2.00 input / $0.20 cached input / $12.00 output
"gpt-5.6-terra":
context_length: 1050000
max_output_tokens: 128000

# $0.20 input / $0.02 cached input / $1.20 output
"gpt-5.6-luna":
context_length: 1050000
max_output_tokens: 128000

# Provider-prefixed IDs for inference gateways that accept them.
"azure/anthropic/claude-opus-4-5":
context_length: 200000
Expand Down
14 changes: 14 additions & 0 deletions src/skillspector/providers/openai/model_registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
# "<model-label>":
# context_length: <int> # total context window in tokens (required)
# max_output_tokens: <int> # model's max output cap (optional)
#
# Every model appears exactly once. YAML loaders disagree on duplicate keys
# (most keep the last, strict ones raise), so a second mapping for a model
# already listed below is a bug, not an override.

models:
# GPT-5 generation (verified 2026-09-14: openai.com/gpt-5 for 5/mini/nano;
Expand Down Expand Up @@ -37,18 +41,28 @@ models:
# 1.05M generation (verified 2026-09-14 against
# developers.openai.com/api/docs/models/gpt-5.4, gpt-5.5, and
# https://platform.openai.com/docs/models): 1.05M context, 128K output.
#
# The per-model pricing noted below (USD per 1M tokens) is informational
# only; SkillSpector does not compute cost. Prompts over 272K input tokens
# bill at 2x input / 1.5x output.
# Source: https://developers.openai.com/api/docs/models/<model> (as of 2026-09-21)
"gpt-5.4":
context_length: 1050000
max_output_tokens: 128000
"gpt-5.5":
context_length: 1050000
max_output_tokens: 128000
# $0.20 input / $0.02 cached input / $1.20 output
"gpt-5.6-luna":
context_length: 1050000
max_output_tokens: 128000
# $2.00 input / $0.20 cached input / $12.00 output
"gpt-5.6-terra":
context_length: 1050000
max_output_tokens: 128000
# $4.00 input / $0.40 cached input / $20.00 output (promotional through
# 2026-11-21). Input is capped at 922K tokens; the 75% input budget
# (~787K) stays under it.
"gpt-5.6-sol":
Comment thread
chinmay1819 marked this conversation as resolved.
Resolved
context_length: 1050000
max_output_tokens: 128000
Expand Down
65 changes: 65 additions & 0 deletions tests/unit/test_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from pathlib import Path

import pytest
import yaml
from langchain_anthropic import ChatAnthropic
from langchain_openai import ChatOpenAI
from pydantic import SecretStr
Expand Down Expand Up @@ -356,6 +357,70 @@ def test_metadata_flagship_generation(self) -> None:
assert provider.get_max_output_tokens(model) == 128_000


REPO_ROOT = Path(__file__).resolve().parents[2]
ROOT_MODEL_REGISTRY = REPO_ROOT / "model_registry.yaml"
MODEL_REGISTRIES = sorted(
[ROOT_MODEL_REGISTRY]
+ list((REPO_ROOT / "src" / "skillspector" / "providers").glob("*/model_registry.yaml"))
)


def _model_keys_as_written(registry_path: Path) -> list[str]:
"""Return the ``models`` keys in document order, duplicates included.

``yaml.safe_load`` keeps only the last of a repeated key, so asserting on
resolved budgets cannot see a model that was mapped twice. Composing the
node tree preserves every key exactly as the file spells it.
"""
document = yaml.compose(registry_path.read_text(encoding="utf-8"))
for key_node, value_node in document.value:
if key_node.value == "models":
return [key.value for key, _ in value_node.value]
raise AssertionError(f"{registry_path} has no top-level 'models' mapping")


class TestModelRegistryFiles:
"""Integrity of the shipped YAML registries themselves."""

def test_registries_are_discovered(self) -> None:
# Guards the glob: an empty list would make the checks below vacuous.
assert ROOT_MODEL_REGISTRY in MODEL_REGISTRIES
assert len(MODEL_REGISTRIES) > 1

@pytest.mark.parametrize(
"registry_path",
MODEL_REGISTRIES,
ids=lambda path: path.relative_to(REPO_ROOT).as_posix(),
)
def test_each_model_is_mapped_once(self, registry_path: Path) -> None:
# Loaders disagree on duplicate keys — most keep the last mapping,
# strict ones reject the document — so mapping one model twice makes
# the resolved budget loader-dependent and lets the copies drift apart
# while value-only assertions stay green.
keys = _model_keys_as_written(registry_path)
duplicates = sorted({key for key in keys if keys.count(key) > 1})
assert not duplicates, f"{registry_path} maps these models more than once: {duplicates}"

def test_root_registry_replaces_bundled_yaml(self, monkeypatch: pytest.MonkeyPatch) -> None:
"""The repo-root file is the documented SKILLSPECTOR_MODEL_REGISTRY sample."""
monkeypatch.setenv("SKILLSPECTOR_MODEL_REGISTRY", str(ROOT_MODEL_REGISTRY))
provider = OpenAIProvider()

# Gateway-prefixed ids that only the root registry carries.
assert provider.get_context_length("openai/openai/gpt-5.3-chat") == 128_000
assert provider.get_max_output_tokens("openai/openai/gpt-5.3-chat") == 16_384
assert provider.get_context_length("azure/anthropic/claude-sonnet-4-6") == 1_000_000

# Budgets the root registry must keep in step with the bundled YAML,
# since an override replaces that file instead of merging with it.
assert provider.get_context_length("gpt-5.6-sol") == 1_050_000
assert provider.get_max_output_tokens("gpt-5.6-sol") == 128_000

# Same replacement rule from the other side: a bundled-only model has
# no budget at all while the override is in force.
assert provider.get_context_length("gpt-6-astra") is None


class TestAnthropicProvider:
"""Anthropic provider — Claude credentials + bundled YAML metadata."""

Expand Down
Loading