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.

feat(create): every cloud model shows its price, the meter counts what is left

purple5cf215f723b5
diff --git a/e2e/cloud-create.spec.ts b/e2e/cloud-create.spec.ts
index 4de888d0..19d8ce87 100644
--- a/e2e/cloud-create.spec.ts
+++ b/e2e/cloud-create.spec.ts
@@ -45,6 +45,28 @@ test('cloud render: submit → poll → gallery, meter + utility intents present
await expect(page.locator('img[src*="/e2e/result.png"]').first()).toBeVisible({ timeout: 30_000 })
})
+test('the cloud picker prices every model, the meter counts runs (2.6.3)', async ({ page }) => {
+ await bootIntoCloudCreate(page, { license: 'active', access: true, mediaLive: true })
+
+ // Image intent: the meter translates the balance into runs of the picked
+ // model (flux-schnell at 300 credits → 2,537,655 / 300).
+ await expect(page.getByText('≈8458 images')).toBeVisible({ timeout: 15_000 })
+
+ // Every cloud picker option carries its wallet draw as a sublabel.
+ await page.locator('button[aria-haspopup="listbox"]').last().click()
+ await expect(page.getByRole('option', { name: /Flux Schnell/ })).toContainText('300 cr')
+ await expect(page.getByRole('option', { name: /Flux Dev/ })).toContainText('1,200 cr')
+ await page.keyboard.press('Escape')
+
+ // Video intent: the mocked quota carries the 300k monthly video budget, so
+ // the meter counts against the sub-budget (300,000 / 40,000), not the pool.
+ await page.getByRole('radio', { name: /^Video$/ }).click()
+ await expect(page.getByText('≈7 clips')).toBeVisible({ timeout: 15_000 })
+ await page.locator('button[aria-haspopup="listbox"]').last().click()
+ await expect(page.getByRole('option', { name: /Wan 2\.2 720p/ })).toContainText('40k cr')
+ await page.keyboard.press('Escape')
+})
+
test('ops start EMPTY and adopt a gallery image only on explicit pick', async ({ page }) => {
await bootIntoCloudCreate(page, { license: 'active', access: true, mediaLive: true })
diff --git a/e2e/support/cloud-mock.ts b/e2e/support/cloud-mock.ts
index a60117f2..76d2a52e 100644
--- a/e2e/support/cloud-mock.ts
+++ b/e2e/support/cloud-mock.ts
@@ -94,6 +94,9 @@ export async function routeCloud(page: Page, scenario: CloudScenario): Promise<v
costs: { image: 1200, video: 40000 },
used: { credits_used: 12_345 },
remaining: { credits: 2_537_655 },
+ topup: { credits: 0 },
+ video: { limit: 300_000, used: 0, remaining: 300_000 },
+ trainings: { limit: 2, used: 0, remaining: 2 },
}),
)
}
diff --git a/src/components/create/experimental/Composer.tsx b/src/components/create/experimental/Composer.tsx
index 5b313161..3ad6ba6c 100644
--- a/src/components/create/experimental/Composer.tsx
+++ b/src/components/create/experimental/Composer.tsx
@@ -110,11 +110,18 @@ export function Composer({ onOpenAdvanced, onOpenWorkflows }: Props) {
? frames / fps
: undefined
const costFallback = quota?.costs[intentKind === 'audio' ? 'image' : intentKind] ?? 0
+ // Mirrors the CreditsMeter's 0029 gates exactly: a video run needs monthly
+ // video room + wallet (packs are exempt from the sub-budget), a training
+ // needs a training left. Absent fields (a pre-0029 server) never gate.
+ const runCost = runCredits(intentKind, intentOp, pickedModel, runSeconds, costFallback, targetResolution)
+ const isTrainingRun = intentOp === 'lora-train'
+ const drawsVideoBudget = intentKind === 'video' && !isTrainingRun
const creditsOk =
backend !== 'cloud' ||
(quota != null &&
- quota.remaining.credits >=
- runCredits(intentKind, intentOp, pickedModel, runSeconds, costFallback, targetResolution))
+ quota.remaining.credits >= runCost &&
+ (!drawsVideoBudget || !quota.video || quota.video.remaining + (quota.topup?.credits ?? 0) >= runCost) &&
+ (!isTrainingRun || !quota.trainings || quota.trainings.remaining > 0))
// Match useCloudCreate's submit-time edit fallback so the Neg gate reflects
// the model the run actually uses, not a t2i model still in the picker.
const runModel =
diff --git a/src/components/create/experimental/CreditsMeter.tsx b/src/components/create/experimental/CreditsMeter.tsx
index 17ee8345..80dafcc3 100644
--- a/src/components/create/experimental/CreditsMeter.tsx
+++ b/src/components/create/experimental/CreditsMeter.tsx
@@ -53,23 +53,73 @@ export function CreditsMeter() {
)
const remaining = quota.remaining.credits
const limit = quota.limits.credits
+ const topup = quota.topup?.credits ?? 0
+ // The 0029 caps. Video's monthly room is extended by the wallet (packs are
+ // exempt from the sub-budget); trainings are a hard count the wallet cannot
+ // buy past. Absent fields (a pre-0029 server) mean uncapped: never gate on
+ // data we do not have.
+ const isTraining = op === 'lora-train'
+ const isVideoBudget = kind === 'video' && !isTraining
+ const videoRoom = quota.video ? quota.video.remaining + topup : Infinity
+ const trainingsLeft = quota.trainings ? quota.trainings.remaining : Infinity
const enough = remaining >= cost
+ const videoEnough = !isVideoBudget || videoRoom >= cost
+ const trainingsEnough = !isTraining || trainingsLeft > 0
const pct = limit > 0 ? Math.max(0, Math.min(1, remaining / limit)) : 0
if (!enough) {
+ return (
+ <button
+ onClick={() => void openExternal(`${CLOUD_BASE}/pricing?tab=credits`)}
+ className="t-control px-2 h-[var(--control-h-sm)] inline-flex items-center rounded-md bg-amber-500/15 text-amber-300 hover:bg-amber-500/25 transition-colors"
+ >
+ {remaining <= 0 ? 'Out of credits, top up' : `Needs ${cost} credits (${remaining} left)`}
+ </button>
+ )
+ }
+ if (!trainingsEnough) {
return (
<button
onClick={() => void openExternal(`${CLOUD_BASE}/pricing`)}
className="t-control px-2 h-[var(--control-h-sm)] inline-flex items-center rounded-md bg-amber-500/15 text-amber-300 hover:bg-amber-500/25 transition-colors"
>
- {remaining <= 0 ? 'Out of credits, upgrade' : `Needs ${cost} credits (${remaining} left)`}
+ No trainings left this month. Upgrade
</button>
)
}
+ if (!videoEnough) {
+ return (
+ <button
+ onClick={() => void openExternal(`${CLOUD_BASE}/pricing?tab=credits`)}
+ className="t-control px-2 h-[var(--control-h-sm)] inline-flex items-center rounded-md bg-amber-500/15 text-amber-300 hover:bg-amber-500/25 transition-colors"
+ >
+ Video budget used up. Top up
+ </button>
+ )
+ }
+
+ // "How many more like this one" is the number a person actually wants from
+ // a meter. Video counts against the smaller of the shared pool and its
+ // sub-budget; trainings show the monthly count directly.
+ const runsPool = isVideoBudget ? Math.min(remaining, videoRoom) : remaining
+ const runsLeft = isTraining
+ ? Math.min(trainingsLeft, Math.floor(runsPool / cost))
+ : Math.floor(runsPool / cost)
+ const unit = isTraining
+ ? runsLeft === 1 ? 'training' : 'trainings'
+ : kind === 'video'
+ ? runsLeft === 1 ? 'clip' : 'clips'
+ : kind === 'audio'
+ ? runsLeft === 1 ? 'track' : 'tracks'
+ : runsLeft === 1 ? 'image' : 'images'
return (
<Tooltip
- content={`${remaining} of ${limit} credits left this billing period. This ${kind === 'video' ? 'clip' : 'image'} uses ${cost}.`}
+ content={`${remaining} of ${limit} credits left this billing period. This ${
+ isTraining ? 'training' : kind === 'video' ? 'clip' : kind === 'audio' ? 'track' : 'image'
+ } uses ${cost}, about ${runsLeft} more like it${
+ isVideoBudget && quota.video ? ` (monthly video budget: ${quota.video.remaining} of ${quota.video.limit} credits left)` : ''
+ }${isTraining && quota.trainings ? ` (${trainingsLeft} of ${quota.trainings.limit} trainings left)` : ''}.`}
>
<div className="flex items-center gap-1.5 px-2 h-[var(--control-h-sm)] rounded-md bg-white/[0.04] text-gray-400 t-control">
<div className="w-12 h-1 rounded-full bg-white/10 overflow-hidden">
@@ -79,6 +129,8 @@ export function CreditsMeter() {
/>
</div>
<span className="tabular-nums">{remaining}</span>
+ <span className="text-gray-600">·</span>
+ <span className="tabular-nums whitespace-nowrap">≈{runsLeft} {unit}</span>
</div>
</Tooltip>
)
diff --git a/src/components/create/experimental/ModelChip.tsx b/src/components/create/experimental/ModelChip.tsx
index 6d588833..ca6ba52c 100644
--- a/src/components/create/experimental/ModelChip.tsx
+++ b/src/components/create/experimental/ModelChip.tsx
@@ -1,5 +1,5 @@
import { useCreateStore } from '../../../stores/createStore'
-import { useCloudCatalogStore, defaultCloudModel, opPickerModels } from '../../../stores/cloudCatalogStore'
+import { useCloudCatalogStore, defaultCloudModel, opPickerModels, modelCostHint } from '../../../stores/cloudCatalogStore'
import { useSettingsStore } from '../../../stores/settingsStore'
import { useUIStore } from '../../../stores/uiStore'
import { Select, type SelectOption } from '../ui/Select'
@@ -62,9 +62,21 @@ function CloudModelChip() {
// can't perform doesn't show as "selected".
const value = list.some((m) => m.id === current) ? current : (list[0]?.id ?? current)
+ // The op this picker's models will run as, so the sublabel prices correctly
+ // (a trainer bills a training run, not an image).
+ const op =
+ intent === 'character' ? 'lora-train'
+ : intent === 'lipsync' ? 'lipsync'
+ : intent === 'music' ? 'music'
+ : intent === 'extend' ? 'extend'
+ : intent === 'motion' ? 'motion'
+ : intent === 'edit' ? 'edit'
+ : intent === 'animate' ? 'animate'
+ : 'generate'
const options: SelectOption[] = list.map((m) => ({
value: m.id,
label: m.label,
+ sublabel: modelCostHint(m, op),
badge: CLOUD_BADGE,
}))
@@ -134,7 +146,12 @@ function LocalModelChip() {
if (teasersEnabled && !laneList) {
const kind = isVideo ? 'video' : 'image'
for (const m of catalogModels.filter((c) => c.kind === kind && !c.ops).slice(0, TEASER_ROWS)) {
- options.push({ value: `${TEASER_PREFIX}${m.id}`, label: m.label, badge: CLOUD_BADGE })
+ options.push({
+ value: `${TEASER_PREFIX}${m.id}`,
+ label: m.label,
+ sublabel: modelCostHint(m, 'generate'),
+ badge: CLOUD_BADGE,
+ })
}
}
diff --git a/src/components/create/ui/Select.tsx b/src/components/create/ui/Select.tsx
index 0a879477..1961a4aa 100644
--- a/src/components/create/ui/Select.tsx
+++ b/src/components/create/ui/Select.tsx
@@ -32,8 +32,10 @@ interface Props {
interface MenuPosition {
top?: number
bottom?: number
- left: number
+ left?: number
+ right?: number
width: number
+ maxWidth: number
maxHeight: number
dropUp: boolean
}
@@ -152,21 +154,31 @@ export function Select({
dropUp ? spaceAbove : spaceBelow,
)
+ // The trigger width is the menu's MINIMUM: options with sublabels
+ // (model prices) may need more room, so the menu grows with its
+ // content. Right-aligned menus anchor their right edge and grow
+ // leftward; both stay clamped inside the viewport via maxWidth.
const width = rect.width
- const preferredLeft =
- align === 'right'
- ? rect.right - width
- : rect.left
-
- const maximumLeft = Math.max(
- viewportPadding,
- window.innerWidth - width - viewportPadding,
- )
+ const maxWidth =
+ window.innerWidth - viewportPadding * 2
- const left = Math.min(
- Math.max(viewportPadding, preferredLeft),
- maximumLeft,
- )
+ const left =
+ align === 'right'
+ ? undefined
+ : Math.min(
+ Math.max(viewportPadding, rect.left),
+ Math.max(
+ viewportPadding,
+ window.innerWidth - width - viewportPadding,
+ ),
+ )
+ const right =
+ align === 'right'
+ ? Math.max(
+ viewportPadding,
+ window.innerWidth - rect.right,
+ )
+ : undefined
setMenuPosition({
top: dropUp ? undefined : rect.bottom + gap,
@@ -174,7 +186,9 @@ export function Select({
? window.innerHeight - rect.top + gap
: undefined,
left,
+ right,
width,
+ maxWidth,
maxHeight: Math.min(desiredHeight, availableSpace),
dropUp,
})
@@ -279,8 +293,10 @@ export function Select({
style={{
top: menuPosition?.top,
bottom: menuPosition?.bottom,
- left: menuPosition?.left ?? 0,
- width: menuPosition?.width,
+ left: menuPosition?.left,
+ right: menuPosition?.right,
+ minWidth: menuPosition?.width,
+ maxWidth: menuPosition?.maxWidth,
maxHeight:
menuPosition?.maxHeight ?? maxHeight,
visibility: menuPosition
diff --git a/src/lib/render/cloud-jobs.ts b/src/lib/render/cloud-jobs.ts
index a77621b2..06c38855 100644
--- a/src/lib/render/cloud-jobs.ts
+++ b/src/lib/render/cloud-jobs.ts
@@ -22,6 +22,11 @@ export interface CloudQuota {
costs: { image: number; video: number }
used: { credits_used: number }
remaining: { credits: number }
+ /** Top-up wallet balance, exempt from the video sub-budget. */
+ topup?: { credits: number }
+ /** 0029 caps. Absent on a pre-0029 server, and absence must never gate. */
+ video?: { limit: number; used: number; remaining: number }
+ trainings?: { limit: number; used: number; remaining: number }
}
/** Which queue kind + workflow op a Create intent renders as.
diff --git a/src/stores/cloudCatalogStore.ts b/src/stores/cloudCatalogStore.ts
index f2655302..90f92424 100644
--- a/src/stores/cloudCatalogStore.ts
+++ b/src/stores/cloudCatalogStore.ts
@@ -195,6 +195,23 @@ export function runCredits(
: credits.base
}
+export function shortCount(n: number): string {
+ if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(1)}M`
+ if (n >= 10_000) return `${Math.round(n / 1000)}k`
+ return n.toLocaleString('en-US')
+}
+
+/** One run's wallet draw as a picker sublabel. The single biggest cost lever
+ * (wan-2.2-720p costs 5x wan-2.2-fast) was invisible before picking. Music
+ * quotes the 60 s default, video the short clip; the meter refines both to
+ * the exact run. Undefined when the entry carries no price (seed/offline). */
+export function modelCostHint(m: CloudModel, op: RenderOp): string | undefined {
+ const c = m.credits
+ if (!c) return undefined
+ const cr = op === 'music' && c.per_s !== undefined ? Math.ceil(c.per_s * 60) : c.base
+ return `${shortCount(cr)} cr`
+}
+
/** Media-live switch from the server (MEDIA_LIVE env). Unknown = live so the
* first-ever session doesn't false-block before the catalog arrives. */
export function cloudMediaLive(): boolean {