Skip to content

The agent that grows with you

fix(fast): send service_tier on the openai-api route and accept operator OpenAI tiers

Victor Kyriazakos60ce574905b8
diff --git a/hermes_cli/models.py b/hermes_cli/models.py
index 2e1a9d4be47..efe4d49f944 100644
--- a/hermes_cli/models.py
+++ b/hermes_cli/models.py
@@ -1179,7 +1179,11 @@ def _fast_mode_route_supported(
elif is_grok_46_family(str(model_id or "")):
allowed = {"xai": "api.x.ai"}
else:
- allowed = {"openai": "api.openai.com", "openai-codex": "chatgpt.com"}
+ allowed = {
+ "openai": "api.openai.com",
+ "openai-api": "api.openai.com",
+ "openai-codex": "chatgpt.com",
+ }
if provider and normalize_provider(provider) not in allowed:
return False
host = (urlparse(str(base_url or "")).hostname or "").lower()
diff --git a/tests/agent/test_openai_ultrafast.py b/tests/agent/test_openai_ultrafast.py
index 8aeda25091c..e39ceed6d0e 100644
--- a/tests/agent/test_openai_ultrafast.py
+++ b/tests/agent/test_openai_ultrafast.py
@@ -33,6 +33,7 @@ def test_every_config_loader_parses_tiers_through_the_same_table(monkeypatch):
@pytest.mark.parametrize("provider,base_url", [("openai", "https://api.openai.com/v1"),
+ ("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:
@@ -42,22 +43,25 @@ def test_ultrafast_is_requested_only_for_ultrafast_models_on_first_party_routes(
# 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
- # Proxies never see the tier.
+ # 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
-def test_cli_and_gateway_turn_routes_send_the_static_tier():
[email protected]("provider", ["openai", "openai-api"])
+def test_cli_and_gateway_turn_routes_send_the_static_tier(provider):
import cli as cli_mod
from gateway.run import GatewayRunner
- stub = SimpleNamespace(model="gpt-6-astra", api_key="k", base_url="https://api.openai.com/v1", provider="openai",
+ stub = SimpleNamespace(model="gpt-6-astra", api_key="k", base_url="https://api.openai.com/v1", provider=provider,
api_mode="codex_responses", acp_command=None, acp_args=[], _credential_pool=None,
service_tier="ultrafast")
assert cli_mod.HermesCLI._resolve_turn_agent_config(stub, "hi")["request_overrides"] == {"service_tier": "ultrafast"}
runner = object.__new__(GatewayRunner)
runner._service_tier = "ultrafast"
- rk = {"api_key": "k", "base_url": "https://api.openai.com/v1", "provider": "openai", "api_mode": "codex_responses",
+ rk = {"api_key": "k", "base_url": "https://api.openai.com/v1", "provider": provider, "api_mode": "codex_responses",
"command": None, "args": [], "credential_pool": None, "max_tokens": None}
assert runner._resolve_turn_agent_config("hi", "gpt-6-astra", rk)["request_overrides"] == {"service_tier": "ultrafast"}
diff --git a/website/docs/user-guide/configuration.md b/website/docs/user-guide/configuration.md
index a71c321f119..16eec2d448c 100644
--- a/website/docs/user-guide/configuration.md
+++ b/website/docs/user-guide/configuration.md
@@ -1957,11 +1957,11 @@ The override applies automatically everywhere: CLI startup, `hermes -p` one-shot
## Fast Mode
-Fast mode asks the provider for faster output at a premium price: OpenAI [Priority Processing](https://openai.com/api-priority-processing/) (`service_tier: priority`), xAI Priority Processing on Grok 4.6, and Anthropic [Fast Mode](https://platform.claude.com/docs/en/build-with-claude/fast-mode) (`speed: fast`, Opus 4.8 / Opus 5 / Opus 5.5 only). It is **off by default**.
+Fast mode asks the provider for faster output at a premium price: OpenAI [Priority Processing](https://openai.com/api-priority-processing/) (`service_tier: priority`) and Ultrafast (`service_tier: ultrafast`) on supported OpenAI models, xAI Priority Processing on Grok 4.6, and Anthropic [Fast Mode](https://platform.claude.com/docs/en/build-with-claude/fast-mode) (`speed: fast`, Opus 4.8 / Opus 5 / Opus 5.5 only). The `openai` and `openai-api` providers use the first-party OpenAI endpoint. It is **off by default**.
```yaml
agent:
- service_tier: "" # "" / normal | fast | auto | cold
+ service_tier: "" # "" / normal | fast | priority | ultrafast | auto | cold
fast_auto_seconds: 60 # window for auto / cold
```
@@ -1972,7 +1972,7 @@ agent:
| `auto` | Requests in the first `fast_auto_seconds` of **every** turn | Snappy first reply; long tool loops fall back to standard pricing |
| `cold` | Same window, but only on the **first turn** of a session (no prior history) | Fast onboarding reply, standard pricing afterwards |
-`/fast normal|fast|auto|cold` switches the mode for the session; add `--global` to persist to `config.yaml`. `/fast` alone shows the current mode.
+`/fast normal|fast|ultrafast|auto|cold` switches the mode for the session. Add `--global` to persist to `config.yaml`. `/fast` alone shows the current mode.
**Cost note:** both providers bill fast requests at a multiplier on standard rates (Anthropic: $8 / $40 per MTok in/out on Opus 5.5, $10 / $50 on Opus 5 and Opus 4.8), stacking with prompt-cache pricing. Hermes prices each Anthropic response from the speed the API reports in `usage.speed`. `auto`/`cold` bound that premium to the window only. Fast params are only sent to the first-party endpoint that supports them (`api.openai.com` / Codex subscription, `api.anthropic.com`, `api.x.ai`); OpenRouter, Nous Portal, Copilot, Azure, Bedrock, and custom `base_url` routes never receive them in any mode.