@shop-os/modelkit 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +26 -1
- package/dist/catalog.cjs +607 -83
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +224 -3
- package/dist/catalog.d.ts +224 -3
- package/dist/catalog.js +607 -83
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +1349 -473
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +254 -3
- package/dist/index.d.ts +254 -3
- package/dist/index.js +1339 -473
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,25 @@ header in the release PR.
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [0.6.1] - Unreleased
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- Every Replicate Kling row (kind `kling` or `kling-omni`, today `kling-v3-omni-video`): the resolved request keeps only the `resolution` that renders and drops `mode`. A 720p request no longer carries the row default `mode: "pro"` next to it. A request without a resolution takes its `mode`'s (`standard` 720p, `pro` 1080p; neither: 720p) before the resolution check, so a row that does not list that resolution refuses it (`error`) or coerces it with a `resolution_coerced` warning (`coerce`). What the provider receives for an accepted request is unchanged.
|
|
16
|
+
|
|
17
|
+
## [0.6.0] - Unreleased
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
- `model3d` model type: a prompt and/or photos of an object in, a GLB out. Seven fal rows (`trellis-2`, `hunyuan3d-3.1-pro`, `tripo-h3.1`, `rodin-gen-2.5`, `meshy-7.1`, `hi3d-3.0`, `sam-3d-objects`), `exposure: ["space_builder"]`. What each takes is data on `constraints.model3d` (family, endpoints, text, required image or prompt, views, texture, PBR, seed, resolutions); the catalog schema requires it on every `model3d` row and rejects a spec its family's request mapping could not run or price (a missing endpoint for a request it accepts, views, texture, PBR, seed or resolution options the family does not read or needs).
|
|
21
|
+
- `ModelKit.submitModel3d` / `model3dStatus` / `model3dResult` / `cancelModel3d` (fal adapter): a resumable queue job like the video tools, with the same pinned queue origin, webhook and key tiers. Inputs a row cannot run are refused before submit.
|
|
22
|
+
- `model3dInputRefusal`, `model3dPricingSku`, `model3dSkus`, `model3dTexture`, `model3dResolution`, `model3dConstraints`, `MODEL3D_IMAGE_SLOTS` and `MODEL3D_MODELS`, also on the browser-safe `@shop-os/modelkit/catalog` entry. A 3D request bills one flat price per option combination (its SKU), not per model id.
|
|
23
|
+
- `Model3dRequest.views.top` (and `Model3dWired.top`): a fifth photo, sent only by `unordered` rows, so Rodin Gen-2.5 takes the five images fal's `image_urls` allows (Meshy sends the first four set; named and ordered rows have no slot for it). `MODEL3D_IMAGE_SLOTS` lists the slots the request mapping fills per views kind, and the catalog schema refuses a `maxImages` above that count.
|
|
24
|
+
- `UsageUnit` `"requests"`: one call billed at a flat price, the usage sink's `REQUESTS`. The `model3d` rows and their usage events use it (a 3D job is one flat-priced request, not an image). Kits before 0.6.0 quarantine rows with this unit.
|
|
25
|
+
- `constraints.model3d.seedMax` and `model3dSeedFits(spec, seed)`: the largest seed a row's provider takes (Rodin Gen-2.5: 65535, fal's limit; absent means any non-negative integer). `submitModel3d` refuses a seed outside it as `unsupported_option` before submit, and the catalog schema refuses `seedMax` on a row without `seed`.
|
|
26
|
+
- The 3D adapter accepts only https GLB and thumbnail URLs in a result (stored or webhook); any other scheme is a `provider_rejected` `ModelKitError`, never passed through.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
- The fal queue helpers moved from `fal-video-tools.ts` to `fal-queue.ts`, shared by video tools and 3D. `falWebhookBodySchema` and `FalWebhookBody` are still exported from the package root.
|
|
30
|
+
|
|
12
31
|
## [0.5.0] - Unreleased
|
|
13
32
|
|
|
14
33
|
ENG-3271: the latest fal / Prodia models for the catalog and the Sloosh canvas.
|
package/README.md
CHANGED
|
@@ -83,6 +83,31 @@ const out = await kit.videoToolResult(sub, { webhook: verifiedBody }); // or pol
|
|
|
83
83
|
`source` carries the caller's measured `width`, `height`, `durationSeconds` and `fps`; the kit
|
|
84
84
|
never measures. Verifying the webhook signature is the caller's job.
|
|
85
85
|
|
|
86
|
+
### 3D models
|
|
87
|
+
|
|
88
|
+
`model3d` rows (Trellis 2, Hunyuan3D, Tripo, Rodin, Meshy, Hi3D, SAM 3D on fal) take a prompt
|
|
89
|
+
and/or photos of an object and return a GLB. They run as provider jobs too, the same way:
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
const sub = await kit.submitModel3d({ model: "tripo-h3.1", image, views: { left, back, right } });
|
|
93
|
+
// store `sub` (plain JSON); later: model3dStatus(sub), model3dResult(sub), cancelModel3d(sub)
|
|
94
|
+
const out = await kit.model3dResult(sub); // out.glb.url, out.thumbnail?.url, out.sku
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
What a row takes (text, required image or prompt, views, texture, PBR, seed, a priced
|
|
98
|
+
resolution) is data on `constraints.model3d`; the adapter picks the fal endpoint and builds the
|
|
99
|
+
body per `family`. The catalog schema checks a spec against what its family's mapping reads
|
|
100
|
+
(the endpoints a request it accepts goes to, its views, texture, PBR, seed and resolution
|
|
101
|
+
options, and a `maxImages` no larger than the image slots it sends: `MODEL3D_IMAGE_SLOTS`, 5 for
|
|
102
|
+
`unordered` views with `views.top` as the fifth, 4 for `named` and `ordered`), so a row the
|
|
103
|
+
adapter could not run or price is rejected on load and on write. The result's GLB and thumbnail
|
|
104
|
+
URLs are https or the call fails (`provider_rejected`), and the usage event is one request
|
|
105
|
+
(`unit: "requests"`), billed at the flat price of its SKU.
|
|
106
|
+
`model3dInputRefusal(spec, wired)` says why inputs cannot run (also checked
|
|
107
|
+
before submit), and `model3dPricingSku(row, options, inputs)` names the flat price a request
|
|
108
|
+
bills under; `model3dSkus(row)` lists them all, and pro-backend keeps a `credit_pricing_flat`
|
|
109
|
+
row for each. All three are in the browser-safe catalog entry.
|
|
110
|
+
|
|
86
111
|
Keys come from `process.env` by default: bare names for pro (`OPENAI_API_KEY`, `FAL_KEY`, `ARK_API_KEY` ...), the `ENTERPRISE_` prefix for enterprise and the `SLOOSH_` prefix for sloosh. Pass `keys: { pro, enterprise, sloosh }` to override. `tier: "sloosh"` uses the sloosh keys only: a missing key is a `ModelKitError` with code `auth`, never a fallback to pro.
|
|
87
112
|
|
|
88
113
|
## Browser-safe catalog
|
|
@@ -288,7 +313,7 @@ const defaultKit = createDefaultModelKit({ keys: { pro: keysFromEnv(process.env)
|
|
|
288
313
|
|
|
289
314
|
## Add a model
|
|
290
315
|
|
|
291
|
-
1. Add a row to `src/catalog/{image,video,video-families,video-tools,text,other}.ts`. A new fal
|
|
316
|
+
1. Add a row to `src/catalog/{image,video,video-families,video-tools,model3d,text,other}.ts`. A new fal
|
|
292
317
|
video family gets its own mapper file (`src/adapters/fal-<family>.ts`) listed in
|
|
293
318
|
`fal-video-families.ts`, which is what makes its exact ids pass the data-only check. Copy `constraints` from the provider docs.
|
|
294
319
|
2. Run `pnpm test`. The catalog test checks id and alias uniqueness.
|