@shop-os/modelkit 0.2.26 → 0.2.27

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/dist/index.js CHANGED
@@ -8235,11 +8235,17 @@ function textUsageProvider(model, transport) {
8235
8235
  }
8236
8236
 
8237
8237
  // src/client.ts
8238
- function requiredKeys(model, config, transport) {
8239
- if (model.adapter === "fal" && config.routing?.fal === "cloudflare-passthrough")
8240
- return ["cloudflare"];
8238
+ function routingFor(config, tier) {
8239
+ const routing = config.routing ?? {};
8240
+ if (tier !== "sloosh") return routing;
8241
+ const direct = { ...routing };
8242
+ if (direct.text === "cloudflare") direct.text = "direct";
8243
+ if (direct.fal === "cloudflare-passthrough") direct.fal = "direct";
8244
+ return direct;
8245
+ }
8246
+ function requiredKeys(model, routing, transport) {
8247
+ if (model.adapter === "fal" && routing.fal === "cloudflare-passthrough") return ["cloudflare"];
8241
8248
  if (model.adapter === "ai-sdk-text") {
8242
- const routing = config.routing ?? {};
8243
8249
  const names = [textKeyName(model, transport)];
8244
8250
  if (textUsesCloudflareGateway(model, routing, transport)) names.push("cloudflare");
8245
8251
  return names;
@@ -8343,7 +8349,8 @@ function createModelKit(config, adapters) {
8343
8349
  model: model.id
8344
8350
  });
8345
8351
  const transport = resolveAnthropicTransport(model, config, call.tier, warnOnce);
8346
- const names = requiredKeys(model, config, transport);
8352
+ const routing = routingFor(config, call.tier);
8353
+ const names = requiredKeys(model, routing, transport);
8347
8354
  if (call.tier === "enterprise") {
8348
8355
  const missing = missingEnterpriseKeys(config, names);
8349
8356
  if (missing.length > 0)
@@ -8356,7 +8363,7 @@ function createModelKit(config, adapters) {
8356
8363
  const ctx = {
8357
8364
  model,
8358
8365
  keys,
8359
- routing: config.routing ?? {},
8366
+ routing,
8360
8367
  fetch: fetchImpl,
8361
8368
  logger,
8362
8369
  call,