From f347e3fca06b4fc54c2b8c8d90f33b898652e849 Mon Sep 17 00:00:00 2001 From: Theodore Li Date: Sat, 14 Mar 2026 11:27:22 -0700 Subject: [PATCH] fix(firecrawl) fix firecrawl scrape credit usage calculation (#3583) * fix(firecrawl) fix firecrawl scrape credit usage calculation * Update apps/sim/tools/firecrawl/scrape.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * Fix syntax --------- Co-authored-by: Theodore Li Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- apps/sim/tools/firecrawl/scrape.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/sim/tools/firecrawl/scrape.ts b/apps/sim/tools/firecrawl/scrape.ts index ed0a19aef4..bdd8ab9d6f 100644 --- a/apps/sim/tools/firecrawl/scrape.ts +++ b/apps/sim/tools/firecrawl/scrape.ts @@ -38,11 +38,11 @@ export const scrapeTool: ToolConfig = { pricing: { type: 'custom', getCost: (_params, output) => { - if (output.creditsUsed == null) { + const creditsUsed = (output.metadata as { creditsUsed?: number })?.creditsUsed + if (creditsUsed == null) { throw new Error('Firecrawl response missing creditsUsed field') } - const creditsUsed = Number(output.creditsUsed) if (Number.isNaN(creditsUsed)) { throw new Error('Firecrawl response returned a non-numeric creditsUsed field') }