Skip to content

Commit af9d64a

Browse files
author
Theodore Li
committed
fail fast
1 parent 2280b47 commit af9d64a

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

apps/sim/providers/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,7 @@ export function getApiKey(provider: string, model: string, userProvidedKey?: str
736736
return userProvidedKey || 'empty'
737737
}
738738

739+
// Bedrock uses its own credentials (bedrockAccessKeyId/bedrockSecretKey), not apiKey
739740
const isBedrockModel = provider === 'bedrock' || model.startsWith('bedrock/')
740741
if (isBedrockModel) {
741742
return 'bedrock-uses-own-credentials'

apps/sim/tools/jina/read_url.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ export const readUrlTool: ToolConfig<ReadUrlParams, ReadUrlResponse> = {
171171
getCost: (_params, output) => {
172172
// Jina bills per output token — $0.20 per 1M tokens
173173
// Source: https://cloud.jina.ai/pricing (token-based billing)
174-
// x-tokens header is unreliable; falls back to content-length estimate (~4 chars/token)
175174
const tokens = output.tokensUsed as number
176175
const cost = tokens * 0.0000002
177176
return { cost, metadata: { tokensUsed: tokens } }

apps/sim/tools/tts/elevenlabs.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ export const elevenLabsTtsUnifiedTool: ToolConfig<ElevenLabsTtsUnifiedParams, Tt
2121
throw new Error('Missing text parameter, cannot determine character cost')
2222
}
2323
const characterCount = text.length
24-
const modelId = (params.modelId as string) || 'eleven_turbo_v2_5'
24+
const modelId = params.modelId as string | undefined
25+
if (!modelId) {
26+
throw new Error('Missing modelId parameter, cannot determine pricing tier')
27+
}
2528
// Flash/Turbo: $0.08/1K chars, Standard/Multilingual/v3: $0.18/1K chars
2629
// Scale tier additional character rates — https://elevenlabs.io/pricing/api
2730
const costPer1KChars = FLASH_TURBO_MODELS.has(modelId) ? 0.08 : 0.18

apps/sim/tools/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export type BYOKProviderId =
1010
| 'browser_use'
1111
| 'serper'
1212
| 'firecrawl'
13+
| 'jina'
1314

1415
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD'
1516

0 commit comments

Comments
 (0)