Skip to content

Commit 16961cf

Browse files
committed
fix(firecrawl): add pricing config to parse tool hosting
1 parent 29580b3 commit 16961cf

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

apps/sim/tools/firecrawl/parse.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,24 @@ export const parseTool: ToolConfig<ParseParams, ParseResponse> = {
8787
envKeyPrefix: 'FIRECRAWL_API_KEY',
8888
apiKeyParam: 'apiKey',
8989
byokProviderId: 'firecrawl',
90+
pricing: {
91+
type: 'custom',
92+
getCost: (_params, output) => {
93+
const creditsUsed = (output.metadata as { creditsUsed?: number })?.creditsUsed
94+
if (creditsUsed == null) {
95+
throw new Error('Firecrawl response missing creditsUsed field')
96+
}
97+
98+
if (Number.isNaN(creditsUsed)) {
99+
throw new Error('Firecrawl response returned a non-numeric creditsUsed field')
100+
}
101+
102+
return {
103+
cost: creditsUsed * 0.001,
104+
metadata: { creditsUsed },
105+
}
106+
},
107+
},
90108
rateLimit: {
91109
mode: 'per_request',
92110
requestsPerMinute: 100,

0 commit comments

Comments
 (0)