The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(models): enable Sol Ultrafast requests and pricing
Popkov,Daniilf1c1b34cdcb8
diff --git a/agent/usage_pricing.py b/agent/usage_pricing.pyindex 91fdfa908d2..cdaae103a1a 100644--- a/agent/usage_pricing.py+++ b/agent/usage_pricing.py@@ -7,7 +7,7 @@ from datetime import datetime, timezone, UTCfrom decimal import Decimalfrom typing import Any, Dict, Literal, Optional-from agent.model_metadata import fetch_endpoint_model_metadata, fetch_model_metadata+from agent.model_metadata import fetch_endpoint_model_metadata, fetch_model_metadata, strip_codex_context_variant_suffixfrom utils import base_url_host_matches, base_url_hostname, base_url_originlogger = logging.getLogger(__name__)@@ -310,6 +310,16 @@ _OPENAI_ULTRAFAST_PRICING: dict[str, PricingEntry] = {cache_read_cost_per_million_above=Decimal("12.00"),cache_write_cost_per_million_above=Decimal("150.00"),),+ "gpt-6.1-sol": _snap(+ "12.00", "60.00", "0.60", "15.00",+ url="https://developers.openai.com/api/docs/pricing?latest-pricing=ultrafast",+ version="openai-ultrafast-2026-10-08",+ tier_threshold_tokens=272_000,+ input_cost_per_million_above=Decimal("24.00"),+ output_cost_per_million_above=Decimal("90.00"),+ cache_read_cost_per_million_above=Decimal("1.20"),+ cache_write_cost_per_million_above=Decimal("30.00"),+ ),}# Context-tiered Gemini Pro: above 200k prompt tokens the *_above rates apply to@@ -425,6 +435,8 @@ def resolve_billing_route(elif provider_name == "fireworks" or host("api.fireworks.ai"):snapshot_provider = "fireworks"if snapshot_provider:+ if snapshot_provider == "openai":+ bare = strip_codex_context_variant_suffix(bare)return BillingRoute(provider=snapshot_provider, model=bare, base_url=url, billing_mode="official_docs_snapshot")if provider_name in {"custom", "local"} or (base and base_url_hostname(base) in ("localhost", "127.0.0.1")):return BillingRoute(provider=provider_name or "custom", model=model, base_url=url, billing_mode="unknown")diff --git a/hermes_cli/models_catalog_static.py b/hermes_cli/models_catalog_static.pyindex 055294bc989..3a7034833ee 100644--- a/hermes_cli/models_catalog_static.py+++ b/hermes_cli/models_catalog_static.py@@ -582,10 +582,10 @@ _LIVE_FIRST_PICKER_PROVIDERS: frozenset[str] = frozenset({"opencode-zen", "openc# positives are harmless. Codex-series models are excluded — the Codex Responses API doesn't# expose service_tier._OPENAI_FAST_MODE_PREFIXES: tuple[str, ...] = ("gpt-", "o1", "o3", "o4")-# OpenAI Ultrafast (service_tier="ultrafast", 6x Standard): broadly available for GPT-6 Astra only-# (developers.openai.com/api/docs/guides/ultrafast-mode, 2026-09-29); GPT-6.1 Sol "coming soon".+# OpenAI Ultrafast (service_tier="ultrafast", 6x Standard): GPT-6 Astra and GPT-6.1 Sol+# (developers.openai.com/api/docs/guides/ultrafast-mode, 2026-10-08).# Exact wire slugs, matched after stripping the vendor prefix and the Hermes-side ``-900k`` alias.-_OPENAI_ULTRAFAST_MODELS: frozenset[str] = frozenset({"gpt-6-astra"})+_OPENAI_ULTRAFAST_MODELS: frozenset[str] = frozenset({"gpt-6-astra", "gpt-6.1-sol"})# Providers where models.dev is authoritative: the curated list is an offline fallback plus customdiff --git a/tests/agent/test_openai_ultrafast.py b/tests/agent/test_openai_ultrafast.pyindex e41955c49ad..63159b484a8 100644--- a/tests/agent/test_openai_ultrafast.py+++ b/tests/agent/test_openai_ultrafast.py@@ -14,7 +14,8 @@ from agent.usage_pricing import ()from hermes_cli.models import model_supports_ultrafast, resolve_fast_mode_overrides-ASTRA_SPELLINGS = ("gpt-6-astra", "openai/gpt-6-astra", "gpt-6-astra-900k")+ASTRA_SPELLINGS = ("gpt-6-astra", "openai/gpt-6-astra", "gpt-6-astra-900k", "openai/gpt-6-astra-900k")+SOL_SPELLINGS = ("gpt-6.1-sol", "openai/gpt-6.1-sol", "gpt-6.1-sol-900k", "openai/gpt-6.1-sol-900k")def test_every_config_loader_parses_tiers_through_the_same_table(monkeypatch):@@ -36,32 +37,38 @@ def test_every_config_loader_parses_tiers_through_the_same_table(monkeypatch):("openai-api", "https://api.openai.com/v1"),("openai-codex", "https://chatgpt.com/backend-api/codex")])def test_ultrafast_is_requested_only_for_ultrafast_models_on_first_party_routes(provider, base_url):- for model in ASTRA_SPELLINGS:+ for model in (*ASTRA_SPELLINGS, *SOL_SPELLINGS):assert model_supports_ultrafast(model), modelassert resolve_fast_mode_overrides(model, provider=provider, base_url=base_url, tier="ultrafast") == {"service_tier": "ultrafast"}# A Priority-capable model without Ultrafast gets nothing, never a silent swap to another paid tier.assert resolve_fast_mode_overrides("gpt-6-sol", provider=provider, base_url=base_url) == {"service_tier": "priority"}- assert resolve_fast_mode_overrides("gpt-6-sol", provider=provider, base_url=base_url, tier="ultrafast") is None+ for model in ("gpt-6-sol", "gpt-6.1-sol-pro", "gpt-6.1-sol-mini", "gpt-6.1-sol-codex", "gpt-6.1-sol-preview"):+ assert not model_supports_ultrafast(model), model+ assert resolve_fast_mode_overrides(model, provider=provider, base_url=base_url, tier="ultrafast") is None# Proxies never see the tier, even under a first-party provider name.- assert resolve_fast_mode_overrides("openai/gpt-6-astra", provider="openrouter",- base_url="https://openrouter.ai/api/v1", tier="ultrafast") is None- assert resolve_fast_mode_overrides("gpt-6-astra", provider="openai-api",- base_url="https://proxy.example/v1", tier="ultrafast") is None+ for model in (*ASTRA_SPELLINGS, *SOL_SPELLINGS):+ assert resolve_fast_mode_overrides(model, provider="openrouter",+ base_url="https://openrouter.ai/api/v1", tier="ultrafast") is None+ assert resolve_fast_mode_overrides(model, provider="openai-api",+ base_url="https://proxy.example/v1", tier="ultrafast") is Nonedef test_desktop_surfaces_carry_the_exact_tier_ultrafast_is_never_plain_fast():from hermes_cli.inventory import _apply_capabilitiesfrom tui_gateway.methods_session_model_guard import create_overrides- rows = [{"slug": "openai-codex", "models": ["gpt-6-astra-900k", "gpt-6-sol", "gpt-daybreak-blue-latest-900k"]},- {"slug": "openrouter", "models": ["openai/gpt-6-astra"]}]+ rows = [{"slug": "openai-codex", "models": ["gpt-6-astra-900k", *SOL_SPELLINGS[::2], "gpt-6-sol", "gpt-daybreak-blue-latest-900k"]},+ {"slug": "openrouter", "models": ["openai/gpt-6-astra", "openai/gpt-6.1-sol"]}]_apply_capabilities(rows)caps = {m: c for row in rows for m, c in row["capabilities"].items()}assert caps["gpt-6-astra-900k"]["fast"] and caps["gpt-6-astra-900k"].get("ultrafast")+ for model in SOL_SPELLINGS[::2]:+ assert caps[model]["fast"] and caps[model].get("ultrafast"), modelassert caps["gpt-6-sol"]["fast"] and not caps["gpt-6-sol"].get("ultrafast")assert caps["gpt-daybreak-blue-latest-900k"]["fast"] and not caps["gpt-daybreak-blue-latest-900k"].get("ultrafast")assert not caps["openai/gpt-6-astra"]["fast"] and not caps["openai/gpt-6-astra"].get("ultrafast") # proxy route+ assert not caps["openai/gpt-6.1-sol"]["fast"] and not caps["openai/gpt-6.1-sol"].get("ultrafast")for params, tier in (({"fast": True, "service_tier": "ultrafast"}, "ultrafast"),({"fast": True, "service_tier": "normal"}, ""), ({"fast": True}, "priority"), ({}, None)):assert create_overrides(params)[2] == tier, params@@ -106,18 +113,43 @@ def _usage(prompt_uncached: int, served_tier=None) -> CanonicalUsage:@pytest.mark.parametrize("prompt_uncached", [50_000, 400_000]) # below / above the 272K whole-request tier-def test_served_ultrafast_bills_at_the_ultrafast_row_and_requested_only_does_not(prompt_uncached):- for model in _OPENAI_ULTRAFAST_PRICING:- standard = estimate_usage_cost(model, _usage(prompt_uncached), provider="openai-api")- served_default = estimate_usage_cost(model, _usage(prompt_uncached, "default"), provider="openai-api")- ultra = estimate_usage_cost(model, _usage(prompt_uncached, "ultrafast"), provider="openai-api")- assert served_default.amount_usd == standard.amount_usd # asked for Ultrafast, served at Standard- assert ultra.pricing_version == _OPENAI_ULTRAFAST_PRICING[model].pricing_version- assert ultra.amount_usd == standard.amount_usd * 6 # every bucket, both context tiers---def test_served_ultrafast_on_a_model_without_a_published_rate_is_unknown():- assert estimate_usage_cost("gpt-6-sol", _usage(1_000, "ultrafast"), provider="openai-api").status == "unknown"[email protected]("model", [*ASTRA_SPELLINGS, *SOL_SPELLINGS])+def test_served_ultrafast_bills_at_the_ultrafast_row_and_requested_only_does_not(prompt_uncached, model):+ standard = estimate_usage_cost(model, _usage(prompt_uncached), provider="openai-api")+ served_default = estimate_usage_cost(model, _usage(prompt_uncached, "default"), provider="openai-api")+ ultra = estimate_usage_cost(model, _usage(prompt_uncached, "ultrafast"), provider="openai-api")+ assert served_default.amount_usd == standard.amount_usd # asked for Ultrafast, served at Standard+ assert ultra.status == "estimated"+ wire_model = model.removeprefix("openai/").removesuffix("-900k")+ assert ultra.pricing_version == _OPENAI_ULTRAFAST_PRICING[wire_model].pricing_version+ assert ultra.amount_usd == standard.amount_usd * 6 # every bucket, both context tiers++[email protected]("model", ["gpt-6-sol", "gpt-6.1-sol-pro", "gpt-6.1-sol-preview-900k"])+def test_served_ultrafast_on_a_model_without_a_published_rate_is_unknown(model):+ assert estimate_usage_cost(model, _usage(1_000, "ultrafast"), provider="openai-api").status == "unknown"++[email protected]("model", SOL_SPELLINGS)+def test_sol_ultrafast_codex_request_uses_the_wire_slug_and_keeps_subscription_accounting(model):+ from agent.fast_mode import effective_request_overrides+ from agent.transports.codex import ResponsesApiTransport+ from hermes_cli.model_normalize import normalize_model_for_provider++ base_url = "https://chatgpt.com/backend-api/codex"+ runtime_model = normalize_model_for_provider(model, "openai-codex")+ overrides = resolve_fast_mode_overrides(runtime_model, provider="openai-codex", base_url=base_url, tier="ultrafast")+ agent = SimpleNamespace(service_tier="ultrafast", request_overrides=overrides)+ transport = ResponsesApiTransport()+ kwargs = transport.build_kwargs(+ runtime_model, [{"role": "user", "content": "hi"}], provider="openai-codex", base_url=base_url,+ is_codex_backend=True, request_overrides=effective_request_overrides(agent),+ )+ wire = transport.preflight_kwargs(kwargs, sanitize_harmony_tokens=True)+ assert wire["service_tier"] == "ultrafast"+ assert wire["model"] == "gpt-6.1-sol"+ cost = estimate_usage_cost(model, _usage(1_000, "ultrafast"), provider="openai-codex", base_url=base_url)+ assert cost.status == "included" and cost.pricing_version == "included-route"def test_codex_stream_assembler_keeps_the_served_tier():diff --git a/website/docs/user-guide/configuring-models.md b/website/docs/user-guide/configuring-models.mdindex cb36a867a7e..b6b21aaec19 100644--- a/website/docs/user-guide/configuring-models.md+++ b/website/docs/user-guide/configuring-models.md@@ -49,7 +49,7 @@ Pick a model, hit **Switch**, and Hermes writes it to `~/.hermes/config.yaml` un### Subscription speed and extended context-Speed is separate from reasoning effort. On supported subscription models, **Fast** requests Priority; **Ultrafast** requests Astra's Ultrafast tier. Selecting one clears the other. The chosen tier is remembered per model and carried into a new chat. The profile default lives under **Settings → Model → Main model → Speed** (`agent.service_tier`: `normal`, `fast` or `ultrafast`); Ultrafast is listed only for models that offer it. A legacy setting can be cleared with **Use standard speed**. An accepted request does not guarantee that OpenAI served the requested tier.+Speed is separate from reasoning effort. On supported subscription models, **Fast** requests Priority; **Ultrafast** requests the Ultrafast tier. Selecting one clears the other. The chosen tier is remembered per model and carried into a new chat. The profile default lives under **Settings → Model → Main model → Speed** (`agent.service_tier`: `normal`, `fast` or `ultrafast`); Ultrafast is listed only for models that offer it. A legacy setting can be cleared with **Use standard speed**. An accepted request does not guarantee that OpenAI served the requested tier.Hermes creates the **GPT-6.1 Sol-900k** choice from an eligible discovered GPT-6.1 Sol model. The `-900k` suffix is a local context choice, removed from the model ID sent to OpenAI. Hermes limits its budget to the account catalog's maximum, and Codex may report a smaller usable context after its own reserve. Use **Refresh models** if a new model is absent. A failed discovery uses short-lived compatibility hints instead of caching them as a successful account catalog.