From 22f1aee70b2dd7600b20cd6de67693a9379df7f4 Mon Sep 17 00:00:00 2001
From: Cohee <18619528+Cohee1207@users.noreply.github.com>
Date: Sun, 13 Apr 2025 14:15:49 +0300
Subject: [PATCH] Add web search fee notice for OpenRouter Closes #3833
---
public/index.html | 3 +++
public/scripts/openai.js | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/public/index.html b/public/index.html
index c0bb0dffa..abaf6b6c5 100644
--- a/public/index.html
+++ b/public/index.html
@@ -1963,6 +1963,9 @@
Use search capabilities provided by the backend.
+
+ Not free, adds a $0.02 fee to each prompt.
+
diff --git a/public/scripts/openai.js b/public/scripts/openai.js
index 62c0bde9c..96afac719 100644
--- a/public/scripts/openai.js
+++ b/public/scripts/openai.js
@@ -1693,6 +1693,11 @@ function calculateOpenRouterCost() {
}
}
+ if (oai_settings.enable_web_search) {
+ const webSearchCost = (0.02).toFixed(2);
+ cost = t`${cost} + $${webSearchCost}`;
+ }
+
$('#openrouter_max_prompt_cost').text(cost);
}
@@ -5700,6 +5705,7 @@ export function initOpenAI() {
$('#openai_enable_web_search').on('input', function () {
oai_settings.enable_web_search = !!$(this).prop('checked');
+ calculateOpenRouterCost();
saveSettingsDebounced();
});