Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Composer: a cloud model that runs on a visitor's own key says that key, not "Free · your GPU"

Adarshf46fad8261c7
diff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsx
index d6785076..5aa32594 100644
--- a/src/components/studio/composer.tsx
+++ b/src/components/studio/composer.tsx
@@ -23,7 +23,8 @@ import { poolRunState, quoteBody, useHostedQuote, useSettled, type RunOn } from
import { composerOnPool, composerPlace } from "@/lib/run-place";
import { PoolNote } from "./pool-note";
import { modelOwnSetup, poolRunsModel } from "@/lib/pool-rules";
-import { controlSetup } from "@/lib/own-setup-controls";
+import { controlSetup, keyOnlySetup } from "@/lib/own-setup-controls";
+import { ownSetupDetail, ownSetupLabel, ownSetupShort } from "@/lib/own-setup";
import { OwnSetupChip, useOwnSetupPress, useOwnSetupViewer } from "@/components/own-setup";
import { HoldFilesCtx } from "@/lib/held-files";
import { pendingStep } from "@/lib/guest-draft";
@@ -992,7 +993,11 @@ export function Composer({ docked }: { docked: boolean }) {
// On the open engine every run is free on the GPU: said even before the run can be planned (no voice sample, no clip yet).
// Said with "your GPU" only off a hosted studio: there the run may use the studio's GPUs, and the chip or hint says where.
const gpuRun = saysYourGpu(engine, hostedHere);
- const ownCostText = costLabel({ demo, cost: cost ?? (engine === "open" && model ? 0 : null), unknown: loraPriceUnknown, gpu: gpuRun }, formatCost);
+ // A cloud model that runs on a visitor's own key only (Mureka Extend on Audio → Extend & remix): never "Free · your GPU",
+ // its key in the label's words.
+ const keyOnly = setupViewer && !demo ? keyOnlySetup(model, engine) : null;
+ const freeHere = engine === "open" && model && !keyOnly ? 0 : null;
+ const ownCostText = keyOnly && cost == null ? ownSetupLabel(keyOnly) : costLabel({ demo, cost: cost ?? freeHere, unknown: loraPriceUnknown, gpu: gpuRun }, formatCost);
// An account's paid run is billed to its own provider account (Your keys), or still needs that key.
const payer = paidThrough(model, status);
const missingKey = needsKey(model, status)?.[0];
@@ -1737,7 +1742,7 @@ export function Composer({ docked }: { docked: boolean }) {
<Tooltip>
<TooltipTrigger asChild>
<span className={cn("shrink-0 text-[12px] font-medium text-muted-foreground tabular-nums", poolRefused && "min-w-0 shrink truncate max-sm:hidden")} data-pool-refused={poolRefused || undefined}>
- <span className="sm:hidden">{exactPrice ? fly.compactPrice : poolPrice ? costText : costLabel({ demo, cost: cost ?? (engine === "open" && model ? 0 : null), compact: true, unknown: loraPriceUnknown, gpu: gpuRun }, formatCost)}</span>
+ <span className="sm:hidden">{exactPrice ? fly.compactPrice : poolPrice ? costText : keyOnly && cost == null ? ownSetupShort(keyOnly) : costLabel({ demo, cost: cost ?? freeHere, compact: true, unknown: loraPriceUnknown, gpu: gpuRun }, formatCost)}</span>
<span className="hidden sm:inline">
{costText}
{payerText}
@@ -1751,6 +1756,8 @@ export function Composer({ docked }: { docked: boolean }) {
: [hostedQuote?.sub ?? "Runs on this studio's GPUs", poolState?.wait].filter(Boolean).join(" · ")
: demo
? "Placeholder results are on (Settings), so outputs are free stand-ins"
+ : keyOnly && cost == null
+ ? ownSetupDetail(keyOnly)
: cost === 0
? "Runs on your own GPU"
: missingKey
diff --git a/src/lib/own-setup-controls.ts b/src/lib/own-setup-controls.ts
index fae926e4..18db7158 100644
--- a/src/lib/own-setup-controls.ts
+++ b/src/lib/own-setup-controls.ts
@@ -1,3 +1,6 @@
+import type { Engine } from "./catalog/types";
+import { ownSetupOnly, type OwnSetup } from "./own-setup";
+
/**
* Model settings whose value runs on a visitor's own setup only, by the own-setup.ts id each value is asked by (the
* server asks the same ids of a run: src/server/pool-own-setup.ts requestSetupIds). A picker shows that id's label
@@ -8,3 +11,12 @@ export function controlSetup(modelId: string | undefined, param: string, value:
if (modelId === "oss-kandinsky6" && param === "quality" && value === "pro") return "oss-kandinsky6:pro";
return undefined;
}
+
+/**
+ * A model a visitor runs on its own key only (an untested cloud route, Mureka Extend on Audio → Extend & remix): the
+ * composer's price then names that key, never "Free · your GPU". Null for anything else.
+ */
+export function keyOnlySetup(m: { id: string; engine: string } | undefined, engine: Engine): Extract<OwnSetup, { need: "key" }> | null {
+ const o = m ? ownSetupOnly(m.id, m.engine === "cloud" ? "cloud" : engine) : null;
+ return o?.need === "key" ? o : null;
+}
diff --git a/tests/own-setup-labels.test.ts b/tests/own-setup-labels.test.ts
index 0f79ba94..1b87a3d9 100644
--- a/tests/own-setup-labels.test.ts
+++ b/tests/own-setup-labels.test.ts
@@ -199,3 +199,22 @@ describe("beside a setting's value", () => {
expect(requestSetupIds({ feature: "video", modelId: "oss-kandinsky6", op: "t2v", params: { extra: { quality: "lite" } } })).not.toContain("oss-kandinsky6:pro");
});
});
+
+describe("a cloud model a visitor runs on its own key only", () => {
+ it("is priced with its key's label, never as free on a GPU", async () => {
+ const { keyOnlySetup } = await import("@/lib/own-setup-controls");
+ const { costLabel } = await import("@/lib/composer");
+ const song = getModel("mureka-extend");
+ expect(song).toBeDefined();
+ const setup = keyOnlySetup(song, "open");
+ expect(setup).toEqual(ownSetupOnly("mureka-extend", "cloud"));
+ expect(setup).not.toBeNull();
+ if (setup) {
+ expect(ownSetupLabel(setup)).toBe(`Use your own ${setup.provider === "fal" ? "fal.ai" : "Replicate"} key`);
+ expect(ownSetupLabel(setup)).not.toBe(costLabel({ demo: false, cost: 0, gpu: true }, String));
+ }
+ // An open model, or a cloud model any key runs: no key label.
+ expect(keyOnlySetup(H3, "open")).toBeNull();
+ expect(keyOnlySetup(undefined, "open")).toBeNull();
+ });
+});