Skip to content

The agent that grows with you

Free tier: separate 'account exists' from 'runs this chat', and stop the mint from writing active_provider (#127486)

Siddharth Balyan3a439b69ad8a
diff --git a/apps/desktop/electron/remote-lifecycle.test.ts b/apps/desktop/electron/remote-lifecycle.test.ts
index 2eadadf1035..d2e9acbda42 100644
--- a/apps/desktop/electron/remote-lifecycle.test.ts
+++ b/apps/desktop/electron/remote-lifecycle.test.ts
@@ -810,7 +810,7 @@ test.skipIf(process.platform !== 'linux')(
await mkdir(venvBin, { recursive: true })
await symlink(python, pythonLink)
await writeFile(entrypoint, 'import time\ntime.sleep(30)\n', 'utf8')
- await writeFile(launcher, `#!/bin/bash\nexec "${pythonLink}" "${entrypoint}" "$@"\n`, 'utf8')
+ await writeFile(launcher, `#!/usr/bin/env bash\nexec "${pythonLink}" "${entrypoint}" "$@"\n`, 'utf8')
await chmod(launcher, 0o755)
const child = spawn(
diff --git a/apps/desktop/src/AGENTS.md b/apps/desktop/src/AGENTS.md
index c42f4c1bfb2..d5dee300dcd 100644
--- a/apps/desktop/src/AGENTS.md
+++ b/apps/desktop/src/AGENTS.md
@@ -101,7 +101,7 @@ reads/writes a stored pointer), `canonical-chat-creation.test.ts`, `canonical-ch
## Free tier surfaces (`src/store/free-tier*.ts`, Billing, statusbar chip, onboarding ready screen)
`$freeTierStatus` mirrors `free_tier.status` (pull; refreshed with the status snapshot and after a
-sign-in). `deriveBillingView` branches on `billing.free_tier` BEFORE `logged_in` (status
+sign-in). `deriveBillingView` branches on `billing.free_tier_account` BEFORE `logged_in` (status
`free_tier`: notice + one Sign in, Plan/Model/Connectors summary, no payment or usage rows); the
`logged_out` notice's Sign in opens the same dialog, never a portal link (a link writes no
credential). The sign-in dialog is a single claimed owner (first mount wins, like the
diff --git a/apps/desktop/src/app/contrib/onboarding-kickoff.ts b/apps/desktop/src/app/contrib/onboarding-kickoff.ts
index 061ff016d40..8f0ea9e2222 100644
--- a/apps/desktop/src/app/contrib/onboarding-kickoff.ts
+++ b/apps/desktop/src/app/contrib/onboarding-kickoff.ts
@@ -50,7 +50,7 @@ export interface OnboardingKickoffOptions extends Pick<
interface SetupStatus {
ready?: boolean
provider_configured?: boolean
- free_tier?: boolean
+ free_tier_route?: boolean
}
interface GuideSession {
@@ -61,7 +61,7 @@ interface GuideSession {
export async function adoptGuideSession(
setupProfile: string,
canonical: GuideSession,
- freeTier: SetupStatus['free_tier'],
+ freeTierRoute: SetupStatus['free_tier_route'],
resumeSession: OnboardingKickoffOptions['resumeSession'],
guideRequest: AmbientGatewayRequest
): Promise<void> {
@@ -89,7 +89,7 @@ export async function adoptGuideSession(
})
prefetchGuideCatalogs(canonical.id, adoptedRuntimeId ?? canonical.id)
- if (freeTier) {
+ if (freeTierRoute) {
await guideRequest('config.set', {
session_id: adoptedRuntimeId,
key: 'reasoning',
@@ -148,7 +148,7 @@ export function useOnboardingKickoff({
const canonical = registryHit?.sessions?.[0]
if (canonical?.id) {
- await adoptGuideSession(setupProfile, canonical, record.free_tier, resumeSession, guideRequest)
+ await adoptGuideSession(setupProfile, canonical, record.free_tier_route, resumeSession, guideRequest)
return true
}
@@ -160,13 +160,13 @@ export function useOnboardingKickoff({
const seedMessages = buildChatOnboardingSeedMessages(
pickOnboardingGreeting(),
- record.free_tier !== true,
+ record.free_tier_route !== true,
capabilities
)
const createOverrides: SessionCreateOverrides = { title: SETUP_CHAT_TITLE }
- if (record.free_tier) {
+ if (record.free_tier_route) {
createOverrides.reasoningEffort = 'minimal'
}
@@ -193,7 +193,7 @@ export function useOnboardingKickoff({
await adoptGuideSession(
setupProfile,
{ id: storedId ?? runtimeId },
- record.free_tier,
+ record.free_tier_route,
resumeSession,
guideRequest
)
diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/lifecycle.test.ts b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/lifecycle.test.ts
index 7d655fe74e6..a9f9bc06fff 100644
--- a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/lifecycle.test.ts
+++ b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/lifecycle.test.ts
@@ -19,7 +19,8 @@ function setupReadyContext(fromActiveSource: boolean): GatewayEventContext {
const payload = {
error: '',
finished_at: 1_700_000_100,
- free_tier: true,
+ free_tier_account: true,
+ free_tier_route: true,
has_identity: true,
inference_provider: 'nous',
other_providers: false,
diff --git a/apps/desktop/src/app/settings/billing/types.ts b/apps/desktop/src/app/settings/billing/types.ts
index 3d25389eab8..d09d6c61087 100644
--- a/apps/desktop/src/app/settings/billing/types.ts
+++ b/apps/desktop/src/app/settings/billing/types.ts
@@ -18,13 +18,13 @@ import type {
/**
* The gateway's `billing.state` payload as THIS app reads it: the shared shape
- * plus the free-tier fields newer gateways add. When `free_tier` is true there
+ * plus the free-tier fields newer gateways add. When `free_tier_account` is true there
* is no account behind the call — `logged_in` is false and there is no balance,
* card or usage — so the free-tier branch must be read before the logged-out
* one. Both fields are absent on older gateways.
*/
export type BillingStateResponse = SharedBillingStateResponse & {
- free_tier?: boolean
+ free_tier_account?: boolean
free_tier_model?: null | string
}
diff --git a/apps/desktop/src/app/settings/billing/use-billing-state.test.ts b/apps/desktop/src/app/settings/billing/use-billing-state.test.ts
index 10785b38537..9777ccf155e 100644
--- a/apps/desktop/src/app/settings/billing/use-billing-state.test.ts
+++ b/apps/desktop/src/app/settings/billing/use-billing-state.test.ts
@@ -85,7 +85,7 @@ describe('deriveBillingView', () => {
}
const free = deriveBillingView(
- okBilling({ ...loggedOutBillingState, free_tier: true }),
+ okBilling({ ...loggedOutBillingState, free_tier_account: true }),
okSubscription(loggedOutSubscriptionState),
b
)
@@ -265,7 +265,7 @@ describe('deriveBillingView', () => {
// A free-tier install is logged_in:false, so this branch must win — otherwise
// the generic "connect your account" notice sends the user to the portal.
const view = deriveBillingView(
- okBilling({ ...loggedOutBillingState, free_tier: true, free_tier_model: 'nous/welcome' }),
+ okBilling({ ...loggedOutBillingState, free_tier_account: true, free_tier_model: 'nous/welcome' }),
okSubscription(loggedOutSubscriptionState)
)
diff --git a/apps/desktop/src/app/settings/billing/use-billing-state.ts b/apps/desktop/src/app/settings/billing/use-billing-state.ts
index 1ae3c7ddb2c..60b28fc0d2f 100644
--- a/apps/desktop/src/app/settings/billing/use-billing-state.ts
+++ b/apps/desktop/src/app/settings/billing/use-billing-state.ts
@@ -218,7 +218,7 @@ export function deriveBillingView(
// Read BEFORE the logged-out branch: a free-tier install has no account, so
// `logged_in` is false and the generic "connect your account" notice would
// otherwise win and tell the user to go to the portal.
- if (billing.free_tier) {
+ if (billing.free_tier_account) {
return freeTierView(billing, b)
}
diff --git a/apps/desktop/src/components/onboarding/free-tier-intro.test.ts b/apps/desktop/src/components/onboarding/free-tier-intro.test.ts
index 73f8eff31f6..f9b42c02b52 100644
--- a/apps/desktop/src/components/onboarding/free-tier-intro.test.ts
+++ b/apps/desktop/src/components/onboarding/free-tier-intro.test.ts
@@ -23,7 +23,7 @@ function gatewayReturning(freeTier: FreeTierStatus, route = true) {
}
if (method === 'setup.runtime_check') {
- return { free_tier: route, ok: true } as T
+ return { free_tier_route: route, ok: true } as T
}
return { provider_configured: true } as T
diff --git a/apps/desktop/src/lib/runtime-readiness.ts b/apps/desktop/src/lib/runtime-readiness.ts
index 23b12ccce4a..6909d243941 100644
--- a/apps/desktop/src/lib/runtime-readiness.ts
+++ b/apps/desktop/src/lib/runtime-readiness.ts
@@ -4,7 +4,8 @@ export interface SetupStatusSnapshot {
* ones). Carried for consumers that read the record — readiness itself
* still keys on `provider_configured` + `setup.runtime_check`. */
ready?: boolean
- free_tier?: boolean
+ free_tier_account?: boolean
+ free_tier_route?: boolean
other_providers?: boolean
inference_provider?: string
/** Present only when the boot bootstrap could not create the free-tier
@@ -20,7 +21,7 @@ export interface RuntimeCheckSnapshot {
error?: string
/** True when the resolved route is the free tier rather than a credential of
* the user's own. Absent on older backends. */
- free_tier?: boolean
+ free_tier_route?: boolean
model?: string
ok?: boolean
provider?: string
@@ -130,7 +131,7 @@ export function interpretRuntimeReadiness(
// (free-tier chrome) don't have to re-issue setup.runtime_check. Left
// undefined when the check said nothing — "absent" and "false" differ.
const route = {
- freeTier: typeof signals.runtime?.free_tier === 'boolean' ? signals.runtime.free_tier : undefined,
+ freeTier: typeof signals.runtime?.free_tier_route === 'boolean' ? signals.runtime.free_tier_route : undefined,
model: normalizeMessage(signals.runtime?.model) ?? undefined
}
diff --git a/apps/desktop/src/store/free-tier.ts b/apps/desktop/src/store/free-tier.ts
index 4591b73a21d..6c95b29d65f 100644
--- a/apps/desktop/src/store/free-tier.ts
+++ b/apps/desktop/src/store/free-tier.ts
@@ -153,7 +153,7 @@ export async function ackFreeTierNotice(requestGateway: FreeTierRequester): Prom
}
/**
- * Whether the SELECTED route runs on the free tier: `setup.runtime_check.free_tier`, keyed on the
+ * Whether the SELECTED route runs on the free tier: `setup.runtime_check.free_tier_route`, keyed on the
* endpoint the backend resolved, not on profile state. `null` until a readiness round answers. A
* free-tier identity beside the user's own key reads `false` here while `$freeTierStatus.available`
* stays true — that split is what picks the intro's shape.
diff --git a/apps/desktop/src/types/hermes.ts b/apps/desktop/src/types/hermes.ts
index 3988067ed8e..bab1d31360f 100644
--- a/apps/desktop/src/types/hermes.ts
+++ b/apps/desktop/src/types/hermes.ts
@@ -149,7 +149,7 @@ export interface OAuthPollResponse {
export interface FreeTierStatus {
/** An identity exists AND the free tier is on: connectors ride on it, and so
* does inference when nothing else carries it. Whether inference actually
- * runs on it is the ROUTE's answer (`setup.runtime_check.free_tier`). */
+ * runs on it is the ROUTE's answer (`setup.runtime_check.free_tier_route`). */
available: boolean
enabled: boolean
has_guest: boolean
diff --git a/apps/shared/src/gateway-contract.generated.ts b/apps/shared/src/gateway-contract.generated.ts
index 33dbe663d6d..d6f7d4534f5 100644
--- a/apps/shared/src/gateway-contract.generated.ts
+++ b/apps/shared/src/gateway-contract.generated.ts
@@ -32,11 +32,11 @@ export interface UsageBar {
fill_fraction: number
}
export type UsageBarKind = 'plan' | 'topup'
-/** ``_serialize_billing_state`` (money as strings); the ``except`` fallback emits only ``ok / logged_in / free_tier / error``, so everything else is optional. */
+/** ``_serialize_billing_state`` (money as strings); the ``except`` fallback emits only ``ok / logged_in / free_tier_account / error``, so everything else is optional. */
export interface BillingStateResult {
ok: boolean
logged_in: boolean
- free_tier?: boolean
+ free_tier_account?: boolean
free_tier_model?: string | null
org_name?: string | null
org_slug?: string | null
@@ -588,29 +588,33 @@ export interface McpServerStatus {
error?: string | null
[key: string]: unknown
}
-/** ``provider_configured`` is the loose answer; the boot record's fields (``ready``, ``free_tier``, ``other_providers``, ``inference_provider``) ride along on the launch profile. An unknown ``profile`` answers ``ok=False`` + ``error``. */
+/** ``provider_configured`` is the loose answer; the boot record's fields (``ready``, ``free_tier_account``, ``free_tier_route``, ``other_providers``, ``inference_provider``) ride along on the launch profile. An unknown ``profile`` answers ``ok=False`` + ``error``. */
export interface SetupStatusResult {
provider_configured?: boolean | null
ready?: boolean | null
- free_tier?: boolean | null
+ free_tier_account?: boolean | null
+ free_tier_route?: boolean | null
other_providers?: boolean | null
inference_provider?: string | null
profile?: string | null
ok?: boolean | null
error?: string | null
+ error_code?: string | null
+ retryable?: boolean | null
+ retry_after?: number | null
}
export interface SetupRuntimeCheckParams {
profile?: string | null
provider?: string | null
}
-/** ``ok=False`` + ``error`` when the resolved model can't be served; ``free_tier`` says the selected route is the welcome host. */
+/** ``ok=False`` + ``error`` when the resolved model can't be served; ``free_tier_route`` says the selected route is the welcome host. */
export interface SetupRuntimeCheckResult {
ok: boolean
provider?: string | null
model?: string | null
source?: string | null
error?: string | null
- free_tier?: boolean | null
+ free_tier_route?: boolean | null
profile?: string | null
}
export interface DiagnosticsShareNousParams {
@@ -626,7 +630,7 @@ export interface DiagnosticsShareNousResult {
expires_at?: string | null
error?: string | null
}
-/** ``available`` = an identity exists AND the tier is on; whether inference runs on it is ``setup.runtime_check.free_tier``'s question. */
+/** ``available`` = an identity exists AND the tier is on; whether inference runs on it is ``setup.runtime_check.free_tier_route``'s question. */
export interface FreeTierStatusResult {
has_guest: boolean
enabled: boolean
@@ -634,11 +638,18 @@ export interface FreeTierStatusResult {
notice_pending: boolean
model: string
label: string
+ error?: string | null
+ error_code?: string | null
+ retryable?: boolean | null
+ retry_after?: number | null
}
export interface FreeTierProvisionResult {
has_guest: boolean
enabled: boolean
error?: string | null
+ error_code?: string | null
+ retryable?: boolean | null
+ retry_after?: number | null
}
export interface FreeTierAckNoticeResult {
acked: boolean
@@ -4504,7 +4515,8 @@ export interface SkinPayload {
export interface SetupReadyPayload {
provider_configured: boolean
inference_provider: string
- free_tier: boolean
+ free_tier_account: boolean
+ free_tier_route: boolean
has_identity: boolean
other_providers: boolean
error?: string
diff --git a/apps/shared/src/gateway-contract.openrpc.json b/apps/shared/src/gateway-contract.openrpc.json
index 9287d10ee66..7a63156f324 100644
--- a/apps/shared/src/gateway-contract.openrpc.json
+++ b/apps/shared/src/gateway-contract.openrpc.json
@@ -6408,7 +6408,7 @@
},
"BillingStateResult": {
"additionalProperties": false,
- "description": "``_serialize_billing_state`` (money as strings); the ``except`` fallback emits only\n``ok / logged_in / free_tier / error``, so everything else is optional.",
+ "description": "``_serialize_billing_state`` (money as strings); the ``except`` fallback emits only\n``ok / logged_in / free_tier_account / error``, so everything else is optional.",
"properties": {
"ok": {
"title": "Ok",
@@ -6418,9 +6418,9 @@
"title": "Logged In",
"type": "boolean"
},
- "free_tier": {
+ "free_tier_account": {
"default": false,
- "title": "Free Tier",
+ "title": "Free Tier Account",
"type": "boolean"
},
"free_tier_model": {
@@ -13929,6 +13929,42 @@
],
"default": null,
"title": "Error"
+ },
+ "error_code": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Error Code"
+ },
+ "retryable": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Retryable"
+ },
+ "retry_after": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Retry After"
}
},
"required": [
@@ -13940,7 +13976,7 @@
},
"FreeTierStatusResult": {
"additionalProperties": false,
- "description": "``available`` = an identity exists AND the tier is on; whether inference runs on it is\n``setup.runtime_check.free_tier``'s question.",
+ "description": "``available`` = an identity exists AND the tier is on; whether inference runs on it is\n``setup.runtime_check.free_tier_route``'s question.",
"properties": {
"has_guest": {
"title": "Has Guest",
@@ -13965,6 +14001,54 @@
"label": {
"title": "Label",
"type": "string"
+ },
+ "error": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Error"
+ },
+ "error_code": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Error Code"
+ },
+ "retryable": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Retryable"
+ },
+ "retry_after": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Retry After"
}
},
"required": [
@@ -31908,8 +31992,12 @@
"title": "Inference Provider",
"type": "string"
},
- "free_tier": {
- "title": "Free Tier",
+ "free_tier_account": {
+ "title": "Free Tier Account",
+ "type": "boolean"
+ },
+ "free_tier_route": {
+ "title": "Free Tier Route",
"type": "boolean"
},
"has_identity": {
@@ -31969,7 +32057,8 @@
"required": [
"provider_configured",
"inference_provider",
- "free_tier",
+ "free_tier_account",
+ "free_tier_route",
"has_identity",
"other_providers",
"finished_at"
@@ -32010,7 +32099,7 @@
},
"SetupRuntimeCheckResult": {
"additionalProperties": false,
- "description": "``ok=False`` + ``error`` when the resolved model can't be served; ``free_tier`` says the\nselected route is the welcome host.",
+ "description": "``ok=False`` + ``error`` when the resolved model can't be served; ``free_tier_route`` says the\nselected route is the welcome host.",
"properties": {
"ok": {
"title": "Ok",
@@ -32064,7 +32153,7 @@
"default": null,
"title": "Error"
},
- "free_tier": {
+ "free_tier_route": {
"anyOf": [
{
"type": "boolean"
@@ -32074,7 +32163,7 @@
}
],
"default": null,
- "title": "Free Tier"
+ "title": "Free Tier Route"
},
"profile": {
"anyOf": [
@@ -32097,7 +32186,7 @@
},
"SetupStatusResult": {
"additionalProperties": false,
- "description": "``provider_configured`` is the loose answer; the boot record's fields (``ready``,\n``free_tier``, ``other_providers``, ``inference_provider``) ride along on the launch profile.\nAn unknown ``profile`` answers ``ok=False`` + ``error``.",
+ "description": "``provider_configured`` is the loose answer; the boot record's fields (``ready``,\n``free_tier_account``, ``free_tier_route``, ``other_providers``, ``inference_provider``) ride along\non the launch profile. An unknown ``profile`` answers ``ok=False`` + ``error``.",
"properties": {
"provider_configured": {
"anyOf": [
@@ -32123,7 +32212,7 @@
"default": null,
"title": "Ready"
},
- "free_tier": {
+ "free_tier_account": {
"anyOf": [
{
"type": "boolean"
@@ -32133,7 +32222,19 @@
}
],
"default": null,
- "title": "Free Tier"
+ "title": "Free Tier Account"
+ },
+ "free_tier_route": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Free Tier Route"
},
"other_providers": {
"anyOf": [
@@ -32194,6 +32295,42 @@
],
"default": null,
"title": "Error"
+ },
+ "error_code": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Error Code"
+ },
+ "retryable": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Retryable"
+ },
+ "retry_after": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Retry After"
}
},
"title": "SetupStatusResult",
diff --git a/gateway/run_notifications.py b/gateway/run_notifications.py
index ebc3e900ab2..e2b5612d7d4 100644
--- a/gateway/run_notifications.py
+++ b/gateway/run_notifications.py
@@ -930,11 +930,8 @@ class GatewayNotificationsMixin:
# is only consulted when a free-tier identity already exists and its own free-tier rung
# (which may mint on a fresh install, NS-829) answers from that identity without a network
# call. No token refresh at boot either way.
- from hermes_cli.auth import resolve_provider
- from hermes_cli.anon_auth import guest_carries_inference
- if not guest_carries_inference():
- return None
- if resolve_provider("auto") != "nous":
+ from hermes_cli.anon_auth import free_tier_route
+ if not free_tier_route():
return None
except Exception as exc:
logger.debug("Free tier startup line skipped: %s", exc)
diff --git a/gateway/slash_commands_status.py b/gateway/slash_commands_status.py
index 7c60eba9908..3f35f43f81b 100644
--- a/gateway/slash_commands_status.py
+++ b/gateway/slash_commands_status.py
@@ -288,12 +288,9 @@ class GatewayStatusCommandsMixin:
elif fields["model"]:
lines.append(t("gateway.status.model", model=fields["model"]))
try:
- from hermes_cli.auth import resolve_provider
- from hermes_cli.anon_auth import guest_carries_inference
+ from hermes_cli.anon_auth import free_tier_route
- free_tier_active = await self._run_in_executor_with_context(
- lambda: resolve_provider("auto") == "nous" and guest_carries_inference()
- )
+ free_tier_active = await self._run_in_executor_with_context(free_tier_route)
if free_tier_active:
lines.append(t("gateway.status.free_tier"))
except Exception:
diff --git a/hermes_cli/anon_auth.py b/hermes_cli/anon_auth.py
index 23fa9d33654..3161c21229f 100644
--- a/hermes_cli/anon_auth.py
+++ b/hermes_cli/anon_auth.py
@@ -3,9 +3,7 @@
The identity is created in exactly one place, at boot (``hermes_cli.free_tier_bootstrap``), and only
while ``HERMES_GUEST_ONBOARDING=1`` (see ``guest_enabled``). The bootstrap mints an anonymous Nous
account (``POST /api/anonymous/create``); its ``anon_`` credential is later exchanged for short-lived
-JWTs (``POST /api/anonymous/token``). The result is persisted as the singleton ``providers.nous``; it
-becomes ``active_provider`` only when the bootstrap's inventory found nothing else usable, so an
-install with its own key keeps that key for inference and uses the identity for connectors only. In
+JWTs (``POST /api/anonymous/token``). The result is persisted as the singleton ``providers.nous``. In
the resolver ladder (``resolve_provider``) an existing free-tier identity sits directly above the
implicit AWS Bedrock chain (NS-829): any explicit provider (env key, ``model.provider``, OpenRouter
pool, a logged-in ``active_provider``) beats it, and the ladder never creates one.
@@ -191,7 +189,7 @@ def has_guest() -> bool:
return is_guest_state(current_nous_state())
-def guest_carries_inference() -> bool:
+def has_free_tier_account() -> bool:
"""True when the profile's Nous identity is the free tier and the free tier is on.
Profile-level: use for status, picker and notice surfaces. Routing decisions (which model a
@@ -201,6 +199,11 @@ def guest_carries_inference() -> bool:
return guest_enabled() and has_guest()
+def free_tier_route() -> bool:
+ from hermes_cli.auth import resolve_provider
+ return has_free_tier_account() and resolve_provider("auto") == "nous"
+
+
WELCOME_HOSTS = frozenset({"welcome-api.nousresearch.com"})
# Dev-only: extra hostnames that count as the welcome host, comma-separated (for example
# ``127.0.0.1`` while ``NOUS_INFERENCE_BASE_URL`` points at a local stand-in). Read from the
@@ -370,16 +373,10 @@ def _shared_identity_key(state: Any) -> Optional[str]:
return state.get("anon_token") if is_guest_state(state) else state.get("refresh_token")
-def _mint_locked(
- client: httpx.Client, portal: str, auth_store: Dict[str, Any], *, carries_inference: bool = True,
-) -> Dict[str, Any]:
+def _mint_locked(client: httpx.Client, portal: str, auth_store: Dict[str, Any]) -> Dict[str, Any]:
"""Mint under the caller's locks. The identity is persisted as soon as ``create`` succeeds, BEFORE
the exchange: a 429 or timeout on the exchange must not lose a credential NAS still honours (the
- next attempt exchanges the stored one instead of minting again).
-
- ``carries_inference`` decides whether the new identity also becomes ``active_provider``. The
- bootstrap passes False when its inventory found another usable provider: the identity exists for
- connectors, the user's own provider keeps carrying inference (NS-845 Q1.3)."""
+ next attempt exchanges the stored one instead of minting again)."""
from hermes_cli.auth import _store_provider_state, _save_auth_store
from hermes_cli.auth_nous import _write_shared_nous_state
minted = mint_guest(client, portal)
@@ -390,7 +387,7 @@ def _mint_locked(
"user_id": minted.get("user_id"), "org_id": minted.get("org_id"),
"idle_ttl_days": minted.get("idle_ttl_days"),
}
- _store_provider_state(auth_store, "nous", state, set_active=carries_inference)
+ _store_provider_state(auth_store, "nous", state, set_active=False)
_save_auth_store(auth_store)
_write_shared_nous_state(state)
logger.info("Nous free tier ready (identity minted)")
@@ -495,14 +492,12 @@ def _note_mint_failure(err: AuthError) -> MintFailure:
return failure
-def _reconcile_and_provision(*, timeout_seconds: float, carries_inference: bool = True) -> Optional[Dict[str, Any]]:
+def _reconcile_and_provision(*, timeout_seconds: float) -> Optional[Dict[str, Any]]:
"""The lifecycle body, run under profile lock THEN shared lock (the documented order).
1. The shared store is the identity of record for this Hermes root. If it holds an identity
that differs from the profile's, the profile adopts it (a stale guest never outlives a
- sibling profile's sign-in, and never overwrites it). An adopted free-tier identity claims
- ``active_provider`` under the same rule as a mint; an adopted ACCOUNT always does (the user
- signed in somewhere on this machine).
+ sibling profile's sign-in, and never overwrites it).
2. Otherwise the profile's own identity stands.
3. Nothing anywhere: mint, persisting the credential before exchanging it.
"""
@@ -519,9 +514,7 @@ def _reconcile_and_provision(*, timeout_seconds: float, carries_inference: bool
shared = _read_shared_nous_state()
if shared and _shared_identity_key(shared) != _shared_identity_key(profile_state):
state = dict(shared)
- _store_provider_state(
- auth_store, "nous", state,
- set_active=carries_inference or not is_guest_state(state))
+ _store_provider_state(auth_store, "nous", state, set_active=not is_guest_state(state))
_save_auth_store(auth_store)
logger.debug("Nous identity adopted from the shared store")
return state
@@ -531,12 +524,11 @@ def _reconcile_and_provision(*, timeout_seconds: float, carries_inference: bool
return profile_state
verify = _resolve_verify(insecure=None, ca_bundle=None, auth_state=None)
with _nous_http_client(timeout_seconds, verify) as client:
- return _mint_locked(client, portal, auth_store, carries_inference=carries_inference)
+ return _mint_locked(client, portal, auth_store)
def ensure_portal_identity(
- *, explicit: bool, timeout_seconds: float = GUEST_MINT_TIMEOUT_SECONDS,
- carries_inference: bool = True, force: bool = False,
+ *, explicit: bool, timeout_seconds: float = GUEST_MINT_TIMEOUT_SECONDS, force: bool = False,
) -> Optional[Dict[str, Any]]:
"""Make sure this profile has a Nous identity (guest or account); mint a guest only if the shared
store has none. Returns the ``providers.nous`` state, or None (disabled / failed once already).
@@ -548,9 +540,7 @@ def ensure_portal_identity(
of reading status, resolving a provider or fetching a connector bearer (NS-845 Q1.2).
Order: ``guest_enabled`` gate -> reconcile with the shared store -> mint. Locks are taken profile
- first, then shared, matching every other Nous path. ``carries_inference=False`` leaves
- ``active_provider`` alone (the identity is for connectors; another provider does inference).
- Blocking, bounded by ``timeout_seconds``; the bootstrap puts it on its own thread.
+ first, then shared, matching every other Nous path. Blocking, bounded by ``timeout_seconds``; the bootstrap puts it on its own thread.
A failed mint is memoised with a cooldown (``MintFailure``): until it passes, and for a
terminal code forever, this returns None without touching the portal. ``force=True`` is the
@@ -566,8 +556,7 @@ def ensure_portal_identity(
if failure and not force and not current_nous_state() and time.monotonic() < failure.not_before:
return None # in cooldown (or terminal) for this profile; do not hammer the portal
try:
- state = _reconcile_and_provision(
- timeout_seconds=timeout_seconds, carries_inference=carries_inference)
+ state = _reconcile_and_provision(timeout_seconds=timeout_seconds)
except Exception as exc:
err = classify_mint_exception(exc)
noted = _note_mint_failure(err)
diff --git a/hermes_cli/banner.py b/hermes_cli/banner.py
index 8466f2e56fb..9a3d9dee57a 100644
--- a/hermes_cli/banner.py
+++ b/hermes_cli/banner.py
@@ -602,8 +602,8 @@ def _route_model_for_banner(provider: Any) -> str:
no network. Empty when nothing resolves, so the caller keeps its "no model configured" line."""
if (provider or "auto").strip().lower() not in ("auto", "nous"):
return ""
- from hermes_cli.anon_auth import GUEST_MODEL, guest_carries_inference
- return GUEST_MODEL if guest_carries_inference() else ""
+ from hermes_cli.anon_auth import GUEST_MODEL, free_tier_route
+ return GUEST_MODEL if free_tier_route() else ""
def _banner_left_lines(model: str, cwd: str, session_id, context_length, provider, *, accent: str, dim: str,
diff --git a/hermes_cli/cli_session_mixin.py b/hermes_cli/cli_session_mixin.py
index 4749cdcb19c..59371922bab 100644
--- a/hermes_cli/cli_session_mixin.py
+++ b/hermes_cli/cli_session_mixin.py
@@ -296,10 +296,9 @@ class CLISessionMixin:
lines = [t("cli.session.status_title"), "", *status_lines(fields, "session_id", "path", "title", "model")]
try:
- from hermes_cli.auth import resolve_provider
- from hermes_cli.anon_auth import guest_carries_inference
+ from hermes_cli.anon_auth import free_tier_route
- if resolve_provider("auto") == "nous" and guest_carries_inference():
+ if free_tier_route():
lines.append(t("gateway.status.free_tier"))
except Exception:
pass
diff --git a/hermes_cli/free_tier_bootstrap.py b/hermes_cli/free_tier_bootstrap.py
index 5ccdba1ca8a..bd895c5389a 100644
--- a/hermes_cli/free_tier_bootstrap.py
+++ b/hermes_cli/free_tier_bootstrap.py
@@ -34,7 +34,7 @@ class SetupRecord:
provider_configured: bool # some provider can carry inference (free tier included)
inference_provider: str # ``resolve_provider("auto")``'s answer, "" when nothing resolves
- free_tier: bool # the identity that exists is the free tier AND the tier is on
+ free_tier_account: bool # the identity that exists is the free tier AND the tier is on
has_identity: bool # a Nous identity (free tier or account) is on disk
other_providers: bool # the inventory found something usable BESIDES the free tier
error: str = "" # why the mint did not happen, when it did not; "" otherwise
@@ -44,11 +44,16 @@ class SetupRecord:
failure: Dict[str, Any] = field(default_factory=dict)
finished_at: float = field(default_factory=time.time)
+ @property
+ def free_tier_route(self) -> bool:
+ return self.free_tier_account and self.inference_provider == "nous"
+
def as_payload(self) -> Dict[str, Any]:
# The broadcast carries the failure block flat, the same shape ``setup.status`` spreads,
# so a client keys on ``error_code`` identically whichever surface it read.
payload = asdict(self)
payload.update(payload.pop("failure"))
+ payload["free_tier_route"] = self.free_tier_route
return payload
def failure_fields(self) -> Dict[str, Any]:
@@ -173,8 +178,7 @@ def _build_record(*, other: bool, force: bool) -> SetupRecord:
state: Optional[Dict[str, Any]] = anon_auth.current_nous_state()
if anon_auth.guest_enabled():
try:
- # ``other`` decides whether the mint may also claim ``active_provider`` (NS-845 Q1.3).
- state = anon_auth.ensure_portal_identity(explicit=True, carries_inference=not other, force=force)
+ state = anon_auth.ensure_portal_identity(explicit=True, force=force)
except Exception as exc:
error = str(exc)
logger.info("Nous free tier not set up at boot: %s", exc)
@@ -183,11 +187,11 @@ def _build_record(*, other: bool, force: bool) -> SetupRecord:
# cooldown still runs: the record carries that verdict either way.
failure = anon_auth.last_mint_failure() or {}
error = error or str(failure.get("error") or "")
- free_tier = bool(state) and anon_auth.is_guest_state(state) and anon_auth.guest_enabled()
+ free_tier_account = bool(state) and anon_auth.is_guest_state(state) and anon_auth.guest_enabled()
return SetupRecord(
- provider_configured=other or free_tier or (bool(state) and not anon_auth.is_guest_state(state)),
+ provider_configured=other or free_tier_account or (bool(state) and not anon_auth.is_guest_state(state)),
inference_provider=_resolve_inference(),
- free_tier=free_tier,
+ free_tier_account=free_tier_account,
has_identity=bool(state),
other_providers=other,
error=error,
diff --git a/tests/gateway/test_free_tier_startup_notice.py b/tests/gateway/test_free_tier_startup_notice.py
index 83f24c7b5be..aed88011611 100644
--- a/tests/gateway/test_free_tier_startup_notice.py
+++ b/tests/gateway/test_free_tier_startup_notice.py
@@ -69,7 +69,7 @@ async def _startup_message(runner, adapter) -> str:
async def test_guest_inference_adds_exactly_one_free_tier_line(nous_runner):
runner, adapter = nous_runner
_seed_nous(_guest_state())
- assert anon_auth.guest_carries_inference()
+ assert anon_auth.has_free_tier_account()
message = await _startup_message(runner, adapter)
@@ -82,7 +82,7 @@ async def test_guest_inference_adds_exactly_one_free_tier_line(nous_runner):
async def test_signed_in_account_keeps_the_plain_online_notice(nous_runner):
runner, adapter = nous_runner
_seed_nous(_account_state())
- assert not anon_auth.guest_carries_inference()
+ assert not anon_auth.has_free_tier_account()
message = await _startup_message(runner, adapter)
diff --git a/tests/gateway/test_status_free_tier_line.py b/tests/gateway/test_status_free_tier_line.py
index d76df468b43..9c2d78caa4a 100644
--- a/tests/gateway/test_status_free_tier_line.py
+++ b/tests/gateway/test_status_free_tier_line.py
@@ -92,13 +92,13 @@ async def test_status_omits_the_line_for_a_real_account():
async def test_a_status_gate_failure_never_breaks_status(monkeypatch):
runner = _runner()
_seed_nous(_free_tier_state())
- monkeypatch.setattr(anon_auth, "guest_carries_inference", lambda: False)
+ monkeypatch.setattr(anon_auth, "free_tier_route", lambda: False)
expected = await runner._handle_message(_make_event("/status"))
def broken_store():
raise RuntimeError("broken store")
- monkeypatch.setattr(anon_auth, "guest_carries_inference", broken_store)
+ monkeypatch.setattr(anon_auth, "free_tier_route", broken_store)
result = await runner._handle_message(_make_event("/status"))
diff --git a/tests/hermes_cli/test_anon_auth_core.py b/tests/hermes_cli/test_anon_auth_core.py
index 525f4f8f4e3..0f2690bc5a6 100644
--- a/tests/hermes_cli/test_anon_auth_core.py
+++ b/tests/hermes_cli/test_anon_auth_core.py
@@ -39,12 +39,13 @@ def _shared_store(tmp_path) -> dict:
class TestIdentityLifecycle:
- def test_fresh_install_mints_once_and_is_the_active_provider(self, portal, tmp_path):
+ def test_fresh_install_mints_once_and_resolves_without_claiming_active_provider(self, portal, tmp_path):
state = anon_auth.ensure_portal_identity(explicit=True)
assert anon_auth.is_guest_state(state)
assert "refresh_token" not in state
store = _load_auth_store()
- assert store["active_provider"] == "nous"
+ assert "active_provider" not in store
+ assert resolve_provider("auto") == "nous"
assert anon_auth.is_guest_state(store["providers"]["nous"])
assert _shared_store(tmp_path).get("anon_token") == state["anon_token"]
assert portal.minted == 1
@@ -320,7 +321,7 @@ class TestBootstrapIsTheOneCreator:
def test_bootstrap_mints_once_records_and_a_second_run_is_free(self, portal):
fb = self._fresh()
record = fb.run_bootstrap()
- assert record.free_tier and record.has_identity and record.provider_configured
+ assert record.free_tier_account and record.has_identity and record.provider_configured
assert record.inference_provider == "nous" and record.other_providers is False
assert portal.minted == 1
again = fb.run_bootstrap()
@@ -332,7 +333,7 @@ class TestBootstrapIsTheOneCreator:
fb = self._fresh()
record = fb.run_bootstrap()
assert record.other_providers is True and record.has_identity is True
- assert record.free_tier is True, "the identity exists for connectors"
+ assert record.free_tier_account is True, "the identity exists for connectors"
assert record.inference_provider != "nous"
assert _load_auth_store().get("active_provider") != "nous", "a mint beside an own key must not hijack inference"
assert portal.minted == 1
@@ -357,7 +358,7 @@ class TestBootstrapIsTheOneCreator:
portal.gate_closed = True
fb = self._fresh()
record = fb.run_bootstrap()
- assert record.has_identity is False and record.free_tier is False and record.error
+ assert record.has_identity is False and record.free_tier_account is False and record.error
assert [p for _, p in portal.calls].count("/api/anonymous/create") == 1
# The explicit retry (desktop free_tier.provision) is also memoised for the process.
assert anon_auth.ensure_portal_identity(explicit=True) is None
diff --git a/tests/hermes_cli/test_anon_failure_modes.py b/tests/hermes_cli/test_anon_failure_modes.py
index 0b61c672290..2ec4d268ded 100644
--- a/tests/hermes_cli/test_anon_failure_modes.py
+++ b/tests/hermes_cli/test_anon_failure_modes.py
@@ -198,7 +198,7 @@ class TestBootstrapRecord:
nas.create_response = httpx.Response(
429, json={"error": "temporarily_unavailable"}, headers={"Retry-After": "30"})
record = free_tier_bootstrap.run_bootstrap(announce=False)
- assert record.has_identity is False and record.free_tier is False
+ assert record.has_identity is False and record.free_tier_account is False
assert record.failure["error_code"] == anon_auth.ANON_RATE_LIMITED
assert record.failure["retryable"] is True and 28 <= record.failure["retry_after"] <= 30
assert record.failure_fields() == {
@@ -207,7 +207,7 @@ class TestBootstrapRecord:
def test_a_clean_boot_carries_no_failure_block(self, nas):
record = free_tier_bootstrap.run_bootstrap(announce=False)
- assert record.free_tier is True and record.failure_fields() == {}
+ assert record.free_tier_account is True and record.failure_fields() == {}
def test_the_background_loop_retries_a_transient_failure_until_it_settles(self, nas, monkeypatch):
nas.raise_transport = httpx.ConnectTimeout("no route")
@@ -223,7 +223,7 @@ class TestBootstrapRecord:
monkeypatch.setattr(free_tier_bootstrap, "_sleep", _sleep)
free_tier_bootstrap._bootstrap_then_retry()
record = free_tier_bootstrap.current_record()
- assert record.has_identity is True and record.free_tier is True
+ assert record.has_identity is True and record.free_tier_account is True
assert slept == [int(w) for w in anon_auth._MINT_RETRY_LADDER[:2]]
assert nas.creates() == 3
@@ -278,7 +278,7 @@ class TestBootstrapRecord:
free_tier_bootstrap.run_bootstrap(announce=False)
nas.raise_transport = None
record = free_tier_bootstrap.retry_bootstrap_mint(force=True, announce=False)
- assert record.free_tier is True and record.failure_fields() == {}
+ assert record.free_tier_account is True and record.failure_fields() == {}
assert free_tier_bootstrap.current_record() is record
diff --git a/tests/hermes_cli/test_banner.py b/tests/hermes_cli/test_banner.py
index 41d2d325aca..96b514d557c 100644
--- a/tests/hermes_cli/test_banner.py
+++ b/tests/hermes_cli/test_banner.py
@@ -49,7 +49,7 @@ def test_empty_model_shows_the_free_tier_route_when_it_carries_inference(tmp_pat
patch.object(banner, "get_available_skills", return_value={}),
patch.object(banner, "get_update_result", return_value=None),
patch.object(tools.mcp_tool_discovery, "get_mcp_status", return_value=[]),
- patch.object(anon_auth, "guest_carries_inference", return_value=carries),
+ patch.object(anon_auth, "free_tier_route", return_value=carries),
):
console = Console(record=True, force_terminal=False, color_system=None, width=160)
banner.build_welcome_banner(console=console, model="", cwd="/tmp/project", tools=[],
diff --git a/tests/hermes_cli/test_web_server.py b/tests/hermes_cli/test_web_server.py
index 9f39a4b392b..913455c2e9c 100644
--- a/tests/hermes_cli/test_web_server.py
+++ b/tests/hermes_cli/test_web_server.py
@@ -1414,7 +1414,7 @@ CONFIG_SCHEMA = ProviderConfigSchema(
broadcasts = []
monkeypatch.setattr(fb, "_broadcast", broadcasts.append)
with fb._lock:
- fb._record = fb.SetupRecord(provider_configured=False, inference_provider="", free_tier=False,
+ fb._record = fb.SetupRecord(provider_configured=False, inference_provider="", free_tier_account=False,
has_identity=False, other_providers=False)
fb._started = True
fb._done.set()
diff --git a/tests/tui_gateway/test_free_tier_rpc.py b/tests/tui_gateway/test_free_tier_rpc.py
index 3727f9ac9b3..9f3d5ddad65 100644
--- a/tests/tui_gateway/test_free_tier_rpc.py
+++ b/tests/tui_gateway/test_free_tier_rpc.py
@@ -82,13 +82,13 @@ def test_billing_state_answers_the_free_tier_locally(guest, monkeypatch):
monkeypatch.setattr(bv, "build_billing_state", lambda *a, **kw: pytest.fail("free tier must not call the portal"))
res = _call("billing.state")
assert res["ok"] is True and res["logged_in"] is False
- assert res["free_tier"] is True and res["free_tier_model"] == "nous/welcome"
+ assert res["free_tier_account"] is True and res["free_tier_model"] == "nous/welcome"
assert res["usage"] == {"available": False}
_set_guest_off(monkeypatch)
monkeypatch.setattr(bv, "build_billing_state", lambda *a, **kw: bv.BillingState(logged_in=False))
res = _call("billing.state")
- assert res["free_tier"] is False and res["free_tier_model"] is None
+ assert res["free_tier_account"] is False and res["free_tier_model"] is None
def test_status_without_an_identity_is_a_pure_read(tmp_path, monkeypatch):
diff --git a/tests/tui_gateway/test_tui_gateway_server.py b/tests/tui_gateway/test_tui_gateway_server.py
index 2c659bc6f12..5ff31f14006 100644
--- a/tests/tui_gateway/test_tui_gateway_server.py
+++ b/tests/tui_gateway/test_tui_gateway_server.py
@@ -9149,7 +9149,7 @@ def test_setup_status_answers_from_the_bootstrap_record_once_it_exists(monkeypat
def slow_bootstrap():
release.wait(5)
with fb._lock:
- fb._record = fb.SetupRecord(provider_configured=True, inference_provider="nous", free_tier=True,
+ fb._record = fb.SetupRecord(provider_configured=True, inference_provider="nous", free_tier_account=True,
has_identity=True, other_providers=False)
fb._done.set()
with fb._lock:
@@ -9159,7 +9159,7 @@ def test_setup_status_answers_from_the_bootstrap_record_once_it_exists(monkeypat
release.set()
resp = server.handle_request({"id": "1", "method": "setup.status", "params": {}})
assert resp["result"]["provider_configured"] is True
- assert resp["result"]["ready"] is True and resp["result"]["free_tier"] is True
+ assert resp["result"]["ready"] is True and resp["result"]["free_tier_account"] is True
assert resp["result"]["inference_provider"] == "nous"
finally:
fb.reset_for_tests()
@@ -9358,7 +9358,7 @@ def test_setup_runtime_check_scopes_launch_profile_in_multiplex_backend(monkeypa
"provider": "openai-codex",
"model": "gpt-5.3-codex",
"source": "credential-pool",
- "free_tier": False,
+ "free_tier_route": False,
}
@@ -17039,7 +17039,7 @@ def test_model_save_key_reconciles_the_launch_profiles_stale_setup_record(monkey
other_home.mkdir(parents=True)
monkeypatch.setattr(server, "_profile_home", lambda name: other_home if name == "other" else None)
fb.reset_for_tests()
- stale = fb.SetupRecord(provider_configured=False, inference_provider="", free_tier=False,
+ stale = fb.SetupRecord(provider_configured=False, inference_provider="", free_tier_account=False,
has_identity=False, other_providers=False)
with fb._lock:
fb._record, fb._started = stale, True
diff --git a/tui_gateway/billing_view.py b/tui_gateway/billing_view.py
index 48631bb7b9f..cf20f17480c 100644
--- a/tui_gateway/billing_view.py
+++ b/tui_gateway/billing_view.py
@@ -71,8 +71,8 @@ def _serialize_auto_reload(ar, format_money) -> dict | None:
"reload_to_display": format_money(ar.reload_to_usd), "card": card_out}
-def _serialize_billing_state(state, *, free_tier: bool = False) -> dict:
- """Serialize a BillingState for the wire (Decimals → strings, money-safe). ``free_tier`` marks the
+def _serialize_billing_state(state, *, free_tier_account: bool = False) -> dict:
+ """Serialize a BillingState for the wire (Decimals → strings, money-safe). ``free_tier_account`` marks the
Nous free tier: no account, no balance, nothing to pay; the renderer branches on it before
``logged_in``."""
from agent.billing_view import format_money
@@ -92,7 +92,7 @@ def _serialize_billing_state(state, *, free_tier: bool = False) -> dict:
"is_default_ceiling": m.is_default_ceiling}
return {
"ok": True, "logged_in": state.logged_in,
- "free_tier": bool(free_tier), "free_tier_model": GUEST_MODEL if free_tier else None,
+ "free_tier_account": bool(free_tier_account), "free_tier_model": GUEST_MODEL if free_tier_account else None,
"org_name": state.org_name,
"org_slug": state.org_slug, "role": state.role, "is_admin": state.is_admin,
"can_change_plan": state.can_change_plan, "can_charge": state.can_charge,
diff --git a/tui_gateway/contracts/billing_delegation_pets.py b/tui_gateway/contracts/billing_delegation_pets.py
index 9cb4c136560..cf136b469b7 100644
--- a/tui_gateway/contracts/billing_delegation_pets.py
+++ b/tui_gateway/contracts/billing_delegation_pets.py
@@ -138,11 +138,11 @@ class BillingAutoReload(Result):
class BillingStateResult(Result):
"""``_serialize_billing_state`` (money as strings); the ``except`` fallback emits only
- ``ok / logged_in / free_tier / error``, so everything else is optional."""
+ ``ok / logged_in / free_tier_account / error``, so everything else is optional."""
ok: bool
logged_in: bool
- free_tier: bool = False
+ free_tier_account: bool = False
free_tier_model: str | None = None
org_name: str | None = None
org_slug: str | None = None
diff --git a/tui_gateway/contracts/config_free_tier_control.py b/tui_gateway/contracts/config_free_tier_control.py
index ae26ab468b9..5ae13b2bf4b 100644
--- a/tui_gateway/contracts/config_free_tier_control.py
+++ b/tui_gateway/contracts/config_free_tier_control.py
@@ -113,17 +113,21 @@ method("config.set", params=ConfigSetParams, result=ConfigSetResult,
class SetupStatusResult(Result):
"""``provider_configured`` is the loose answer; the boot record's fields (``ready``,
- ``free_tier``, ``other_providers``, ``inference_provider``) ride along on the launch profile.
- An unknown ``profile`` answers ``ok=False`` + ``error``."""
+ ``free_tier_account``, ``free_tier_route``, ``other_providers``, ``inference_provider``) ride along
+ on the launch profile. An unknown ``profile`` answers ``ok=False`` + ``error``."""
provider_configured: bool | None = None
ready: bool | None = None
- free_tier: bool | None = None
+ free_tier_account: bool | None = None
+ free_tier_route: bool | None = None
other_providers: bool | None = None
inference_provider: str | None = None
profile: str | None = None
ok: bool | None = None
error: str | None = None
+ error_code: str | None = None
+ retryable: bool | None = None
+ retry_after: int | None = None
method("setup.status", params=ProfileParams, result=SetupStatusResult,
@@ -135,7 +139,7 @@ class SetupRuntimeCheckParams(ProfileParams):
class SetupRuntimeCheckResult(Result):
- """``ok=False`` + ``error`` when the resolved model can't be served; ``free_tier`` says the
+ """``ok=False`` + ``error`` when the resolved model can't be served; ``free_tier_route`` says the
selected route is the welcome host."""
ok: bool
@@ -143,7 +147,7 @@ class SetupRuntimeCheckResult(Result):
model: str | None = None
source: str | None = None
error: str | None = None
- free_tier: bool | None = None
+ free_tier_route: bool | None = None
profile: str | None = None
@@ -179,7 +183,7 @@ method("diagnostics.share_nous", params=DiagnosticsShareNousParams, result=Diagn
class FreeTierStatusResult(Result):
"""``available`` = an identity exists AND the tier is on; whether inference runs on it is
- ``setup.runtime_check.free_tier``'s question."""
+ ``setup.runtime_check.free_tier_route``'s question."""
has_guest: bool
enabled: bool
@@ -187,6 +191,10 @@ class FreeTierStatusResult(Result):
notice_pending: bool
model: str
label: str
+ error: str | None = None
+ error_code: str | None = None
+ retryable: bool | None = None
+ retry_after: int | None = None
method("free_tier.status", params=ProfileParams, result=FreeTierStatusResult,
@@ -197,6 +205,9 @@ class FreeTierProvisionResult(Result):
has_guest: bool
enabled: bool
error: str | None = None
+ error_code: str | None = None
+ retryable: bool | None = None
+ retry_after: int | None = None
method("free_tier.provision", params=ProfileParams, result=FreeTierProvisionResult,
diff --git a/tui_gateway/contracts/events.py b/tui_gateway/contracts/events.py
index 092cf737ff0..1b26695406a 100644
--- a/tui_gateway/contracts/events.py
+++ b/tui_gateway/contracts/events.py
@@ -68,7 +68,8 @@ class SetupReadyPayload(OpenPayload):
provider_configured: bool
inference_provider: str
- free_tier: bool
+ free_tier_account: bool
+ free_tier_route: bool
has_identity: bool
other_providers: bool
error: str = ""
diff --git a/tui_gateway/methods_config.py b/tui_gateway/methods_config.py
index 3a631c18728..db371e43a75 100644
--- a/tui_gateway/methods_config.py
+++ b/tui_gateway/methods_config.py
@@ -390,8 +390,10 @@ def _(rid, params: dict) -> dict:
added after boot — the Models page, a picker key, ``hermes setup`` from a shell — flips it
without a restart. If the record
is still missing after the wait, or a named profile is asked about, today's live probe answers.
- The record's fields ride along additively (``ready``, ``free_tier``, ``other_providers``)."""
+ The record's fields ride along additively (``ready``, ``free_tier_account``, ``free_tier_route``,
+ ``other_providers``)."""
try:
+ from hermes_cli.anon_auth import free_tier_route
from hermes_cli.main import _has_any_provider_configured
from hermes_cli.free_tier_bootstrap import wait_for_record
@@ -404,12 +406,14 @@ def _(rid, params: dict) -> dict:
# setup-profile probe lands here, and its kickoff requires ``ready``.
launch = wait_for_record() if profile else None
return {"provider_configured": bool(_has_any_provider_configured(strict_profile_scope=bool(profile))),
- **({"ready": True, "free_tier": launch.free_tier} if launch is not None else {}),
+ **({"ready": True, "free_tier_account": launch.free_tier_account,
+ "free_tier_route": free_tier_route()} if launch is not None else {}),
**scoped}
# ``failure_fields`` rides along only when the free-tier mint did not happen: the code,
# the sentence, and whether / when a retry can succeed (``free_tier.provision``).
return {"provider_configured": record.provider_configured, "ready": True,
- "free_tier": record.free_tier, "other_providers": record.other_providers,
+ "free_tier_account": record.free_tier_account, "free_tier_route": record.free_tier_route,
+ "other_providers": record.other_providers,
"inference_provider": record.inference_provider, **record.failure_fields(), **scoped}
return _readiness_check(rid, params, probe, probe_key="status",
wait_seconds=_READINESS_STATUS_SHARE_WAIT_SECONDS)
@@ -456,11 +460,11 @@ def _(rid, params: dict) -> dict:
or has_usable_secret(api_key_text) or bool(runtime.get("command"))):
return fail(f"No usable credentials found for {provider}.", runtime.get("source"))
from hermes_cli.anon_auth import route_is_welcome_host
- # free_tier is keyed on the SELECTED route (the welcome host serves only nous/welcome), not
+ # free_tier_route is keyed on the SELECTED route (the welcome host serves only nous/welcome), not
# on profile state: a paid Nous key beside a free-tier identity must not read as free.
return {"ok": True, "provider": runtime.get("provider"), "model": model,
"source": runtime.get("source"),
- "free_tier": provider == "nous" and route_is_welcome_host(runtime.get("base_url")),
+ "free_tier_route": provider == "nous" and route_is_welcome_host(runtime.get("base_url")),
**scoped}
return _readiness_check(rid, params, probe, probe_key=f"runtime:{requested or ''}",
wait_seconds=_READINESS_SHARE_WAIT_SECONDS)
diff --git a/tui_gateway/methods_session.py b/tui_gateway/methods_session.py
index dbab908e4da..a9a73514e51 100644
--- a/tui_gateway/methods_session.py
+++ b/tui_gateway/methods_session.py
@@ -1763,16 +1763,16 @@ def _billing_view(name: str, module: str, builder: str, serializer: str, fallbac
@method("billing.state")
def _(rid, params: dict) -> dict:
"""Read-only billing view (no scope required); fail-open. The Nous free tier has no account to
- bill, so its state is answered locally (``free_tier`` set, ``logged_in`` false) without a portal
+ bill, so its state is answered locally (``free_tier_account`` set, ``logged_in`` false) without a portal
round-trip that could only fail."""
try:
from agent.billing_view import BillingState, build_billing_state
- from hermes_cli.anon_auth import guest_carries_inference
- if guest_carries_inference():
- return _ok(rid, _serialize_billing_state(BillingState(logged_in=False), free_tier=True))
+ from hermes_cli.anon_auth import has_free_tier_account
+ if has_free_tier_account():
+ return _ok(rid, _serialize_billing_state(BillingState(logged_in=False), free_tier_account=True))
return _ok(rid, _serialize_billing_state(build_billing_state()))
except Exception:
- return _ok(rid, {"ok": True, "logged_in": False, "free_tier": False, "error": "could not load billing state"})
+ return _ok(rid, {"ok": True, "logged_in": False, "free_tier_account": False, "error": "could not load billing state"})
_billing_view("usage.bars", "agent.billing_usage", "build_usage_model", "_serialize_usage_model", # two-bar $ view