fix(proxy): apply account-level proxy to count_tokens and completions routes

This commit is contained in:
Hureru
2026-03-19 01:30:37 +08:00
parent 17afe3319e
commit 619df14291
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -839,7 +839,7 @@ async function handleClaudeCountTokensRequest(
method: 'POST',
headers: requestForFetch.headers,
body: JSON.stringify(requestForFetch.body),
}),
}, resolveChannelProxyUrl(selected.site, selected.account.extraConfig)),
});
if (upstream.status === 401 && oauth) {
@@ -859,7 +859,7 @@ async function handleClaudeCountTokensRequest(
method: 'POST',
headers: requestForFetch.headers,
body: JSON.stringify(requestForFetch.body),
}),
}, resolveChannelProxyUrl(selected.site, selected.account.extraConfig)),
});
} catch {
// Fall through to the regular upstream error handling below.
+1 -1
View File
@@ -71,7 +71,7 @@ export async function completionsProxyRoute(app: FastifyInstance) {
'Authorization': `Bearer ${selected.tokenValue}`,
},
body: JSON.stringify(forwardBody),
}));
}, getProxyUrlFromExtraConfig(selected.account.extraConfig)));
if (!upstream.ok) {
const errText = await upstream.text().catch(() => 'unknown error');