Treat DuckDuckGo web as no-auth provider

Mark duckduckgo-web in WEB_COOKIE_PROVIDERS with noAuth and include it in providerAllowsOptionalApiKey. Update getProviderCredentials to check both NOAUTH_PROVIDERS and WEB_COOKIE_PROVIDERS for noAuth providers (returning synthetic credentials) and import WEB_COOKIE_PROVIDERS accordingly. This enables anonymous/anonymous-cookie web providers to be handled without DB lookups.
This commit is contained in:
Muhammad Tamir
2026-05-31 22:10:56 +07:00
committed by diegosouzapw
parent 029e4f6943
commit 2ec803bbad
2 changed files with 8 additions and 3 deletions

View File

@@ -427,6 +427,7 @@ export const WEB_COOKIE_PROVIDERS = {
textIcon: "DDG",
website: "https://duckduckgo.com/duckchat",
hasFree: true,
noAuth: true,
freeNote: "Free — anonymous access to multiple AI models via DuckDuckGo.",
authHint: "No credentials required — DuckDuckGo AI Chat is anonymous and free.",
},
@@ -2892,6 +2893,7 @@ export function providerAllowsOptionalApiKey(providerId: unknown): boolean {
providerId === "petals" ||
providerId === "pollinations" ||
providerId === "copilot-web" ||
providerId === "duckduckgo-web" ||
providerId === "veoaifree-web" ||
providerId === "hackclub" ||
providerId === "huggingchat" ||

View File

@@ -47,6 +47,7 @@ import {
getProviderAlias,
resolveProviderId,
NOAUTH_PROVIDERS,
WEB_COOKIE_PROVIDERS,
} from "@/shared/constants/providers";
import { isModelExcludedByConnection } from "@/domain/connectionModelRules";
import * as log from "../utils/logger";
@@ -825,9 +826,11 @@ export async function getProviderCredentials(
// No-auth providers (e.g. opencode) need no DB connection — return synthetic credentials
// so the executor receives a valid credentials object without auth headers being added.
const resolvedId = resolveProviderId(provider);
if (
(NOAUTH_PROVIDERS as Record<string, { noAuth?: boolean } | undefined>)[resolvedId]?.noAuth
) {
const providerMaps: Record<string, { noAuth?: boolean } | undefined>[] = [
NOAUTH_PROVIDERS as Record<string, { noAuth?: boolean } | undefined>,
WEB_COOKIE_PROVIDERS as Record<string, { noAuth?: boolean } | undefined>,
];
if (providerMaps.some((map) => map[resolvedId]?.noAuth)) {
return {
apiKey: null,
accessToken: null,