Skip to content

Commit fa1ae13

Browse files
TheodoreSpeaksTheodore Li
andauthored
feat(clean-hosted-keys) Remove eleven labs, browseruse. Tweak firecrawl and mistral key impl (#3503)
* Remove eleven labs, browseruse, and firecrawl * Remove creditsUsed output * Add back mistral hosting for mistral blocks * Add back firecrawl since they queue up concurrent requests * Fix price calculation, remove agent since its super long running and will clog up queue * Define hosting per tool * Remove redundant token finding --------- Co-authored-by: Theodore Li <theo@sim.ai>
1 parent 6db8bc4 commit fa1ae13

File tree

19 files changed

+112
-233
lines changed

19 files changed

+112
-233
lines changed

apps/sim/app/api/workspaces/[id]/byok-keys/route.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@ const VALID_PROVIDERS = [
1818
'anthropic',
1919
'google',
2020
'mistral',
21+
'firecrawl',
2122
'exa',
22-
'browser_use',
2323
'serper',
24-
'firecrawl',
2524
'linkup',
2625
'perplexity',
2726
'jina',
2827
'google_cloud',
29-
'elevenlabs',
3028
'parallel_ai',
3129
'brandfetch',
3230
] as const

apps/sim/app/workspace/[workspaceId]/settings/components/byok/byok.tsx

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import {
1616
import {
1717
AnthropicIcon,
1818
BrandfetchIcon,
19-
BrowserUseIcon,
20-
ElevenLabsIcon,
2119
ExaAIIcon,
2220
FirecrawlIcon,
2321
GeminiIcon,
@@ -77,34 +75,27 @@ const PROVIDERS: {
7775
description: 'LLM calls and Knowledge Base OCR',
7876
placeholder: 'Enter your API key',
7977
},
78+
{
79+
id: 'firecrawl',
80+
name: 'Firecrawl',
81+
icon: FirecrawlIcon,
82+
description: 'Web scraping, crawling, search, and extraction',
83+
placeholder: 'Enter your Firecrawl API key',
84+
},
8085
{
8186
id: 'exa',
8287
name: 'Exa',
8388
icon: ExaAIIcon,
8489
description: 'AI-powered search and research',
8590
placeholder: 'Enter your Exa API key',
8691
},
87-
{
88-
id: 'browser_use',
89-
name: 'Browser Use',
90-
icon: BrowserUseIcon,
91-
description: 'Browser automation tasks',
92-
placeholder: 'Enter your Browser Use API key',
93-
},
9492
{
9593
id: 'serper',
9694
name: 'Serper',
9795
icon: SerperIcon,
9896
description: 'Google search API',
9997
placeholder: 'Enter your Serper API key',
10098
},
101-
{
102-
id: 'firecrawl',
103-
name: 'Firecrawl',
104-
icon: FirecrawlIcon,
105-
description: 'Web scraping, crawling, and data extraction',
106-
placeholder: 'Enter your Firecrawl API key',
107-
},
10899
{
109100
id: 'linkup',
110101
name: 'Linkup',
@@ -133,13 +124,6 @@ const PROVIDERS: {
133124
description: 'Web reading and search',
134125
placeholder: 'jina_...',
135126
},
136-
{
137-
id: 'elevenlabs',
138-
name: 'ElevenLabs',
139-
icon: ElevenLabsIcon,
140-
description: 'Text-to-speech generation',
141-
placeholder: 'Enter your ElevenLabs API key',
142-
},
143127
{
144128
id: 'google_cloud',
145129
name: 'Google Cloud',

apps/sim/blocks/blocks/browser_use.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ export const BrowserUseBlock: BlockConfig<BrowserUseResponse> = {
7272
password: true,
7373
placeholder: 'Enter your BrowserUse API key',
7474
required: true,
75-
hideWhenHosted: true,
7675
},
7776
],
7877
tools: {

apps/sim/blocks/blocks/elevenlabs.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export const ElevenLabsBlock: BlockConfig<ElevenLabsBlockResponse> = {
4848
placeholder: 'Enter your ElevenLabs API key',
4949
password: true,
5050
required: true,
51-
hideWhenHosted: true,
5251
},
5352
],
5453

apps/sim/blocks/blocks/firecrawl.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,23 @@ Example 2 - Product Data:
249249
password: true,
250250
required: true,
251251
hideWhenHosted: true,
252+
condition: {
253+
field: 'operation',
254+
value: 'agent',
255+
not: true,
256+
},
257+
},
258+
{
259+
id: 'apiKey',
260+
title: 'API Key',
261+
type: 'short-input',
262+
placeholder: 'Enter your Firecrawl API key',
263+
password: true,
264+
required: true,
265+
condition: {
266+
field: 'operation',
267+
value: 'agent',
268+
},
252269
},
253270
],
254271
tools: {
@@ -444,7 +461,6 @@ Example 2 - Product Data:
444461
// Crawl output
445462
pages: { type: 'json', description: 'Crawled pages data' },
446463
total: { type: 'number', description: 'Total pages found' },
447-
creditsUsed: { type: 'number', description: 'Credits consumed' },
448464
// Map output
449465
success: { type: 'boolean', description: 'Operation success status' },
450466
links: { type: 'json', description: 'Discovered URLs array' },

apps/sim/blocks/blocks/mistral_parse.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,22 @@ export const MistralParseBlock: BlockConfig<MistralParserOutput> = {
6868
placeholder: 'Enter your Mistral API key',
6969
password: true,
7070
required: true,
71+
hideWhenHosted: true,
7172
},
7273
],
7374
tools: {
7475
access: ['mistral_parser'],
7576
config: {
7677
tool: () => 'mistral_parser',
7778
params: (params) => {
78-
if (!params || !params.apiKey || params.apiKey.trim() === '') {
79-
throw new Error('Mistral API key is required')
80-
}
81-
8279
const parameters: Record<string, unknown> = {
83-
apiKey: params.apiKey.trim(),
8480
resultType: params.resultType || 'markdown',
8581
}
8682

83+
if (params.apiKey?.trim()) {
84+
parameters.apiKey = params.apiKey.trim()
85+
}
86+
8787
const inputMethod = params.inputMethod || 'url'
8888
if (inputMethod === 'url') {
8989
if (!params.filePath || params.filePath.trim() === '') {
@@ -195,6 +195,7 @@ export const MistralParseV2Block: BlockConfig<MistralParserOutput> = {
195195
placeholder: 'Enter your Mistral API key',
196196
password: true,
197197
required: true,
198+
hideWhenHosted: true,
198199
},
199200
],
200201
tools: {
@@ -206,15 +207,14 @@ export const MistralParseV2Block: BlockConfig<MistralParserOutput> = {
206207
fallbackToolId: 'mistral_parser_v2',
207208
}),
208209
params: (params) => {
209-
if (!params || !params.apiKey || params.apiKey.trim() === '') {
210-
throw new Error('Mistral API key is required')
211-
}
212-
213210
const parameters: Record<string, unknown> = {
214-
apiKey: params.apiKey.trim(),
215211
resultType: params.resultType || 'markdown',
216212
}
217213

214+
if (params.apiKey?.trim()) {
215+
parameters.apiKey = params.apiKey.trim()
216+
}
217+
218218
// Use canonical document param directly
219219
const documentInput = params.document
220220
if (!documentInput) {

apps/sim/tools/browser_use/run_task.ts

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { createLogger } from '@sim/logger'
22
import { getMaxExecutionTimeout } from '@/lib/core/execution-limits'
3-
import { PlatformEvents } from '@/lib/core/telemetry'
43
import type { BrowserUseRunTaskParams, BrowserUseRunTaskResponse } from '@/tools/browser_use/types'
54
import type { ToolConfig, ToolResponse } from '@/tools/types'
65

@@ -257,62 +256,6 @@ export const runTaskTool: ToolConfig<BrowserUseRunTaskParams, BrowserUseRunTaskR
257256
},
258257
},
259258

260-
hosting: {
261-
envKeyPrefix: 'BROWSER_USE_API_KEY',
262-
apiKeyParam: 'apiKey',
263-
byokProviderId: 'browser_use',
264-
pricing: {
265-
type: 'custom',
266-
getCost: (params, output) => {
267-
if (!Array.isArray(output.steps)) {
268-
throw new Error('Browser Use response missing steps array, cannot determine cost')
269-
}
270-
const INIT_COST = 0.01
271-
const STEP_COSTS: Record<string, number> = {
272-
'browser-use-llm': 0.002,
273-
'browser-use-2.0': 0.006,
274-
o3: 0.03,
275-
'o4-mini': 0.03,
276-
'gemini-3-pro-preview': 0.03,
277-
'gemini-3-flash-preview': 0.015,
278-
'gemini-flash-latest': 0.0075,
279-
'gemini-flash-lite-latest': 0.005,
280-
'gemini-2.5-flash': 0.0075,
281-
'gemini-2.5-pro': 0.03,
282-
'claude-sonnet-4-5-20250929': 0.05,
283-
'claude-opus-4-5-20251101': 0.05,
284-
'claude-3-7-sonnet-20250219': 0.05,
285-
'gpt-4o': 0.006,
286-
'gpt-4o-mini': 0.006,
287-
'gpt-4.1': 0.006,
288-
'gpt-4.1-mini': 0.006,
289-
'llama-4-maverick-17b-128e-instruct': 0.006,
290-
}
291-
const DEFAULT_STEP_COST = 0.006
292-
const model = (params.model as string) || 'browser-use-2.0'
293-
const knownCost = STEP_COSTS[model]
294-
if (!knownCost) {
295-
logger.warn(
296-
`Unknown Browser Use model "${model}", using default step cost $${DEFAULT_STEP_COST}`
297-
)
298-
PlatformEvents.hostedKeyUnknownModelCost({
299-
toolId: 'browser_use_run_task',
300-
modelName: model,
301-
defaultCost: DEFAULT_STEP_COST,
302-
})
303-
}
304-
const stepCost = knownCost ?? DEFAULT_STEP_COST
305-
const stepCount = output.steps.length
306-
const total = INIT_COST + stepCount * stepCost
307-
return { cost: total, metadata: { model, stepCount, stepCost, initCost: INIT_COST } }
308-
},
309-
},
310-
rateLimit: {
311-
mode: 'per_request',
312-
requestsPerMinute: 100,
313-
},
314-
},
315-
316259
request: {
317260
url: 'https://api.browser-use.com/api/v2/tasks',
318261
method: 'POST',

apps/sim/tools/elevenlabs/constants.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

apps/sim/tools/elevenlabs/tts.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { FLASH_TURBO_MODELS } from '@/tools/elevenlabs/constants'
21
import type { ElevenLabsTtsParams, ElevenLabsTtsResponse } from '@/tools/elevenlabs/types'
32
import type { ToolConfig } from '@/tools/types'
43

@@ -8,32 +7,6 @@ export const elevenLabsTtsTool: ToolConfig<ElevenLabsTtsParams, ElevenLabsTtsRes
87
description: 'Convert TTS using ElevenLabs voices',
98
version: '1.0.0',
109

11-
hosting: {
12-
envKeyPrefix: 'ELEVENLABS_API_KEY',
13-
apiKeyParam: 'apiKey',
14-
byokProviderId: 'elevenlabs',
15-
pricing: {
16-
type: 'custom',
17-
getCost: (params, _output) => {
18-
const text = params.text as string | undefined
19-
if (!text) {
20-
throw new Error('Missing text parameter, cannot determine character cost')
21-
}
22-
const characterCount = text.length
23-
const modelId = (params.modelId as string) || 'eleven_monolingual_v1'
24-
// Flash/Turbo: $0.08/1K chars, Standard/Multilingual/v3: $0.18/1K chars
25-
// Scale tier additional character rates — https://elevenlabs.io/pricing/api
26-
const costPer1KChars = FLASH_TURBO_MODELS.has(modelId) ? 0.08 : 0.18
27-
const cost = (characterCount / 1000) * costPer1KChars
28-
return { cost, metadata: { characterCount, modelId, costPer1KChars } }
29-
},
30-
},
31-
rateLimit: {
32-
mode: 'per_request',
33-
requestsPerMinute: 30,
34-
},
35-
},
36-
3710
params: {
3811
text: {
3912
type: 'string',

apps/sim/tools/firecrawl/agent.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,6 @@ export const agentTool: ToolConfig<AgentParams, AgentResponse> = {
5555
},
5656
},
5757

58-
hosting: {
59-
envKeyPrefix: 'FIRECRAWL_API_KEY',
60-
apiKeyParam: 'apiKey',
61-
byokProviderId: 'firecrawl',
62-
pricing: {
63-
type: 'custom',
64-
getCost: (_params, output) => {
65-
if (output.creditsUsed == null) {
66-
throw new Error('Firecrawl agent response missing creditsUsed field')
67-
}
68-
const creditsUsed = output.creditsUsed as number
69-
const cost = creditsUsed * 0.001
70-
return { cost, metadata: { creditsUsed } }
71-
},
72-
},
73-
rateLimit: {
74-
mode: 'per_request',
75-
requestsPerMinute: 100,
76-
},
77-
},
78-
7958
request: {
8059
method: 'POST',
8160
url: 'https://api.firecrawl.dev/v2/agent',
@@ -210,10 +189,6 @@ export const agentTool: ToolConfig<AgentParams, AgentResponse> = {
210189
type: 'object',
211190
description: 'Extracted data from the agent',
212191
},
213-
creditsUsed: {
214-
type: 'number',
215-
description: 'Number of credits consumed by this agent task',
216-
},
217192
expiresAt: {
218193
type: 'string',
219194
description: 'Timestamp when the results expire (24 hours)',

0 commit comments

Comments
 (0)