Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

fix(hypihub): separate canonical model identity from input modes

kashorin30a4a5d7a7b9
diff --git a/packages/cli/test/output.test.ts b/packages/cli/test/output.test.ts
index d9a3575e..e966e005 100644
--- a/packages/cli/test/output.test.ts
+++ b/packages/cli/test/output.test.ts
@@ -177,8 +177,8 @@ test("pricing presents Provider-owned material beside the corresponding Needs",
endpoint: "hypihub.default", use: "@hypit/provider-hypihub",
pricing: { kind: "page", url: "https://hypit.ai/commercial/pricing/" },
pricingDocuments: [{
- source: "https://hypit.ai/v1/pricing?model=bytedance%2Fseedance-2",
- data: { model: "bytedance/seedance-2", pricing: { mode: "per_second", per_second_usd: 0.1045 } },
+ source: "https://hypit.ai/v1/pricing?model=seedance-2",
+ data: { model: "seedance-2", pricing: { mode: "per_second", per_second_usd: 0.1045 } },
}],
}, {
request: "image:one", capability: "@hypit/gpt-image@1#gpt-image-2", status: "resolved",
@@ -195,7 +195,7 @@ test("pricing presents Provider-owned material beside the corresponding Needs",
} as const;
const output = capture(human, presentation);
assert.match(output, /Provider pricing information/u);
- assert.match(output, /https:\/\/hypit\.ai\/v1\/pricing\?model=bytedance%2Fseedance-2/u);
+ assert.match(output, /https:\/\/hypit\.ai\/v1\/pricing\?model=seedance-2/u);
assert.match(output, /"per_second_usd": 0\.1045/u);
assert.match(output, /duration 5 · resolution 720p/u);
assert.match(output, /Pricing page\s+https:\/\/images\.example\/pricing/u);
diff --git a/packages/provider-hypihub/README.md b/packages/provider-hypihub/README.md
index fc650205..f8c79093 100644
--- a/packages/provider-hypihub/README.md
+++ b/packages/provider-hypihub/README.md
@@ -31,8 +31,15 @@ The current HypiHub GPT Image 2 route has these service-specific limits:
HypiHub owns this support check independently: it leaves the GPT Image model package unchanged. When the service surface changes, this Provider can change without changing
the model or another Provider.
-Model identity is preserved across input modes: Seedream 5 Lite references use the Lite image-edit
-route, and Grok 1.5 Preview remains the Preview model. A deployment's current catalogue may offer
+Model identity and input mode are separate. The mapping uses HypiHub's canonical model names:
+`gpt-image-2`, `seedream-5-lite`, `minimax-h3`, `grok-imagine-video` and the individual Seedance names.
+An image request without references uses `/images/generations`; image edits use `/images/edits`
+with the same model name. Video requests use `/videos`, preserving reference images, reference
+videos and first/last frames in their distinct fields. Old operation-specific names are not needed
+to express these modes; compatibility with previously released clients belongs to the service.
+
+Seedream 5 Lite remains Lite across input modes, and Grok 1.5 Preview remains Preview.
+A deployment's current catalogue may offer
newer models or omit one implemented here. Availability and unsupported-input errors retain their
service explanation; they do not imply expired credentials or authorize substituting another model.
@@ -148,8 +155,10 @@ catalog to verify configured capabilities; ordinary preflight never makes that r
declares HypiHub's public pricing page, `https://hypit.ai/commercial/pricing/`, as its price source.
For each selected Need, `readPricing` resolves the corresponding HypiHub model and returns the service's
authenticated `GET /v1/pricing?model=<model>` response unchanged together with that URL. It covers
-generation, alignment, Voice Design and Voice Clone through the same mechanism;
-the Provider does not maintain a second list of billing formulas or calculate a request total.
+generation, alignment, Voice Design and Voice Clone through the same mechanism. The document's
+per-operation prices are retained alongside its default price, including when references are still
+pending. A model's default price is not a quote for every input mode. The Provider does not maintain
+a second list of billing formulas or calculate a request total.
The Provider declares its implemented speech capabilities alongside image, video and alignment.
Voice Design produces an accepted voice-reference Resource, and Voice Clone uses that
diff --git a/packages/provider-hypihub/src/mapping.ts b/packages/provider-hypihub/src/mapping.ts
index 05a19ee7..039c954e 100644
--- a/packages/provider-hypihub/src/mapping.ts
+++ b/packages/provider-hypihub/src/mapping.ts
@@ -12,8 +12,8 @@ const MIMO_SPEECH: ModuleRef = { name: "@hypit/mimo-speech", version: "1" };
const FISHAUDIO_SPEECH: ModuleRef = { name: "@hypit/fishaudio-speech", version: "1" };
const ELEVENLABS_SPEECH: ModuleRef = { name: "@hypit/elevenlabs-speech", version: "1" };
-const seedance = (name: string, model: string): GenerationWireMapping => ({
- capability: { module: SEEDANCE, name }, result: "video", routes: [{ model }],
+const seedance = (name: string): GenerationWireMapping => ({
+ capability: { module: SEEDANCE, name }, result: "video", routes: [{ model: name }],
fields: {
prompt: { as: "value", field: "prompt" },
referenceImage: { as: "urlArray", field: "reference_image_urls", resourceFields: ["personReference"] },
@@ -38,15 +38,12 @@ export const hypiHubMappings: readonly GenerationWireMapping[] = [
format: { as: "value", field: "format", whenAbsent: "WEBM" },
},
},
- seedance("seedance-2", "seedance-2"),
- seedance("seedance-2-fast", "seedance-2-fast"),
- seedance("seedance-2-mini", "seedance-2-mini"),
- seedance("seedance-2.5", "seedance-2.5"),
+ seedance("seedance-2"),
+ seedance("seedance-2-fast"),
+ seedance("seedance-2-mini"),
+ seedance("seedance-2.5"),
{
- capability: { module: GPT_IMAGE, name: "gpt-image-2" }, result: "image", routes: [
- { model: "gpt-image-2", whenPresent: ["images"] },
- { model: "gpt-image-2" },
- ],
+ capability: { module: GPT_IMAGE, name: "gpt-image-2" }, result: "image", routes: [{ model: "gpt-image-2" }],
fields: {
prompt: { as: "value", field: "prompt" },
aspectRatio: { as: "value", field: "aspect_ratio" },
@@ -66,10 +63,7 @@ export const hypiHubMappings: readonly GenerationWireMapping[] = [
},
})),
{
- capability: { module: SEEDREAM, name: "seedream-5-lite" }, result: "image", routes: [
- { model: "seedream-5-lite", whenPresent: ["images"] },
- { model: "seedream-5-lite" },
- ],
+ capability: { module: SEEDREAM, name: "seedream-5-lite" }, result: "image", routes: [{ model: "seedream-5-lite" }],
fields: {
prompt: { as: "value", field: "prompt" },
aspectRatio: { as: "value", field: "aspect_ratio" },
@@ -80,13 +74,7 @@ export const hypiHubMappings: readonly GenerationWireMapping[] = [
},
},
{
- capability: { module: MINIMAX, name: "minimax-h3" }, result: "video", routes: [
- { model: "minimax-h3", whenPresent: ["lastFrame"] },
- { model: "minimax-h3", whenPresent: ["firstFrame"] },
- { model: "minimax-h3", whenPresent: ["referenceImage"] },
- { model: "minimax-h3", whenPresent: ["referenceVideo"] },
- { model: "minimax-h3" },
- ],
+ capability: { module: MINIMAX, name: "minimax-h3" }, result: "video", routes: [{ model: "minimax-h3" }],
fields: {
prompt: { as: "value", field: "prompt" }, duration: { as: "value", field: "seconds" },
resolution: { as: "value", field: "resolution", whenAbsent: "2k" }, aspectRatio: { as: "value", field: "aspect_ratio" },
@@ -98,10 +86,7 @@ export const hypiHubMappings: readonly GenerationWireMapping[] = [
},
},
{
- capability: { module: GROK, name: "grok-imagine-video" }, result: "video", routes: [
- { model: "grok-imagine-video", whenPresent: ["images"] },
- { model: "grok-imagine-video" },
- ],
+ capability: { module: GROK, name: "grok-imagine-video" }, result: "video", routes: [{ model: "grok-imagine-video" }],
fields: {
prompt: { as: "value", field: "prompt" }, duration: { as: "value", field: "seconds" },
resolution: { as: "value", field: "resolution" }, aspectRatio: { as: "value", field: "aspect_ratio" },
diff --git a/packages/provider-hypihub/src/provider.ts b/packages/provider-hypihub/src/provider.ts
index 4550872f..6156a305 100644
--- a/packages/provider-hypihub/src/provider.ts
+++ b/packages/provider-hypihub/src/provider.ts
@@ -312,8 +312,7 @@ function cardIdentifiers(card: Record<string, unknown>): readonly string[] {
return [card.id, card.canonical_name].filter((name): name is string => typeof name === "string");
}
-/** The additional model names a card answers to. HypiHub publishes the per-operation
- * routing names used by the Provider mapping table as aliases of one canonical card. */
+/** Additional names explicitly published by the service for this card. */
function cardAliases(card: Record<string, unknown>): readonly string[] {
return Array.isArray(card.aliases)
? card.aliases.filter((name): name is string => typeof name === "string")
diff --git a/packages/provider-hypihub/test/provider.test.ts b/packages/provider-hypihub/test/provider.test.ts
index cc640b2a..c1d3c815 100644
--- a/packages/provider-hypihub/test/provider.test.ts
+++ b/packages/provider-hypihub/test/provider.test.ts
@@ -267,12 +267,20 @@ test("HypiHub returns its current model-pricing document", async () => {
}]);
});
-test("HypiHub prices the wire route selected by an authored future input", async () => {
+test("HypiHub retains operation prices when canonical-model references are still pending", async () => {
+ const rateCard = {
+ object: "model_pricing", model: "gpt-image-2",
+ pricing: { mode: "per_image", per_image_usd: 0.03 },
+ operations: [
+ { operation: "text-to-image", pricing: { mode: "per_image", per_image_usd: 0.03 } },
+ { operation: "image-to-image", pricing: { mode: "per_image", per_image_usd: 0.05 } },
+ ],
+ };
const provider = createHypiHubProvider({
pricingRequestTimeoutMs: 1_000,
fetch: async (input) => {
assert.equal(String(input), "https://hypit.ai/v1/pricing?model=gpt-image-2");
- return Response.json({ object: "model_pricing", model: "gpt-image-2" });
+ return Response.json(rateCard);
},
});
const request = {
@@ -287,10 +295,7 @@ test("HypiHub prices the wire route selected by an authored future input", async
request,
credentials: async () => ({ apiKey: { secret: "test-key" } }),
});
- assert.deepEqual(document?.data, {
- object: "model_pricing",
- model: "gpt-image-2",
- });
+ assert.deepEqual(document?.data, rateCard);
});
test("HypiHub doctor leaves expired OAuth refresh validity unknown without misidentifying the Store", async () => {
@@ -322,6 +327,30 @@ test("HypiHub doctor checks the authenticated catalogue only when actively invok
assert.deepEqual(diagnostics, []);
});
+test("HypiHub doctor recognizes canonical cards without legacy aliases or substituting variants", async () => {
+ const cards = [
+ { id: "gpt-image-2", endpoints: ["images", "image_edits"] },
+ { id: "seedream-5-lite", endpoints: ["images", "image_edits"] },
+ { id: "minimax-h3", endpoints: ["videos"] },
+ { id: "grok-imagine-video", endpoints: ["videos"] },
+ { id: "seedance-2-mini", endpoints: ["videos"] },
+ ];
+ const capabilities = [
+ { module: { name: "@hypit/gpt-image", version: "1" }, name: "gpt-image-2" },
+ { module: { name: "@hypit/seedream", version: "1" }, name: "seedream-5-lite" },
+ { module: { name: "@hypit/minimax-h3", version: "1" }, name: "minimax-h3" },
+ { module: { name: "@hypit/grok-imagine", version: "1" }, name: "grok-imagine-video" },
+ seedanceEndpoints.mini!.capability,
+ { module: { name: "@hypit/grok-imagine", version: "1" }, name: "grok-imagine-video-1.5-preview" },
+ ];
+ const diagnostics = await diagnoseHypiHubProvider({
+ fetch: async () => Response.json({ data: cards }),
+ }, { credentials: { apiKey: { secret: "test-key" } }, capabilities });
+ assert.equal(diagnostics.length, 1);
+ assert.equal(diagnostics[0]?.code, "HYPIHUB_CAPABILITY_UNAVAILABLE");
+ assert.match(diagnostics[0]!.message, /grok-imagine-video-1\.5-preview/u);
+});
+
test("HypiHub declares both MiMo speech capabilities; who serves them is the Profile's binding", async () => {
const registry = new EndpointRegistry();
await createHypiHubProvider({ fetch: async () => { throw new Error("audio must not call fetch"); } }).install(registry);
diff --git a/packages/provider-hypihub/test/routes.test.ts b/packages/provider-hypihub/test/routes.test.ts
index ac26c96d..340ed7d3 100644
--- a/packages/provider-hypihub/test/routes.test.ts
+++ b/packages/provider-hypihub/test/routes.test.ts
@@ -240,3 +240,18 @@ test("exact model identity survives reference mode and preview selection", async
assert.equal((await compile(preview, request, resolve)).model, "grok-imagine-video-1.5-preview");
}
});
+
+test("canonical image models keep generation and edit operations distinct", async () => {
+ for (const name of ["gpt-image-2", "seedream-5-lite", "nano-banana-2", "nano-banana-pro"]) {
+ const route = hypiHubRoutes.find((item) => item.capability.name === name)!;
+ for (const images of [[], [{ role: "image", artifact: image }]]) {
+ const prepared = route.prepare({ ports: { prompt: ["A scene"], images } });
+ assert.equal(prepared.model, name);
+ assert.equal(prepared.operation, images.length ? "image_edits" : "images");
+ const compiled = await prepared.compile(resolve);
+ assert.equal(compiled.model, name);
+ assert.deepEqual((compiled.input as Record<string, CanonicalValue>).reference_images,
+ images.length ? [{ url: "data:image/png;base64,AQID" }] : []);
+ }
+ }
+});