From 04b062f3f8bf84f94c60c8dc27d540424904b9a5 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Thu, 3 Jul 2025 21:24:37 -0400 Subject: [PATCH] fix: strip v1 from tokenize endpoint since it uses base URL not v1 API --- src/token_estimator.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/token_estimator.js b/src/token_estimator.js index 481913c..60ced5b 100644 --- a/src/token_estimator.js +++ b/src/token_estimator.js @@ -307,7 +307,7 @@ export async function countTokensWithUpstream(text, model) { const { getSelectedModel, getSelectedModelEndpoint } = await import("./models.js"); try { - const endpoint = getSelectedModelEndpoint(); + const endpoint = getSelectedModelEndpoint().replace('/v1', ''); console.log(`Trying tokenization at: ${endpoint}/tokenize`); const response = await fetch(`${endpoint}/tokenize`, { @@ -359,7 +359,7 @@ export async function getTokenCount(text, model) { const { getSelectedModel, getSelectedModelEndpoint } = await import("./models.js"); try { - const endpoint = getSelectedModelEndpoint(); + const endpoint = getSelectedModelEndpoint().replace('/v1', ''); console.log(`Trying tokenization at: ${endpoint}/tokenize`); const response = await fetch(`${endpoint}/tokenize`, {