forked from boos/BoosAPI
fix(proxy): apply account-level proxy to count_tokens and completions routes
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user