ai-lcr 0.7.0 → 0.7.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 CHANGED
@@ -4,6 +4,21 @@ All notable changes to `ai-lcr` are documented here. The format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/), and the project adheres to
5
5
  [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [0.7.1] — 2026-06-20
8
+
9
+ Async media adapters now forward a caller-supplied webhook URL to the provider,
10
+ so async video jobs can complete by **push** instead of poll-only.
11
+
12
+ ### Added
13
+
14
+ - **`metadata.webhookUrl` is forwarded to the provider on async `submit`.**
15
+ `runware-media` adds it as the `videoInference` task's `webhookURL`; `fal-media`
16
+ appends it as the `?fal_webhook=` query param on the submit POST. The webhook is
17
+ a push path — the caller still polls as a fallback. Fixed task fields stay
18
+ un-clobberable (placed after the input spread). `metadata` was previously
19
+ accepted but dropped, so the documented "webhook hint" never reached the
20
+ provider; now it does.
21
+
7
22
  ## [0.7.0] — 2026-06-20
8
23
 
9
24
  The text router now records the **provider-reported actual cost** when a provider
package/dist/index.cjs CHANGED
@@ -2059,6 +2059,7 @@ function createRunwareMediaAdapter(config) {
2059
2059
  // (a `getResponse` poll). Image generation stays on the synchronous `run()`.
2060
2060
  async submit(req) {
2061
2061
  const taskUUID = crypto.randomUUID();
2062
+ const webhookUrl = typeof req.metadata?.["webhookUrl"] === "string" ? req.metadata["webhookUrl"] : void 0;
2062
2063
  await postTask({
2063
2064
  outputType: "URL",
2064
2065
  includeCost: true,
@@ -2066,7 +2067,8 @@ function createRunwareMediaAdapter(config) {
2066
2067
  taskType: "videoInference",
2067
2068
  taskUUID,
2068
2069
  model: req.externalId,
2069
- deliveryMethod: "async"
2070
+ deliveryMethod: "async",
2071
+ ...webhookUrl ? { webhookURL: webhookUrl } : {}
2070
2072
  });
2071
2073
  return { requestId: taskUUID };
2072
2074
  },
@@ -2134,7 +2136,9 @@ function createFalMediaAdapter(config) {
2134
2136
  };
2135
2137
  const queueBase = (externalId) => externalId.split("/").slice(0, 2).join("/");
2136
2138
  async function submit(req) {
2137
- const submitRes = await fetchImpl(`${baseUrl}/${req.externalId}`, {
2139
+ const webhookUrl = typeof req.metadata?.["webhookUrl"] === "string" ? req.metadata["webhookUrl"] : void 0;
2140
+ const submitUrl = webhookUrl ? `${baseUrl}/${req.externalId}?fal_webhook=${encodeURIComponent(webhookUrl)}` : `${baseUrl}/${req.externalId}`;
2141
+ const submitRes = await fetchImpl(submitUrl, {
2138
2142
  method: "POST",
2139
2143
  headers,
2140
2144
  body: JSON.stringify(req.input)
package/dist/index.js CHANGED
@@ -2005,6 +2005,7 @@ function createRunwareMediaAdapter(config) {
2005
2005
  // (a `getResponse` poll). Image generation stays on the synchronous `run()`.
2006
2006
  async submit(req) {
2007
2007
  const taskUUID = crypto.randomUUID();
2008
+ const webhookUrl = typeof req.metadata?.["webhookUrl"] === "string" ? req.metadata["webhookUrl"] : void 0;
2008
2009
  await postTask({
2009
2010
  outputType: "URL",
2010
2011
  includeCost: true,
@@ -2012,7 +2013,8 @@ function createRunwareMediaAdapter(config) {
2012
2013
  taskType: "videoInference",
2013
2014
  taskUUID,
2014
2015
  model: req.externalId,
2015
- deliveryMethod: "async"
2016
+ deliveryMethod: "async",
2017
+ ...webhookUrl ? { webhookURL: webhookUrl } : {}
2016
2018
  });
2017
2019
  return { requestId: taskUUID };
2018
2020
  },
@@ -2080,7 +2082,9 @@ function createFalMediaAdapter(config) {
2080
2082
  };
2081
2083
  const queueBase = (externalId) => externalId.split("/").slice(0, 2).join("/");
2082
2084
  async function submit(req) {
2083
- const submitRes = await fetchImpl(`${baseUrl}/${req.externalId}`, {
2085
+ const webhookUrl = typeof req.metadata?.["webhookUrl"] === "string" ? req.metadata["webhookUrl"] : void 0;
2086
+ const submitUrl = webhookUrl ? `${baseUrl}/${req.externalId}?fal_webhook=${encodeURIComponent(webhookUrl)}` : `${baseUrl}/${req.externalId}`;
2087
+ const submitRes = await fetchImpl(submitUrl, {
2084
2088
  method: "POST",
2085
2089
  headers,
2086
2090
  body: JSON.stringify(req.input)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-lcr",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Least Cost Routing for LLMs — route every model call to the cheapest available provider, fall back automatically, and track real cost. Built for the Vercel AI SDK.",
5
5
  "keywords": [
6
6
  "ai",