@blockrun/clawrouter 0.12.306 → 0.12.308

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
@@ -266387,7 +266387,8 @@ var top_models_default = [
266387
266387
  "free/north-mini-code",
266388
266388
  "free/nemotron-3-nano-omni-30b-a3b-reasoning",
266389
266389
  "free/nemotron-3-ultra-550b",
266390
- "free/llama-3.2-11b-vision",
266390
+ "free/nemotron-3.5-bolt",
266391
+ "free/nemotron-3-super-120b",
266391
266392
  "free/muse-glimmer-30b"
266392
266393
  ];
266393
266394
 
@@ -266784,10 +266785,10 @@ var MODEL_ALIASES = {
266784
266785
  "mistral-free": "free/nemotron-3.5-lightning",
266785
266786
  "glm-free": "free/nemotron-3.5-lightning",
266786
266787
  // seed-oss-36b (the prior target) EOL'd 2026-08-03
266787
- // A free Llama exists again: nemotron-super-49b (Llama-3.3-based) hit 410 on
266788
- // 2026-08-30, and a 12-model sweep of what NVIDIA still serves found Llama 3.2
266789
- // 11B Vision as the only one that finishes a real completion.
266790
- "llama-free": "free/llama-3.2-11b-vision",
266788
+ // No free Llama is left: NVIDIA deprovisioned Llama 3.2 11B Vision on 2026-11-02.
266789
+ // blockrun's /free-llama page now leads with Muse, so the shorthand follows it.
266790
+ "llama-free": "free/muse-glimmer-30b",
266791
+ // no free Llama left; Muse is Meta's open line after it
266791
266792
  // qwen3-coder-480b retired 2026-06-14 → seed-oss-36b, which then EOL'd 2026-08-03.
266792
266793
  // Follow the gateway's own retarget rather than chaining to a second dead model.
266793
266794
  "qwen-coder": "free/nemotron-3.5-lightning",
@@ -266826,11 +266827,8 @@ var MODEL_ALIASES = {
266826
266827
  // Vision-capable free models
266827
266828
  "nemotron-omni": "free/nemotron-3-nano-omni-30b-a3b-reasoning",
266828
266829
  "nano-omni": "free/nemotron-3-nano-omni-30b-a3b-reasoning",
266829
- // `vision-free` kept for backward compatibility ONLY — it still resolves to
266830
- // nano-omni, which is the strongest free model, but the free tier no longer
266831
- // claims working image input on either chain (see the catalog note). Do not
266832
- // advertise this alias as a way to get free vision.
266833
- "vision-free": "free/nemotron-3-nano-omni-30b-a3b-reasoning",
266830
+ // `vision-free` names the one free model that proved it reads images.
266831
+ "vision-free": "free/nemotron-3.5-bolt",
266834
266832
  // Retired shorthand aliases redirect to live successors. The catch-all target
266835
266833
  // moved llama-4-maverick → gpt-oss-120b (2026-07-17) → step-3.7-flash
266836
266834
  // (2026-08-29) → nemotron-3.5-lightning (2026-08-30, blockrun #448).
@@ -266838,7 +266836,8 @@ var MODEL_ALIASES = {
266838
266836
  // strongest live Nemotron
266839
266837
  "nemotron-ultra": "free/nemotron-3.5-lightning",
266840
266838
  "nemotron-253b": "free/nemotron-3.5-lightning",
266841
- "nemotron-super": "free/nemotron-3.5-lightning",
266839
+ "nemotron-super": "free/nemotron-3-super-120b",
266840
+ // now names a real free model
266842
266841
  "nemotron-49b": "free/nemotron-3.5-lightning",
266843
266842
  "nemotron-120b": "free/nemotron-3.5-lightning",
266844
266843
  devstral: "free/nemotron-3.5-lightning",
@@ -266883,6 +266882,12 @@ var MODEL_ALIASES = {
266883
266882
  // free on NVIDIA. A reasoning model: a small max_tokens is spent entirely in
266884
266883
  // reasoning and returns empty content.
266885
266884
  "nvidia/muse-glimmer-30b": "free/muse-glimmer-30b",
266885
+ "nvidia/nemotron-3.5-bolt": "free/nemotron-3.5-bolt",
266886
+ "nemotron-3.5-bolt": "free/nemotron-3.5-bolt",
266887
+ bolt: "free/nemotron-3.5-bolt",
266888
+ "nvidia/nemotron-3-super-120b": "free/nemotron-3-super-120b",
266889
+ "nemotron-3-super-120b": "free/nemotron-3-super-120b",
266890
+ "super-120b": "free/nemotron-3-super-120b",
266886
266891
  muse: "free/muse-glimmer-30b",
266887
266892
  "muse-glimmer": "free/muse-glimmer-30b",
266888
266893
  "muse-glimmer-30b": "free/muse-glimmer-30b",
@@ -268627,7 +268632,9 @@ var BLOCKRUN_MODELS = [
268627
268632
  // (Llama-3.3-based) hit NVIDIA's 410 EOL. A 12-model sweep found exactly two
268628
268633
  // survivors and only the 11B finishes a real completion. Older than the rest
268629
268634
  // of the tier and deliberately so: it is a real Llama that actually answers.
268630
- // Slowest in the tier (~18 tok/s) — last rung of the cascade.
268635
+ // Retired 2026-11-02: NVIDIA deprovisioned it and blockrun delisted it. Entry
268636
+ // kept so explicit pins stay routable;
268637
+ // off the picker, the FREE_MODELS cascade and every default.
268631
268638
  id: "free/llama-3.2-11b-vision",
268632
268639
  name: "[Free] Llama 3.2 11B Vision",
268633
268640
  version: "3.2-11b-vision",
@@ -268687,6 +268694,35 @@ var BLOCKRUN_MODELS = [
268687
268694
  maxOutput: 16384,
268688
268695
  reasoning: true
268689
268696
  },
268697
+ {
268698
+ // Nemotron 3.5 Bolt (blockrun 2026-11-04): about a second to answer, no
268699
+ // thinking pass. The one free model flagged for vision. 2026-11-05, 64x64
268700
+ // solid-colour PNGs: 8 of 8 correct across Base and Solana, and every
268701
+ // response's `model` field named Bolt itself, so no rescue did the reading.
268702
+ id: "free/nemotron-3.5-bolt",
268703
+ name: "[Free] Nemotron 3.5 Bolt",
268704
+ version: "3.5-bolt",
268705
+ inputPrice: 0,
268706
+ outputPrice: 0,
268707
+ contextWindow: 131072,
268708
+ maxOutput: 16384,
268709
+ vision: true
268710
+ },
268711
+ {
268712
+ // Nemotron 3.5 Super, served under its older 3-super-120b id (blockrun
268713
+ // 2026-11-04). Reasoning, and the gateway's redirect target for the retired
268714
+ // Llama. NO `vision`, although blockrun tags it: on 2026-11-05 only 2 of 8
268715
+ // image probes were answered by this model; the rest were rescued by
268716
+ // nano-omni or refused with a capacity 429, which proves nothing about it.
268717
+ id: "free/nemotron-3-super-120b",
268718
+ name: "[Free] Nemotron 3 Super 120B",
268719
+ version: "3-super-120b",
268720
+ inputPrice: 0,
268721
+ outputPrice: 0,
268722
+ contextWindow: 131072,
268723
+ maxOutput: 16384,
268724
+ reasoning: true
268725
+ },
268690
268726
  // ── 2026-08-30 paid catalog refresh (blockrun #449) ─────────────────────
268691
268727
  // Three additions, each probe-verified upstream with a real completion AND a
268692
268728
  // real image before listing. All three carry `vision: true` on that evidence
@@ -287421,6 +287457,7 @@ var CostCapError = class extends SpendPolicyError {
287421
287457
  this.name = "CostCapError";
287422
287458
  }
287423
287459
  };
287460
+ var ZERO_CAP_REFUSAL = "ClawRouter cost cap: maxCostPerRun is 0, so no paid call is made";
287424
287461
 
287425
287462
  // src/compression/types.ts
287426
287463
  var DEFAULT_COMPRESSION_CONFIG = {
@@ -288842,12 +288879,19 @@ function isBlockedSsrfHost(hostname3) {
288842
288879
  }
288843
288880
  const embedded = h.match(/^64:ff9b::(.+)$/) ?? h.match(/::ffff:(.+)$/);
288844
288881
  if (embedded) {
288845
- const tail = embedded[1];
288882
+ const rawTail = embedded[1];
288883
+ const tail = rawTail.startsWith("0:") && (rawTail.includes(".") || rawTail.split(":").length > 2) ? rawTail.slice(2) : rawTail;
288846
288884
  if (tail.includes(".")) return isBlockedSsrfHost(tail);
288847
288885
  const seg = tail.split(":");
288848
288886
  if (seg.length === 2)
288849
288887
  return isBlockedSsrfHost(v4FromHex(parseInt(seg[0], 16), parseInt(seg[1], 16)));
288850
288888
  }
288889
+ const compat = h.match(/^::(?:0:)?(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);
288890
+ if (compat) return isBlockedSsrfHost(compat[1]);
288891
+ const compatHex = h.match(/^::([0-9a-f]{1,4}):([0-9a-f]{1,4})$/);
288892
+ if (compatHex) {
288893
+ return isBlockedSsrfHost(v4FromHex(parseInt(compatHex[1], 16), parseInt(compatHex[2], 16)));
288894
+ }
288851
288895
  return false;
288852
288896
  }
288853
288897
  const m = h.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
@@ -289902,12 +289946,14 @@ var FREE_MODELS = /* @__PURE__ */ new Set([
289902
289946
  // coding, ~161 tok/s — on our NVIDIA key
289903
289947
  "free/north-mini-code",
289904
289948
  // coding, 607ms median — OpenRouter $0 pool
289949
+ "free/nemotron-3.5-bolt",
289950
+ // about a second, reads images
289905
289951
  "free/nemotron-3-nano-omni-30b-a3b-reasoning",
289906
- // vision (text/image/video/audio)
289907
- "free/nemotron-3-ultra-550b",
289952
+ // 256K ctx, reasoning
289953
+ "free/nemotron-3-super-120b",
289954
+ // reasoning; rescued often when capacity is short
289955
+ "free/nemotron-3-ultra-550b"
289908
289956
  // largest free model, 1M ctx — but slow + flaky
289909
- "free/llama-3.2-11b-vision"
289910
- // only free Llama left; slowest, so last
289911
289957
  ]);
289912
289958
  var gatewayModelIds;
289913
289959
  async function loadGatewayCatalog(apiBase, apiKey) {
@@ -290833,9 +290879,7 @@ var VIDEO_PRICING = {
290833
290879
  "bytedance/seedance-2.5": {
290834
290880
  pricePerSecond: 0.315,
290835
290881
  defaultDurationSeconds: 5
290836
- },
290837
- // Sora 2 via Azure AI Foundry — flat $0.10/s for both t2v and i2v.
290838
- "azure/sora-2": { pricePerSecond: 0.1, defaultDurationSeconds: 4 }
290882
+ }
290839
290883
  };
290840
290884
  var PHONE_PRICING = {
290841
290885
  "phone/lookup/fraud": 0.05,
@@ -290932,6 +290976,45 @@ function gatewaySettledCostUsd(response) {
290932
290976
  if (!Number.isFinite(value) || value < 0) return void 0;
290933
290977
  return value;
290934
290978
  }
290979
+ var NO_SESSION_ID = "no-session";
290980
+ var PAID_API_PATH = /^\/v1\/(?:partner|pm|exa|modal|stocks|usstock|crypto|fx|commodity|phone|voice)\//;
290981
+ function refuseOverCostCap(res, err) {
290982
+ if (!(err instanceof CostCapError) || res.headersSent) return false;
290983
+ res.writeHead(429, {
290984
+ "Content-Type": "application/json",
290985
+ "X-ClawRouter-Cost-Cap-Exceeded": "1"
290986
+ });
290987
+ res.end(
290988
+ JSON.stringify({
290989
+ error: { message: err.message, type: "cost_cap_exceeded", code: "cost_cap_exceeded" }
290990
+ })
290991
+ );
290992
+ return true;
290993
+ }
290994
+ var ZERO_CAP_FREE_READ = /^\/v1\/(?:models|usage|balance|audio\/models|audio\/voices|images\/models|video\/models|health\/[^/]+)$/;
290995
+ function withZeroCapGuard(inner, isFree) {
290996
+ return async (input2, init2) => {
290997
+ const { pathname } = new URL(input2 instanceof Request ? input2.url : String(input2));
290998
+ const path8 = pathname.slice(Math.max(pathname.indexOf("/v1/"), 0));
290999
+ const method = (init2?.method ?? "GET").toUpperCase();
291000
+ let allowed;
291001
+ if (/^\/v1\/(?:chat\/completions|messages)$/.test(path8)) {
291002
+ const body = init2?.body;
291003
+ let model;
291004
+ try {
291005
+ const text = typeof body === "string" ? body : body instanceof Uint8Array ? Buffer.from(body).toString() : "";
291006
+ model = JSON.parse(text).model;
291007
+ } catch {
291008
+ model = void 0;
291009
+ }
291010
+ allowed = typeof model === "string" && isFree(model);
291011
+ } else {
291012
+ allowed = ZERO_CAP_FREE_READ.test(path8) && (method === "GET" || method === "HEAD");
291013
+ }
291014
+ if (!allowed) throw new CostCapError(ZERO_CAP_REFUSAL);
291015
+ return inner(input2, init2);
291016
+ };
291017
+ }
290935
291018
  async function proxyPaidApiRequest(req, res, apiBase, payFetch, getActualPaymentUsd, accountPassthrough = false, authMode = "wallet") {
290936
291019
  const startTime = Date.now();
290937
291020
  const upstreamUrl = `${apiBase}${req.url}`;
@@ -291096,6 +291179,12 @@ function assertExistingProxyBillsUs(existing, requested) {
291096
291179
  }
291097
291180
  }
291098
291181
  async function startProxy(options) {
291182
+ if (options.maxCostPerRunUsd !== void 0 && !Number.isFinite(options.maxCostPerRunUsd)) {
291183
+ console.warn(
291184
+ `[ClawRouter] Ignoring maxCostPerRun: ${String(options.maxCostPerRunUsd)} is not a finite number`
291185
+ );
291186
+ options = { ...options, maxCostPerRunUsd: void 0 };
291187
+ }
291099
291188
  const upstreamProxy = await applyUpstreamProxy(options.upstreamProxy);
291100
291189
  if (upstreamProxy) {
291101
291190
  console.log(`[ClawRouter] Upstream proxy: ${upstreamProxy}`);
@@ -291196,6 +291285,7 @@ async function startProxy(options) {
291196
291285
  const account = walletKey ? privateKeyToAccount(walletKey) : void 0;
291197
291286
  const x402 = authMode === "wallet" ? new x402Client().setSpendControls(false) : void 0;
291198
291287
  const registerCostCapHook = (client) => client.onBeforePaymentCreation(async (context) => {
291288
+ if (options.maxCostPerRunUsd === 0) throw new CostCapError(ZERO_CAP_REFUSAL);
291199
291289
  const spend = paymentStore.getStore()?.sessionSpend;
291200
291290
  if (!spend?.isStrict) return;
291201
291291
  const quote = parseQuotedAmountMicros(context.selectedRequirements);
@@ -291317,8 +291407,12 @@ async function startProxy(options) {
291317
291407
  );
291318
291408
  }
291319
291409
  const requestOptions = solanaBatch ? { ...options, _solanaBatchActive: true } : options;
291410
+ const keyFetch = apiKey ? createApiKeyFetch(apiKey, fetch, apiBase) : void 0;
291320
291411
  const payFetch = authMode === "api-key" ? withSpendPolicy(
291321
- createApiKeyFetch(apiKey, fetch, apiBase),
291412
+ options.maxCostPerRunUsd === 0 ? withZeroCapGuard(keyFetch, (model) => {
291413
+ const { freeIds } = catalog.current();
291414
+ return freeIds.has(resolveModelAlias(model)) || [...freeIds].some((id2) => toUpstreamModelId(id2) === model);
291415
+ }) : keyFetch,
291322
291416
  options.spendControl ?? getSharedSpendControl(),
291323
291417
  () => {
291324
291418
  const store = paymentStore.getStore();
@@ -291887,6 +291981,7 @@ async function startProxy(options) {
291887
291981
  res.end(JSON.stringify(result));
291888
291982
  } catch (err) {
291889
291983
  if (clientAbort.signal.aborted) return;
291984
+ if (refuseOverCostCap(res, err)) return;
291890
291985
  const msg = err instanceof Error ? err.message : String(err);
291891
291986
  console.error(`[ClawRouter] Image generation error: ${msg}`);
291892
291987
  if (!res.headersSent) {
@@ -292024,6 +292119,7 @@ async function startProxy(options) {
292024
292119
  res.end(JSON.stringify(result));
292025
292120
  } catch (err) {
292026
292121
  if (clientAbort.signal.aborted) return;
292122
+ if (refuseOverCostCap(res, err)) return;
292027
292123
  const msg = err instanceof Error ? err.message : String(err);
292028
292124
  console.error(`[ClawRouter] Image editing error: ${msg}`);
292029
292125
  if (!res.headersSent) {
@@ -292120,6 +292216,7 @@ async function startProxy(options) {
292120
292216
  res.end(JSON.stringify(result));
292121
292217
  } catch (err) {
292122
292218
  if (clientAbort.signal.aborted) return;
292219
+ if (refuseOverCostCap(res, err)) return;
292123
292220
  const msg = err instanceof Error ? err.message : String(err);
292124
292221
  console.error(`[ClawRouter] Audio generation error: ${msg}`);
292125
292222
  if (!res.headersSent) {
@@ -292286,6 +292383,7 @@ async function startProxy(options) {
292286
292383
  res.end(JSON.stringify(finalResult));
292287
292384
  } catch (err) {
292288
292385
  if (clientAbort.signal.aborted) return;
292386
+ if (refuseOverCostCap(res, err)) return;
292289
292387
  const msg = err instanceof Error ? err.message : String(err);
292290
292388
  console.error(`[ClawRouter] Video generation error: ${msg}`);
292291
292389
  if (!res.headersSent) {
@@ -292296,9 +292394,7 @@ async function startProxy(options) {
292296
292394
  return;
292297
292395
  }
292298
292396
  const isVerbatimGatewayPath = req.url === "/v1/messages" || (req.url?.startsWith("/v1/messages?") ?? false) || req.url === "/v1/audio/speech" || (req.url?.startsWith("/v1/audio/speech?") ?? false);
292299
- if (isVerbatimGatewayPath || req.url?.match(
292300
- /^\/v1\/(?:partner|pm|exa|modal|stocks|usstock|crypto|fx|commodity|phone|voice)\//
292301
- )) {
292397
+ if (isVerbatimGatewayPath || req.url?.match(PAID_API_PATH)) {
292302
292398
  try {
292303
292399
  await proxyPaidApiRequest(
292304
292400
  req,
@@ -292310,6 +292406,7 @@ async function startProxy(options) {
292310
292406
  authMode
292311
292407
  );
292312
292408
  } catch (err) {
292409
+ if (refuseOverCostCap(res, err)) return;
292313
292410
  const error62 = err instanceof Error ? err : new Error(String(err));
292314
292411
  options.onError?.(error62);
292315
292412
  if (!res.headersSent) {
@@ -292342,6 +292439,7 @@ async function startProxy(options) {
292342
292439
  authMode
292343
292440
  );
292344
292441
  } catch (err) {
292442
+ if (refuseOverCostCap(res, err)) return;
292345
292443
  const error62 = err instanceof Error ? err : new Error(String(err));
292346
292444
  options.onError?.(error62);
292347
292445
  if (!res.headersSent) {
@@ -293134,6 +293232,7 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
293134
293232
  }
293135
293233
  } catch (err) {
293136
293234
  if (imagegenAbort.signal.aborted) return;
293235
+ if (refuseOverCostCap(res, err)) return;
293137
293236
  const errMsg = err instanceof Error ? err.message : String(err);
293138
293237
  console.error(`[ClawRouter] /imagegen error: ${errMsg}`);
293139
293238
  if (!res.headersSent) {
@@ -293340,6 +293439,7 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
293340
293439
  sendImg2ImgText(responseText);
293341
293440
  } catch (err) {
293342
293441
  if (img2imgAbort.signal.aborted) return;
293442
+ if (refuseOverCostCap(res, err)) return;
293343
293443
  const errMsg = err instanceof Error ? err.message : String(err);
293344
293444
  console.error(`[ClawRouter] /img2img error: ${errMsg}`);
293345
293445
  if (!res.headersSent) {
@@ -293763,13 +293863,20 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
293763
293863
  }
293764
293864
  }
293765
293865
  let sessionSpend;
293766
- if (options.maxCostPerRunUsd && effectiveSessionId && !isFreeModel && (options.maxCostPerRunMode ?? "graceful") === "strict") {
293866
+ if (options.maxCostPerRunUsd !== void 0 && !effectiveSessionId) {
293867
+ effectiveSessionId = NO_SESSION_ID;
293868
+ }
293869
+ if (options.maxCostPerRunUsd !== void 0 && effectiveSessionId && !isFreeModel && (options.maxCostPerRunMode ?? "graceful") === "strict") {
293767
293870
  const thisReqEstStr = estimatedCostMicros !== void 0 ? estimatedCostMicros.toString() : modelId ? estimate(modelId, body.length, maxTokens) : void 0;
293768
293871
  const admission = SessionSpend.admit(
293769
293872
  sessionStore,
293770
293873
  effectiveSessionId,
293771
293874
  usdToMicros(options.maxCostPerRunUsd),
293772
- parseMicros(thisReqEstStr) ?? 0n
293875
+ // No local price usually means zero here: on the wallet rail the signing
293876
+ // check still reads the real quote, and eco's free rungs carry no estimate.
293877
+ // The key rail has nothing behind this check, so count one micro, which
293878
+ // refuses a model it cannot price once the session has nothing left.
293879
+ parseMicros(thisReqEstStr) ?? (options.apiKey?.trim() && !catalog.freeIds.has(resolveModelAlias(modelId ?? "")) ? 1n : 0n)
293773
293880
  );
293774
293881
  if (!admission.admitted) {
293775
293882
  const spentUsd = microsToUsd(admission.spentMicros);
@@ -293797,12 +293904,12 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
293797
293904
  return;
293798
293905
  }
293799
293906
  sessionSpend = admission.spend;
293800
- } else if (options.maxCostPerRunUsd && effectiveSessionId) {
293907
+ } else if (options.maxCostPerRunUsd !== void 0 && effectiveSessionId) {
293801
293908
  sessionSpend = SessionSpend.track(sessionStore, effectiveSessionId);
293802
293909
  }
293803
293910
  const requestStore = paymentStore.getStore();
293804
293911
  if (requestStore) requestStore.sessionSpend = sessionSpend;
293805
- if (options.maxCostPerRunUsd && effectiveSessionId && !isFreeModel && (options.maxCostPerRunMode ?? "graceful") === "graceful") {
293912
+ if (options.maxCostPerRunUsd !== void 0 && effectiveSessionId && !isFreeModel && (options.maxCostPerRunMode ?? "graceful") === "graceful") {
293806
293913
  const runCostUsd = sessionStore.getSessionCostUsd(effectiveSessionId);
293807
293914
  const remainingUsd = options.maxCostPerRunUsd - runCostUsd;
293808
293915
  const isComplexOrAgentic = hasTools || routingDecision?.tier === "COMPLEX" || routingDecision?.tier === "REASONING";
@@ -293835,7 +293942,7 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
293835
293942
  }
293836
293943
  } else if (!routingDecision && modelId && !catalog.freeIds.has(modelId)) {
293837
293944
  const est = estimate(modelId, body.length, maxTokens);
293838
- const canAfford = !est || Number(est) / 1e6 <= remainingUsd;
293945
+ const canAfford = est ? Number(est) / 1e6 <= remainingUsd : remainingUsd > 0;
293839
293946
  if (!canAfford) {
293840
293947
  console.log(
293841
293948
  `[ClawRouter] Budget insufficient for explicit model ${modelId} in session ${effectiveSessionId.slice(0, 8)}...: $${Math.max(0, remainingUsd).toFixed(4)} remaining \u2014 blocking (user explicitly chose ${modelId})`
@@ -294065,14 +294172,14 @@ data: [DONE]
294065
294172
  modelsToTry.push(freeFallback);
294066
294173
  }
294067
294174
  }
294068
- if (options.maxCostPerRunUsd && effectiveSessionId && !isFreeModel && (options.maxCostPerRunMode ?? "graceful") === "graceful") {
294175
+ if (options.maxCostPerRunUsd !== void 0 && effectiveSessionId && !isFreeModel && (options.maxCostPerRunMode ?? "graceful") === "graceful") {
294069
294176
  const runCostUsd = sessionStore.getSessionCostUsd(effectiveSessionId);
294070
294177
  const remainingUsd = options.maxCostPerRunUsd - runCostUsd;
294071
294178
  const beforeFilter = [...modelsToTry];
294072
294179
  modelsToTry = modelsToTry.filter((m) => {
294073
- if (catalog.freeIds.has(m)) return true;
294180
+ if (catalog.freeIds.has(resolveModelAlias(m))) return true;
294074
294181
  const est = estimate(m, body.length, maxTokens);
294075
- if (!est) return true;
294182
+ if (!est) return remainingUsd > 0;
294076
294183
  return Number(est) / 1e6 <= remainingUsd;
294077
294184
  });
294078
294185
  const excluded = beforeFilter.filter((m) => !modelsToTry.includes(m));
@@ -294111,14 +294218,16 @@ data: [DONE]
294111
294218
  res.removeListener("close", onClientClose);
294112
294219
  return;
294113
294220
  }
294114
- if (excluded.length > 0) {
294221
+ if (excluded.length > 0 && modelsToTry[0] !== beforeFilter[0]) {
294115
294222
  const budgetSummary = remainingUsd > 0 ? `$${remainingUsd.toFixed(4)} remaining` : `budget exhausted ($${runCostUsd.toFixed(4)}/$${options.maxCostPerRunUsd})`;
294116
294223
  console.log(
294117
294224
  `[ClawRouter] Budget downgrade (${budgetSummary}): excluded ${excluded.join(", ")}`
294118
294225
  );
294119
294226
  const fromModel = excluded[0];
294120
294227
  const usingFree = modelsToTry.length === 1 && catalog.freeIds.has(modelsToTry[0]);
294121
- if (usingFree) {
294228
+ if (options.maxCostPerRunUsd === 0) {
294229
+ budgetDowngradeNotice = void 0;
294230
+ } else if (usingFree) {
294122
294231
  budgetDowngradeNotice = `> **\u26A0\uFE0F Budget cap reached** ($${runCostUsd.toFixed(4)}/$${options.maxCostPerRunUsd}) \u2014 downgraded to free model. Quality may be reduced. Increase \`maxCostPerRun\` to continue with ${fromModel}.
294123
294232
 
294124
294233
  `;
@@ -307633,7 +307742,7 @@ async function startProxyInBackground(api, startupGeneration) {
307633
307742
  api.logger.info(`Using wallet from BLOCKRUN_WALLET_KEY: ${wallet.address}`);
307634
307743
  }
307635
307744
  const routingConfig = api.pluginConfig?.routing;
307636
- const maxCostPerRunUsd = typeof api.pluginConfig?.maxCostPerRun === "number" ? api.pluginConfig.maxCostPerRun : void 0;
307745
+ const maxCostPerRunUsd = typeof api.pluginConfig?.maxCostPerRun === "number" && Number.isFinite(api.pluginConfig.maxCostPerRun) ? api.pluginConfig.maxCostPerRun : void 0;
307637
307746
  const maxCostPerRunMode = api.pluginConfig?.maxCostPerRunMode === "strict" ? "strict" : "graceful";
307638
307747
  if (maxCostPerRunUsd !== void 0) {
307639
307748
  api.logger.info(
@@ -1,7 +1,7 @@
1
1
  # 9 Free AI Models, Zero Cost: How BlockRun Gives Developers Top-Tier LLMs for Nothing
2
2
 
3
3
  > **The count in this title is a snapshot, and so is every model name below.**
4
- > It was 9 when this was written; the published free tier is <!-- br:models.free -->7<!-- /br:models.free --> today, and _none_ of the
4
+ > It was 9 when this was written; the published free tier is <!-- br:models.free -->8<!-- /br:models.free --> today, and _none_ of the
5
5
  > nine originals is still in it. Free hosting is volatile — NVIDIA retired four
6
6
  > of the five visible free models in a single sweep on 2026-08-30 — so the tier
7
7
  > gets rebuilt rather than topped up. The URL keeps its original slug so existing
@@ -23,7 +23,7 @@ BlockRun's answer: just take them.
23
23
 
24
24
  ---
25
25
 
26
- ## The Lineup: <!-- br:models.free -->7<!-- /br:models.free --> Models, $0.00
26
+ ## The Lineup: <!-- br:models.free -->8<!-- /br:models.free --> Models, $0.00
27
27
 
28
28
  Through [ClawRouter](https://github.com/BlockRunAI/ClawRouter) — BlockRun's local AI routing proxy — you get zero-cost access to the following (checked against the live catalog 2026-09-29):
29
29
 
@@ -32,7 +32,9 @@ Through [ClawRouter](https://github.com/BlockRunAI/ClawRouter) — BlockRun's lo
32
32
  | **Nemotron 3.5 Lightning** | 1M | ✅ | The free default — thinking-mode reasoning |
33
33
  | **Nemotron 3 Ultra 550B** | 1M | ✅ | Largest free model — 550B / 55B active MoE |
34
34
  | **Nemotron 3 Nano Omni 30B** | 256K | ✅ | Strong generalist (text only in practice) |
35
- | **Llama 3.2 11B Vision** | 128K | — | Meta Llama (text only in practice) |
35
+ | **Nemotron 3 Super 120B** | 131K | ✅ | Reasoning |
36
+ | **Nemotron 3.5 Bolt** | 131K | — | About a second to answer, reads images |
37
+ | **Muse Glimmer 30B** | 131K | ✅ | Meta's open model, text only |
36
38
  | **Cohere North Mini Code** | 256K | ✅ | Coding, sub-second responses |
37
39
  | **Poolside Laguna XS 2.1** | 131K | — | Coding, ~161 tok/s |
38
40
 
@@ -110,11 +112,23 @@ A 30B-A3B mixture-of-experts model with a **1M-token context** and thinking-mode
110
112
 
111
113
  **Best for:** General reasoning at 256K context, for free.
112
114
 
113
- ### Llama 3.2 11B Vision — The Free Llama
115
+ ### Nemotron 3.5 Bolt — The One That Reads Images
114
116
 
115
- Meta's Llama 3.2 11B with a 128K window. It is older than everything else here, and that is the point: a 12-model sweep of what NVIDIA still serves free found this was the only Llama that actually finishes a real completion. The name promises image input; the gateway does not deliver it (see below).
117
+ Small and fast: about a second to answer, 131K context, no thinking pass. It's the only free model ClawRouter flags for vision, having got 8 of 8 right on solid-colour PNGs across Base and Solana.
116
118
 
117
- **Best for:** Anyone who needs a Llama specifically.
119
+ **Best for:** Quick answers, and image turns you don't want to pay for.
120
+
121
+ ### Nemotron 3 Super 120B — The Other Reasoner
122
+
123
+ 12B active parameters with thinking mode and a 131K window. Under heavy load the gateway often answers from another free model instead, so check the response's `model` field if it matters which one replied.
124
+
125
+ **Best for:** Reasoning when your prompt fits in 131K.
126
+
127
+ ### Muse Glimmer 30B — The Free Meta Model
128
+
129
+ Meta's open line after Llama, 29.6B dense with a 131K window. It's a reasoning model, so give it a real token budget: at 300 `max_tokens` it can spend everything on reasoning and return an empty answer. Text only. NVIDIA retired the last free Llama on 2026-11-02, so this is the closest free option.
130
+
131
+ **Best for:** Anyone who wants a free Meta model.
118
132
 
119
133
  ### Cohere North Mini Code — The Fast Coder
120
134
 
@@ -170,8 +184,10 @@ If you're using Claude Code, one command switches you to any free model:
170
184
  ```
171
185
  /model free → Nemotron 3.5 Lightning (1M ctx, the default)
172
186
  /model ultra-550b → Nemotron 3 Ultra 550B (largest)
173
- /model vision-free → Nemotron 3 Nano Omni (text only, see below)
174
- /model llama-vision → Llama 3.2 11B Vision (text only, see below)
187
+ /model vision-free → Nemotron 3.5 Bolt (reads images)
188
+ /model nemotron-omni → Nemotron 3 Nano Omni (text only, see below)
189
+ /model super-120b → Nemotron 3 Super 120B
190
+ /model muse → Muse Glimmer 30B
175
191
  /model north-mini → Cohere North Mini Code
176
192
  /model laguna → Poolside Laguna XS 2.1
177
193
  ```
@@ -190,13 +206,13 @@ The gateway will return structured tool calls from these models, but ClawRouter
190
206
 
191
207
  ### 2. Reasoning Has a Ceiling
192
208
 
193
- Four of the six are reasoning-capable and handle most tasks well. On the hardest problems — competition-level math, formal proofs, deep multi-step planning — they don't match Claude Opus 5 or Sonnet 5. That's why ClawRouter's REASONING tier doesn't use free models.
209
+ Six of the eight are reasoning-capable and handle most tasks well. On the hardest problems — competition-level math, formal proofs, deep multi-step planning — they don't match Claude Opus 5 or Sonnet 5. That's why ClawRouter's REASONING tier doesn't use free models.
194
210
 
195
- ### 3. There Is No Working Free Vision
211
+ ### 3. Only One Free Model Reads Images Reliably
196
212
 
197
- Two of the six are catalogued as vision-capable, and neither survives a real probe. On a 64×64 solid-red PNG, `nemotron-3-nano-omni` answered correctly 1 time in 4 on Base and returned "white" on Solana — where the response's own `model` field revealed a silent fallback to a text model. `llama-3.2-11b-vision` replied "I'm unable to see the image" on 3 of 3 attempts while answering plain text fine. Every one of those failures is an **HTTP 200**: the image is dropped and a confident wrong answer comes back with no error to branch on.
213
+ `nemotron-3.5-bolt` got 8 of 8 right on 64×64 solid-colour PNGs across Base and Solana on 2026-11-05. The others don't hold up the same way: `nemotron-3-nano-omni` answered correctly 1 time in 4 on Base in August, and only 2 of 8 probes of `nemotron-3-super-120b` were answered by that model.
198
214
 
199
- ClawRouter therefore ships no `vision` flag on any free model, so requests carrying an image route to a paid vision model instead. The general lesson is worth more than the specific finding: **a catalog's capability list is a claim, not a measurement** — and one passing sample is not a measurement either. The first probe here returned the right colour; it took four to see that was luck.
215
+ ClawRouter therefore flags only Bolt for vision. Pin it with `/model vision-free`; otherwise requests carrying an image route to a paid vision model. The general lesson is worth more than the specific finding: **a catalog's capability list is a claim, not a measurement** — and one passing sample is not a measurement either. The first probe here returned the right colour; it took four to see that was luck.
200
216
 
201
217
  ### 4. Free Hosting Is Volatile
202
218
 
@@ -216,7 +232,8 @@ Code generation → North Mini Code or Laguna XS 2.1
216
232
  Reasoning required → Nemotron 3.5 Lightning (1M ctx)
217
233
  Hardest free reasoning → Nemotron 3 Ultra 550B
218
234
  Long-context reasoning → Nemotron 3.5 Lightning (1M)
219
- A Llama specifically → Llama 3.2 11B Vision
235
+ Free image turns → Nemotron 3.5 Bolt
236
+ A free Meta model → Muse Glimmer 30B
220
237
  ```
221
238
 
222
239
  ### Strategy 2: Free for 80%, Paid for 20%
@@ -236,13 +253,13 @@ Look at the cost trajectory over the past three years:
236
253
  - **2023:** GPT-4 dominates alone at $30/$60 per M tokens
237
254
  - **2024:** Open-source models surge, prices halve repeatedly
238
255
  - **2025:** DeepSeek, Qwen push top-tier inference below $1/M
239
- - **2026:** BlockRun offers <!-- br:models.free -->7<!-- /br:models.free --> free models through a single API
256
+ - **2026:** BlockRun offers <!-- br:models.free -->8<!-- /br:models.free --> free models through a single API
240
257
 
241
258
  **A free tier that gets rebuilt rather than retired isn't just a product feature — it's a signal.** Baseline AI capability is becoming infrastructure. Like internet bandwidth before it, the cost of "good enough" AI inference is converging toward zero.
242
259
 
243
260
  BlockRun and ClawRouter exist to be the **routing layer** in this transition: not locked to any single provider, not bound to any single model, always giving developers the lowest-cost path to the right capability.
244
261
 
245
- Today it's <!-- br:models.free -->7<!-- /br:models.free --> free models, and they are not the same seven as last month. Tomorrow it could be 50. Prices will only drop. Capabilities will only improve. The names will keep churning.
262
+ Today it's <!-- br:models.free -->8<!-- /br:models.free --> free models, and they are not the same seven as last month. Tomorrow it could be 50. Prices will only drop. Capabilities will only improve. The names will keep churning.
246
263
 
247
264
  **The one constant: your code doesn't need to change.**
248
265
 
@@ -257,7 +274,7 @@ clawrouter start
257
274
 
258
275
  Point your `base_url` to `http://localhost:8402/v1`. That's the whole setup.
259
276
 
260
- <!-- br:models.free -->7<!-- /br:models.free --> free models. Up to 1M context. Unlimited calls. Zero cost.
277
+ <!-- br:models.free -->8<!-- /br:models.free --> free models. Up to 1M context. Unlimited calls. Zero cost.
261
278
 
262
279
  Go build something.
263
280
 
@@ -50,13 +50,13 @@ This is where you're paying for real value:
50
50
 
51
51
  ## The Solution: ClawRouter
52
52
 
53
- [ClawRouter](https://github.com/BlockRunAI/ClawRouter) is an open-source local proxy that sits between your app and <!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> AI models. It saves you money in three ways: **smart routing**, **token optimization**, and **response caching**.
53
+ [ClawRouter](https://github.com/BlockRunAI/ClawRouter) is an open-source local proxy that sits between your app and <!-- br:models.chatVisible -->91<!-- /br:models.chatVisible --> AI models. It saves you money in three ways: **smart routing**, **token optimization**, and **response caching**.
54
54
 
55
55
  ```
56
56
  ┌─────────────┐ ┌──────────────────────────────┐ ┌──────────────────┐
57
- │ Your App │────▶│ ClawRouter │────▶│ 41+ AI Models │
57
+ │ Your App │────▶│ ClawRouter │────▶│ 90+ AI Models │
58
58
  │ (OpenAI │ │ (local proxy) │ │ │
59
- │ SDK) │ │ │ │ FREE (9 free) │
59
+ │ SDK) │ │ │ │ FREE (8 free) │
60
60
  │ │ │ 1. Route to cheapest model │ │ $0.10 (gemini) │
61
61
  │ model: │ │ 2. Compress tokens │ │ $3.00 (sonnet) │
62
62
  │ "auto" │ │ 3. Cache repeated requests │ │ $0.20 (grok) │
@@ -31,7 +31,7 @@ This is exactly the problem [ClawRouter](https://github.com/BlockRunAI/ClawRoute
31
31
 
32
32
  ## ClawRouter: Smart Routing for Agents
33
33
 
34
- ClawRouter is an open-source local proxy that sits between your agent and <!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> LLM models across 9 providers. It analyzes every request across 15 dimensions and routes it to the cheapest model that can handle it — in under 1ms, entirely locally.
34
+ ClawRouter is an open-source local proxy that sits between your agent and <!-- br:models.chatVisible -->91<!-- /br:models.chatVisible --> LLM models across 9 providers. It analyzes every request across 15 dimensions and routes it to the cheapest model that can handle it — in under 1ms, entirely locally.
35
35
 
36
36
  ```
37
37
  Your Agent → ClawRouter (localhost:8402) → Best model for the job
@@ -74,12 +74,12 @@ Then point your agent at `http://localhost:8402/v1/` with any OpenAI-compatible
74
74
 
75
75
  - **No API keys to manage** — wallet-based cryptographic auth
76
76
  - **No subscriptions** — pay per request in USDC (Base or Solana)
77
- - **No vendor lock-in** — <!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> models, switch anytime
77
+ - **No vendor lock-in** — <!-- br:models.chatVisible -->91<!-- /br:models.chatVisible --> models, switch anytime
78
78
  - **You control your wallet** — non-custodial, funds never held by a third party
79
79
  - **Budget caps** — set a max spend per session, ClawRouter gracefully downgrades when budget runs low
80
80
  - **Token compression** — 7-layer pipeline reduces token costs by 7–40% before they hit any provider
81
81
  - **Response caching** — identical requests within 10 minutes cost $0
82
- - **<!-- br:models.free -->7<!-- /br:models.free --> free models** — for tasks that don't need a paid model at all
82
+ - **<!-- br:models.free -->8<!-- /br:models.free --> free models** — for tasks that don't need a paid model at all
83
83
 
84
84
  ### Routing Profiles
85
85
 
@@ -222,7 +222,7 @@ OpenRouter doesn't always pass through provider-specific features correctly. Ima
222
222
 
223
223
  **Direct provider routing.** ClawRouter routes through BlockRun's API directly to providers — not through a second aggregator. One hop, not two. Provider-specific features work because there's no middleman translating them.
224
224
 
225
- ![Guaranteed Feature Parity & Direct Connectivity — Three-panel diagram: Vision (image_url auto-detected → vision-capable models only), Tool Calling (toolCalling flag → agentic models only), Catalog (curated <!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> models with automatic legacy-to-modern redirects). Direct provider routing means no dropped payloads.](./assets/clawrouter-feature-parity-direct-connectivity.png)
225
+ ![Guaranteed Feature Parity & Direct Connectivity — Three-panel diagram: Vision (image_url auto-detected → vision-capable models only), Tool Calling (toolCalling flag → agentic models only), Catalog (curated <!-- br:models.chatVisible -->91<!-- /br:models.chatVisible --> models with automatic legacy-to-modern redirects). Direct provider routing means no dropped payloads.](./assets/clawrouter-feature-parity-direct-connectivity.png)
226
226
 
227
227
  ---
228
228
 
@@ -240,7 +240,7 @@ When new models launch, OpenRouter's catalog lags. Users configure a model that
240
240
 
241
241
  ### How ClawRouter Solves This
242
242
 
243
- ClawRouter maintains a curated catalog of <!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> models across 9 providers (including <!-- br:models.free -->7<!-- /br:models.free --> free models), updated with each release. Delisted models have automatic redirect aliases:
243
+ ClawRouter maintains a curated catalog of <!-- br:models.chatVisible -->91<!-- /br:models.chatVisible --> models across 9 providers (including <!-- br:models.free -->8<!-- /br:models.free --> free models), updated with each release. Delisted models have automatic redirect aliases:
244
244
 
245
245
  ```typescript
246
246
  // Delisted models redirect automatically
@@ -268,7 +268,7 @@ No silent drops. No stale catalog. Models are benchmarked for speed, quality, an
268
268
  | **Rate limits** | Per-key, shared | Per-wallet, independent |
269
269
  | **Vision support** | Images sometimes dropped | Auto-detected, vision-only fallback |
270
270
  | **Tool calling** | Silent failures with some models | Flag-based filtering, guaranteed support |
271
- | **Model catalog** | Laggy, silent drops | Curated <!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> models, redirect aliases |
271
+ | **Model catalog** | Laggy, silent drops | Curated <!-- br:models.chatVisible -->91<!-- /br:models.chatVisible --> models, redirect aliases |
272
272
  | **Budget control** | Monthly invoice | Per-session cap (`maxCostPerRun`) |
273
273
  | **Setup** | Create account, paste key | Agent generates wallet, auto-configured |
274
274
  | **Average cost** | $25/M tokens (Opus direct) | auto-routed = **<!-- br:savings.autoVsBaselinePct -->84<!-- /br:savings.autoVsBaselinePct -->% savings** |
@@ -533,7 +533,9 @@ plugins:
533
533
  - id: "@blockrun/clawrouter"
534
534
  config:
535
535
  # Maximum spend per session/run in USD.
536
- # Default: disabled (no limit)
536
+ # Default: disabled (no limit). 0 refuses every paid call on every endpoint,
537
+ # so only free models answer. Pin a free model: strict mode refuses auto and
538
+ # premium, and graceful mode refuses them on tool calls.
537
539
  maxCostPerRun: 0.50 # $0.50 per session
538
540
 
539
541
  # How to enforce the budget cap. Default: graceful
@@ -552,7 +554,8 @@ plugins:
552
554
  # fallbacks) is checked against the cap before it is signed.
553
555
  maxCostPerRunMode: graceful # or: strict
554
556
 
555
- # Note: image generation endpoints (/v1/images/generations) bypass maxCostPerRun.
557
+ # Note: a positive cap applies to /v1/chat/completions only. /v1/messages, image,
558
+ # video, music and speech generation, and the partner and data APIs bypass it.
556
559
  # Their cost is charged via x402 micropayment directly and is not tracked per-session.
557
560
 
558
561
  routing: