diff --git a/apps/sim/tools/exa/answer.ts b/apps/sim/tools/exa/answer.ts index f6d395751..6811b1718 100644 --- a/apps/sim/tools/exa/answer.ts +++ b/apps/sim/tools/exa/answer.ts @@ -1,6 +1,9 @@ +import { createLogger } from '@sim/logger' import type { ExaAnswerParams, ExaAnswerResponse } from '@/tools/exa/types' import type { ToolConfig } from '@/tools/types' +const logger = createLogger('ExaAnswerTool') + export const answerTool: ToolConfig = { id: 'exa_answer', name: 'Exa Answer', @@ -39,6 +42,7 @@ export const answerTool: ToolConfig = { return { cost: response.costDollars.total, metadata: { costDollars: response.costDollars } } } // Fallback: $5/1000 requests + logger.warn('Exa answer response missing costDollars, using fallback pricing') return 0.005 }, }, diff --git a/apps/sim/tools/exa/find_similar_links.ts b/apps/sim/tools/exa/find_similar_links.ts index ad117aed8..f9df0ac12 100644 --- a/apps/sim/tools/exa/find_similar_links.ts +++ b/apps/sim/tools/exa/find_similar_links.ts @@ -1,6 +1,9 @@ +import { createLogger } from '@sim/logger' import type { ExaFindSimilarLinksParams, ExaFindSimilarLinksResponse } from '@/tools/exa/types' import type { ToolConfig } from '@/tools/types' +const logger = createLogger('ExaFindSimilarLinksTool') + export const findSimilarLinksTool: ToolConfig< ExaFindSimilarLinksParams, ExaFindSimilarLinksResponse @@ -88,6 +91,7 @@ export const findSimilarLinksTool: ToolConfig< return { cost: response.costDollars.total, metadata: { costDollars: response.costDollars } } } // Fallback: $5/1000 (1-25 results) or $25/1000 (26-100 results) + logger.warn('Exa find_similar_links response missing costDollars, using fallback pricing') const resultCount = response.similarLinks?.length || 0 return resultCount <= 25 ? 0.005 : 0.025 }, diff --git a/apps/sim/tools/exa/get_contents.ts b/apps/sim/tools/exa/get_contents.ts index 1539f1042..ac98cb802 100644 --- a/apps/sim/tools/exa/get_contents.ts +++ b/apps/sim/tools/exa/get_contents.ts @@ -1,6 +1,9 @@ +import { createLogger } from '@sim/logger' import type { ExaGetContentsParams, ExaGetContentsResponse } from '@/tools/exa/types' import type { ToolConfig } from '@/tools/types' +const logger = createLogger('ExaGetContentsTool') + export const getContentsTool: ToolConfig = { id: 'exa_get_contents', name: 'Exa Get Contents', @@ -73,6 +76,7 @@ export const getContentsTool: ToolConfig = } // Fallback to estimate if cost not available + logger.warn('Exa research response missing costDollars, using fallback pricing') const model = params.model || 'exa-research' return model === 'exa-research-pro' ? 0.055 : 0.03 }, diff --git a/apps/sim/tools/exa/search.ts b/apps/sim/tools/exa/search.ts index 4457ce280..debf244cc 100644 --- a/apps/sim/tools/exa/search.ts +++ b/apps/sim/tools/exa/search.ts @@ -1,6 +1,9 @@ +import { createLogger } from '@sim/logger' import type { ExaSearchParams, ExaSearchResponse } from '@/tools/exa/types' import type { ToolConfig } from '@/tools/types' +const logger = createLogger('ExaSearchTool') + export const searchTool: ToolConfig = { id: 'exa_search', name: 'Exa Search', @@ -99,6 +102,7 @@ export const searchTool: ToolConfig = { } // Fallback: estimate based on search type and result count + logger.warn('Exa search response missing costDollars, using fallback pricing') const isDeepSearch = params.type === 'neural' if (isDeepSearch) { return 0.015