Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(cloud): die Freimengenmarke heisst Included und nur ein zahlendes Konto sieht sie

purple959e9165e1a3
diff --git a/src/api/cloud/jobs.ts b/src/api/cloud/jobs.ts
index 5eb34ef6..84a5618b 100644
--- a/src/api/cloud/jobs.ts
+++ b/src/api/cloud/jobs.ts
@@ -67,6 +67,11 @@ export interface CloudMe {
/** Launch gate (Max-only closed beta): false = licensed but not yet
* allowed in. Absent on older servers = allowed. */
access?: boolean
+ /** Has this account actually paid? The server runs the very function it
+ * runs before billing a Flash turn, so the marks on screen cannot promise
+ * what the invoice contradicts. Absent on older servers = unknown, which
+ * every surface reads as "promise nothing". */
+ paidPlan?: boolean
}
}
diff --git a/src/components/chat/FlashChatNotice.tsx b/src/components/chat/FlashChatNotice.tsx
index 48f48ca9..8d6e1cd9 100644
--- a/src/components/chat/FlashChatNotice.tsx
+++ b/src/components/chat/FlashChatNotice.tsx
@@ -1,7 +1,25 @@
import { useEffect } from 'react'
import { useModelStore } from '../../stores/modelStore'
import { clearFlashNotices, useFlashBillingStore } from '../../lib/flash-ui'
+import { FLASH_UNPAID_NOTICE, useFlashEntitlement } from '../../lib/flash-entitlement'
+/**
+ * Was eine Runde auf dem gewaehlten Modell dieses Konto kostet.
+ *
+ * Der stehende Satz beschreibt die Freimenge, und die hat nur ein bezahlter
+ * Plan. Ein Starter-Konto zahlt fuer genau diese Modelle und liest deshalb
+ * einen ehrlichen Satz statt der Zusage (T7 hat am 11.09.2026 das Gegenteil
+ * gemessen: dieselbe Zusage wie beim Planbesitzer, und ein Credit war weg).
+ *
+ * Zwei Sorten Text leben hier und verhalten sich mit Absicht verschieden:
+ * - die Zeilen je Anfrage melden eine Antwort, die schon zurueck ist. Sie
+ * veralten, sobald diese Oberflaeche weg ist, also raeumen Fokus und Blur
+ * sie ab.
+ * - der stehende Satz darueber beschreibt das gewaehlte Modell und den Plan
+ * dieses Kontos. Das veraltet durch einen Blur nicht, er bleibt stehen.
+ * Seine Kontohaelfte kommt aus dem Kontospeicher, den `useCloudAuth` im
+ * Takt aus `/api/me` nachzieht.
+ */
export function FlashChatNotice() {
useEffect(() => {
// Another tab can change the account while this surface is unfocused.
@@ -16,7 +34,18 @@ export function FlashChatNotice() {
const active = useModelStore((s) => s.models.find((m) => m.name === s.activeModel))
const policy = active && 'flash' in active ? active.flash : undefined
const notice = useFlashBillingStore((s) => policy ? s.entries[policy.billingKey] : undefined)
+ const paidPlan = useFlashEntitlement()
if (!policy) return null
+ // Noch nicht beantwortet. Schweigen ist der einzige ehrliche Zustand: beide
+ // Saetze darunter sind Aussagen ueber Geld.
+ if (paidPlan === null) return null
+ if (!paidPlan) {
+ return (
+ <div className="mb-2 text-xs text-gray-500" data-testid="flash-chat-notice">
+ <p>{FLASH_UNPAID_NOTICE}</p>
+ </div>
+ )
+ }
return (
<div className="mb-2 text-xs text-gray-500" data-testid="flash-chat-notice">
<details>
diff --git a/src/components/chat/__tests__/flash-chat-notice.test.ts b/src/components/chat/__tests__/flash-chat-notice.test.ts
index 84714e91..bbf2064f 100644
--- a/src/components/chat/__tests__/flash-chat-notice.test.ts
+++ b/src/components/chat/__tests__/flash-chat-notice.test.ts
@@ -5,11 +5,21 @@ import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'
import { FlashChatNotice } from '../FlashChatNotice'
import { useModelStore } from '../../../stores/modelStore'
import { captureFlashGeneration, clearFlashNotices, parseFlashPolicy, recordFlashResponse, useFlashBillingStore } from '../../../lib/flash-ui'
+import { FLASH_UNPAID_NOTICE } from '../../../lib/flash-entitlement'
+import { useCloudAuthStore } from '../../../stores/cloudAuthStore'
const wire = { daily_tokens: 50000, default_max_output: 8192, request_seconds: 240, sessions_only: true, concurrent_requests: 1 }
const policy = parseFlashPolicy(wire, 'flash', 'test-endpoint|model')!
+const signIn = (paidPlan: boolean | null) =>
+ useCloudAuthStore.getState().setSignedIn(
+ { id: 'u1' },
+ { licenseActive: true, tier: 'hosted', access: true, quota: null, paidPlan },
+ )
+
beforeEach(() => {
useFlashBillingStore.setState({ entries: {} })
+ // Die bestehenden Faelle beschreiben das zahlende Konto.
+ signIn(true)
useModelStore.setState({ activeModel: 'test-model', models: [{
name: 'test-model', model: 'test-model', size: 0, type: 'text', provider: 'openai', providerName: 'Test', flash: policy,
}] })
@@ -82,3 +92,42 @@ describe('visible flash policy and billing', () => {
expect(useFlashBillingStore.getState().entries).toEqual({})
})
})
+
+/**
+ * R5-18: der stehende Satz versprach die Freimenge ohne jede Bedingung. T7 hat
+ * am 11.09.2026 das Gegenteil gemessen: dieselbe Zusage wie beim Planbesitzer,
+ * und ein Credit war weg. Drei Zustaende, drei Ausgaben, wie im Web.
+ */
+describe('was der Satz ueber das Konto sagt', () => {
+ it('reads one honest sentence on an account that pays for these models', () => {
+ signIn(false)
+ render(createElement(FlashChatNotice))
+ expect(screen.getByTestId('flash-chat-notice').textContent).toBe(FLASH_UNPAID_NOTICE)
+ expect(screen.queryByText(/50,000 input and output tokens/)).toBeNull()
+ })
+
+ it('says nothing at all while the account probe has not answered', () => {
+ signIn(null)
+ render(createElement(FlashChatNotice))
+ expect(screen.queryByTestId('flash-chat-notice')).toBeNull()
+ })
+
+ it('keeps the full allowance text for a paid plan', () => {
+ signIn(true)
+ render(createElement(FlashChatNotice))
+ expect(screen.getByText(/50,000 input and output tokens/)).toBeTruthy()
+ expect(screen.queryByText(FLASH_UNPAID_NOTICE)).toBeNull()
+ })
+
+ it('stays silent for a model without the free class, whatever the plan', () => {
+ const row = useModelStore.getState().models[0]
+ if (!('flash' in row)) throw new Error('Expected the flash model fixture')
+ useModelStore.setState({ models: [{ ...row, flash: undefined }] })
+ for (const plan of [true, false, null] as const) {
+ cleanup()
+ signIn(plan)
+ render(createElement(FlashChatNotice))
+ expect(screen.queryByTestId('flash-chat-notice')).toBeNull()
+ }
+ })
+})
diff --git a/src/components/models/ModelRowMarks.tsx b/src/components/models/ModelRowMarks.tsx
index fa8fe6a2..00032047 100644
--- a/src/components/models/ModelRowMarks.tsx
+++ b/src/components/models/ModelRowMarks.tsx
@@ -1,10 +1,10 @@
import type { CloudModel } from '../../types/models'
+import { FLASH_MARK_LABEL, useFlashEntitlement } from '../../lib/flash-entitlement'
/**
* Die Marken an einer Zeile der Modellauswahl.
*
- * Wortgleich mit dem Bauteil derselben Aufgabe in der Webanwendung. Beide
- * Marken kommen aus dem Server-Katalog und nie aus dem Modellnamen:
+ * Beide kommen aus dem Server-Katalog und nie aus dem Modellnamen:
* `unfiltered` ist gemessen, `flash` ist die Klasse, die keine Credits kostet.
* Eine Marke beschreibt das Modell, sie erlaubt nichts. Was eine Anfrage
* enthalten darf, entscheidet der Server bei jedem Aufruf neu.
@@ -12,8 +12,17 @@ import type { CloudModel } from '../../types/models'
* Nur `full` wird markiert. Ein Modell, das teilweise mitgeht, bekommt keine
* Marke: eine Marke, die manchmal stimmt, ist im Kaufmoment schlimmer als
* keine, weil der Kunde sie als Zusage liest.
+ *
+ * Die Freimengenmarke sagt etwas ueber das KONTO und nicht nur ueber das
+ * Modell, also fragt die Zeile das Konto (lib/flash-entitlement, dieselbe
+ * Regel, nach der der Chat-Vermittler abrechnet). Der Server liefert `flash`
+ * an jedes Konto mit Cloud; ein Konto ohne bezahlten Plan zahlt fuer genau
+ * diese Modelle und darf die Marke nicht sehen. Eine noch unbeantwortete
+ * Abfrage verspricht nichts.
*/
export function ModelRowMarks({ model }: { model: { flash?: CloudModel['flash']; unfiltered?: CloudModel['unfiltered'] } }) {
+ const paidPlan = useFlashEntitlement()
+ const freeFlash = model.flash && paidPlan === true ? model.flash : undefined
return (
<>
{model.unfiltered === 'full' && (
@@ -25,13 +34,13 @@ export function ModelRowMarks({ model }: { model: { flash?: CloudModel['flash'];
No refusals
</span>
)}
- {model.flash && (
+ {freeFlash && (
<span
className="t-micro text-emerald-600 dark:text-emerald-400"
- title={`No credits, up to ${model.flash.dailyTokens.toLocaleString('en-US')} tokens per day on a paid plan. Chat only, one request at a time.`}
+ title={`Included in your plan, up to ${freeFlash.dailyTokens.toLocaleString('en-US')} tokens per day. Chat only, one request at a time.`}
data-mark="unlimited"
>
- No credits
+ {FLASH_MARK_LABEL}
</span>
)}
</>
diff --git a/src/components/models/__tests__/model-row-marks.test.tsx b/src/components/models/__tests__/model-row-marks.test.tsx
index 64e5e937..969bb5fe 100644
--- a/src/components/models/__tests__/model-row-marks.test.tsx
+++ b/src/components/models/__tests__/model-row-marks.test.tsx
@@ -1,18 +1,34 @@
// @vitest-environment jsdom
/**
* Die Marken sagen in beiden Apps dasselbe: unzensiert nur gemessen und nur
- * ganz, ohne Credits mit der echten Tageszahl.
+ * ganz, die Freimenge nur fuer ein Konto, das dafuer zahlt.
+ *
+ * R5-17: die Zeile zeichnete die Freimengenmarke ohne jede Kontoabfrage. Der
+ * Server liefert `flash` an JEDES Konto mit Cloud, abgerechnet wird aber nach
+ * `accountPlanPays`. Ein Starter-Konto, das nie gezahlt hat, las damit eine
+ * Zusage und bekam die Rechnung.
*/
import { beforeEach, describe, expect, it } from 'vitest'
import { cleanup, render, screen } from '@testing-library/react'
import { ModelRowMarks } from '../ModelRowMarks'
+import { FLASH_MARK_LABEL } from '../../../lib/flash-entitlement'
+import { useCloudAuthStore } from '../../../stores/cloudAuthStore'
const flash = { dailyTokens: 500_000, defaultMaxOutput: 8192, requestSeconds: 240, billingKey: 'k' }
-beforeEach(() => cleanup())
+const signIn = (paidPlan: boolean | null) =>
+ useCloudAuthStore.getState().setSignedIn(
+ { id: 'u1' },
+ { licenseActive: true, tier: 'hosted', access: true, quota: null, paidPlan },
+ )
+
+beforeEach(() => {
+ cleanup()
+ useCloudAuthStore.getState().setSignedOut()
+})
describe('ModelRowMarks', () => {
- it('marks a measured, fully unfiltered model', () => {
+ it('marks a measured, fully unfiltered model regardless of the plan', () => {
render(<ModelRowMarks model={{ unfiltered: 'full' }} />)
expect(screen.getByText('No refusals')).toBeTruthy()
})
@@ -26,13 +42,37 @@ describe('ModelRowMarks', () => {
})
it('names the daily number the server sent, never a number of its own', () => {
+ signIn(true)
render(<ModelRowMarks model={{ flash }} />)
- expect(screen.getByText('No credits').getAttribute('title')).toContain('500,000')
+ expect(screen.getByText(FLASH_MARK_LABEL).getAttribute('title')).toContain('500,000')
+ })
+
+ it('carries both marks at once for a paying account', () => {
+ signIn(true)
+ render(<ModelRowMarks model={{ flash, unfiltered: 'full' }} />)
+ expect(screen.getByText('No refusals')).toBeTruthy()
+ expect(screen.getByText(FLASH_MARK_LABEL)).toBeTruthy()
})
- it('carries both marks at once', () => {
+ it('promises nothing to an account that pays for these very models', () => {
+ signIn(false)
render(<ModelRowMarks model={{ flash, unfiltered: 'full' }} />)
+ expect(screen.queryByText(FLASH_MARK_LABEL)).toBeNull()
+ expect(screen.queryByText('No credits')).toBeNull()
+ // Die gemessene Marke haengt nicht am Geld und bleibt stehen.
expect(screen.getByText('No refusals')).toBeTruthy()
- expect(screen.getByText('No credits')).toBeTruthy()
+ })
+
+ it('promises nothing while the account probe has not answered', () => {
+ signIn(null)
+ render(<ModelRowMarks model={{ flash }} />)
+ expect(screen.queryByText(FLASH_MARK_LABEL)).toBeNull()
+ })
+
+ it('shows nothing at all for a model without the free class', () => {
+ signIn(true)
+ render(<ModelRowMarks model={{}} />)
+ expect(screen.queryByText(FLASH_MARK_LABEL)).toBeNull()
+ expect(screen.queryByText('No refusals')).toBeNull()
})
})
diff --git a/src/hooks/useCloudAuth.ts b/src/hooks/useCloudAuth.ts
index 93d3fd9e..5decd7e5 100644
--- a/src/hooks/useCloudAuth.ts
+++ b/src/hooks/useCloudAuth.ts
@@ -55,6 +55,8 @@ async function probeAccount(): Promise<void> {
// every licensed account): absent on older servers = allowed.
const access = me.license?.access !== false
const tier = me.license?.tier ?? null
+ // Absent on an older server: unknown, not "no". null promises nothing.
+ const paidPlan = typeof me.license?.paidPlan === 'boolean' ? me.license.paidPlan : null
let quota: CloudQuota | null = null
if (licenseActive && access) {
// Gated accounts would just 403 here — skip the round-trip. A transient
@@ -68,7 +70,7 @@ async function probeAccount(): Promise<void> {
if (stale()) return
void refreshCatalog()
}
- store.setSignedIn({ id: me.user.id, email: me.user.email }, { licenseActive, tier, access, quota })
+ store.setSignedIn({ id: me.user.id, email: me.user.email }, { licenseActive, tier, access, paidPlan, quota })
syncChatProvider()
syncAppMode()
} catch (err) {
diff --git a/src/lib/flash-entitlement.ts b/src/lib/flash-entitlement.ts
new file mode 100644
index 00000000..31e8ed76
--- /dev/null
+++ b/src/lib/flash-entitlement.ts
@@ -0,0 +1,33 @@
+import { useCloudAuthStore } from '../stores/cloudAuthStore'
+
+/**
+ * Das Etikett der Freimengenmarke, an genau einer Stelle.
+ *
+ * "No credits" las sich als Eigenschaft des Modells. Sie ist eine Eigenschaft
+ * des Kontos: dieselben Modelle kosten ein Konto ohne bezahlten Plan Credits.
+ * "Included" sagt, was gemeint ist, und steht hier, damit ein Wortwechsel eine
+ * Zeile bleibt und nicht drei Stellen im JSX sucht.
+ */
+export const FLASH_MARK_LABEL = 'Included'
+
+/** Der Satz, den ein Konto ohne bezahlten Plan liest. Wortgleich mit dem Web. */
+export const FLASH_UNPAID_NOTICE = 'Flash models are free on a paid plan. This account uses credits.'
+
+/**
+ * Bekommt DIESES Konto die Freimenge?
+ *
+ * Die Regel ist `accountPlanPays`, und die Tatsache, die sie braucht, ob je
+ * Geld angekommen ist, liegt in der Datenbank. Die Antwort wird deshalb geholt
+ * und nicht im Klienten nachgerechnet: `/api/me` fuehrt genau die Funktion aus,
+ * die der Chat-Vermittler vor dem Abrechnen einer Runde fuehrt. Eine Regel,
+ * eine Antwort, damit eine Marke auf dem Schirm nicht verspricht, was die
+ * Rechnung danach widerlegt.
+ *
+ * `null` heisst "noch nicht beantwortet", und jede Oberflaeche liest das als
+ * "verspricht nichts", nie als Ja. Der Desktop fragt die Route ohnehin im
+ * Takt ab (`hooks/useCloudAuth`), der Wert steht deshalb im Kontospeicher und
+ * braucht keine zweite Abfrage.
+ */
+export function useFlashEntitlement(): boolean | null {
+ return useCloudAuthStore((s) => s.paidPlan)
+}
diff --git a/src/lib/release-notes.ts b/src/lib/release-notes.ts
index 3aa392cd..487392e3 100644
--- a/src/lib/release-notes.ts
+++ b/src/lib/release-notes.ts
@@ -77,7 +77,7 @@ export const RELEASE_NOTES: ReleaseNote[] = [
items: [
`The cloud chat models in the catalogue were each asked the same question twice and judged on what came back, not on whether the reply started with a refusal sentence. ${SHEET_MARKED_MODELS} of the ${SHEET_CHAT_MODELS} answer in full. Four answer but hold back and carry no mark: a mark that is sometimes right reads as a promise, and then you meet the refusal we just talked you out of. DeepSeek V4.1 Flash joined the catalogue after that run, so it carries no mark yet. We have measured it since.`,
'The old "(unrestricted)" suffix in some model names is gone. It was inherited, it was wrong on at least two models, and a name is not evidence.',
- 'The same two marks appear in the picker and above the prompt: "No refusals" for the measured ones, "No credits" for the Flash class with its real daily number.',
+ 'The same two marks appear in the picker and above the prompt: "No refusals" for the measured ones, "Included" for the Flash class with its real daily number. The second one only shows on a plan that pays for it, because on any other account those models cost credits.',
'Chroma, Prefect Pony XL, Neta Lumina and the six new video endpoints are marked in the Create picker of the browser studio. The mark stays pale while your account still filters, so it is clear that the setting draws the line and not the model.',
],
},
diff --git a/src/stores/cloudAuthStore.ts b/src/stores/cloudAuthStore.ts
index d9f7c037..c70686e2 100644
--- a/src/stores/cloudAuthStore.ts
+++ b/src/stores/cloudAuthStore.ts
@@ -20,10 +20,18 @@ export interface CloudAccount {
* the beta is fully open since, so servers now send true for every
* licensed account — kept as a kill-switch the server owns. */
access: boolean
+ /**
+ * Hat dieses Konto wirklich bezahlt? `/api/me` fuehrt dafuer dieselbe
+ * Funktion aus, nach der der Chat-Vermittler eine Flash-Runde abrechnet.
+ * `null` heisst "noch keine Antwort" oder "aelterer Server ohne das Feld",
+ * und das verspricht nichts (siehe lib/flash-entitlement).
+ */
+ paidPlan?: boolean | null
quota: CloudQuota | null
}
interface CloudAuthState extends CloudAccount {
+ paidPlan: boolean | null
/** 'probing' until the keychain session restore + first /api/me resolve. */
status: 'probing' | 'signed-out' | 'signed-in'
user: CloudUser | null
@@ -39,11 +47,13 @@ export const useCloudAuthStore = create<CloudAuthState>()((set) => ({
licenseActive: false,
tier: null,
access: true,
+ paidPlan: null,
quota: null,
setSignedOut: () =>
- set({ status: 'signed-out', user: null, licenseActive: false, tier: null, access: true, quota: null }),
- setSignedIn: (user, account) => set({ status: 'signed-in', user, ...account }),
+ set({ status: 'signed-out', user: null, licenseActive: false, tier: null, access: true, paidPlan: null, quota: null }),
+ setSignedIn: (user, account) =>
+ set({ status: 'signed-in', user, ...account, paidPlan: account.paidPlan ?? null }),
setQuota: (quota) => set({ quota }),
}))