Revert "fix: provide capability for both SDK auth modes"

This reverts commit ebf870249f.
This commit is contained in:
2026-07-11 15:06:48 +08:00
parent 12a2f3117f
commit 1f48c5b707
5 changed files with 7 additions and 28 deletions
+2 -17
View File
@@ -41,11 +41,6 @@ export interface ProviderProxyDiagnostic {
| "provider_proxy_redirect_refused"
| "provider_proxy_upstream_failed";
readonly category: NetworkFailureCategory | "authorization" | "request_limit" | "redirect";
readonly authShape?: {
readonly bearerLength: number;
readonly apiKeyLength: number;
readonly expectedLength: number;
};
}
export interface ProviderProxyOptions {
@@ -85,7 +80,7 @@ export async function openProviderProxyLease(
return {
sdkEnv: {
ANTHROPIC_BASE_URL: `http://127.0.0.1:${address.port}`,
ANTHROPIC_AUTH_TOKEN: capability,
ANTHROPIC_AUTH_TOKEN: "",
ANTHROPIC_API_KEY: capability,
},
sensitiveValues: [capability],
@@ -108,17 +103,7 @@ async function forwardProviderRequest(
options: ProviderProxyOptions,
): Promise<void> {
if (!authorized(request.headers.authorization, header(request.headers["x-api-key"]), capability)) {
options.onDiagnostic?.({
code: "provider_proxy_unauthorized",
category: "authorization",
authShape: {
bearerLength: request.headers.authorization?.startsWith("Bearer ")
? request.headers.authorization.length - "Bearer ".length
: 0,
apiKeyLength: header(request.headers["x-api-key"])?.length ?? 0,
expectedLength: capability.length,
},
});
options.onDiagnostic?.({ code: "provider_proxy_unauthorized", category: "authorization" });
response.writeHead(401, { "content-type": "text/plain; charset=utf-8" });
response.end("unauthorized");
return;