@shop-os/modelkit 0.1.6 → 0.1.8
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/README.md +13 -0
- package/dist/catalog.cjs +2140 -0
- package/dist/catalog.cjs.map +1 -0
- package/dist/catalog.d.cts +458 -0
- package/dist/catalog.d.ts +458 -0
- package/dist/catalog.js +2117 -0
- package/dist/catalog.js.map +1 -0
- package/dist/index.cjs +783 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -1
- package/dist/index.d.ts +42 -1
- package/dist/index.js +783 -82
- package/dist/index.js.map +1 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -53,6 +53,18 @@ await clip.cleanup?.();
|
|
|
53
53
|
|
|
54
54
|
Keys come from `process.env` by default: bare names for pro (`OPENAI_API_KEY`, `FAL_KEY`, `ARK_API_KEY` ...) and the `ENTERPRISE_` prefix for enterprise. Pass `keys: { pro, enterprise }` to override.
|
|
55
55
|
|
|
56
|
+
## Browser-safe catalog
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import { Catalog, MODELS, resolveOptions } from "@shop-os/modelkit/catalog";
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The catalog subpath carries the model rows (`MODELS` plus the per-type
|
|
63
|
+
arrays), `Catalog`, the option resolvers (`resolveOptions` and the per-type
|
|
64
|
+
resolvers), `ModelKitError` and the catalog types. It includes no adapters, no
|
|
65
|
+
client, no keys, no text helpers and no provider SDKs, and builds for
|
|
66
|
+
`es2022` / neutral so it bundles straight into the browser.
|
|
67
|
+
|
|
56
68
|
## A superset of `ai`
|
|
57
69
|
|
|
58
70
|
Every export of `ai` (the Vercel AI SDK) is re-exported here, so this import swap is
|
|
@@ -119,6 +131,7 @@ The kit keeps its `Warning` type for coercions; the SDK's warning type is `AiWar
|
|
|
119
131
|
|
|
120
132
|
| Concern | Rule |
|
|
121
133
|
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
134
|
+
| Display | every active row carries `display` (provider, description, logo) and `capabilities`; UIs derive their pickers from `kit.catalog.list()` and keep only an allowlist and ordering of their own. |
|
|
122
135
|
| Ids | `id` is the pro-backend pricing key. Every historical id (`nb-pro`, `veo-3.1-generate-001`, `kling-v2.5-turbo-pro`) is an alias. |
|
|
123
136
|
| Options | Image tiers are `512` (Gemini 3.1 Flash only), `1K`, `2K`, `4K`. `resolveOptions` fills catalog defaults, errors on an unsupported aspect ratio, size, resolution or duration (`onUnsupported: "coerce"` snaps to the nearest supported value with a warning instead; since 0.1.6 ratio and duration honour this too, so pass `"coerce"` where the old code snapped silently), trims references (audio first, then video), and drops options the model ignores with a warning. Audio requests go through the same resolver and take `abortSignal` (a row without `supports` supports nothing). `aspectRatio: "adaptive"` means "send no ratio": it is never coerced or replaced by the row default, and Gemini, Muse, Kling and Kling O1 omit the field so the model infers it from the references. Every coercion is also logged once per call through `logger.warn`. Gemini image `safetySettings` and `temperature` are sent only when the caller passes them. A reference with a `label` gets a text part with that label right before the image on Gemini image and Omni ("Image 2:", "Here is the brand logo:"). Topaz takes `upscale` (`enhanceModel`, `subjectDetection`, `faceEnhancement` and its creativity/strength) next to `scaleFactor`/`outputFormat`; Seedance takes `watermark`; MiniMax takes `lastFrame` and `safetyChecker`; Seedream 4.5 goes to `4K` and `9:21`. |
|
|
124
137
|
| Keys | Enterprise keys win only when every key the adapter (and its route, e.g. the cloudflare token for a vendor that really goes through the gateway) needs is set on the enterprise tier; a fallback to pro keys is logged once per call. |
|