Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(settings): correct provider auth section to use correct API endpoint

Steven Enamakel7910dfa97fbb
diff --git a/app/src/components/settings/panels/ai/ProviderAuthSection.tsx b/app/src/components/settings/panels/ai/ProviderAuthSection.tsx
index defc137506..b16a1888c8 100644
--- a/app/src/components/settings/panels/ai/ProviderAuthSection.tsx
+++ b/app/src/components/settings/panels/ai/ProviderAuthSection.tsx
@@ -9,6 +9,7 @@ import { useT } from '../../../../lib/i18n/I18nContext';
import type { ProviderAuthError } from '../../../../services/api/aiSettingsApi';
import Alert from '../../../ui/Alert';
import Button from '../../../ui/Button';
+import Card from '../../../ui/Card';
import StatusLine from '../../../ui/StatusLine';
import Switch from '../../../ui/Switch';
import { routingWithProviderRemoved } from '../aiRouting';
@@ -24,7 +25,6 @@ import {
providerToggleAriaLabel,
} from './aiPanelTypes';
import { ClaudeCodeConnect } from './ClaudeCodeStatusCard';
-import { PanelSection } from './PanelSection';
import { ProviderToggleChip } from './ProviderConnectControls';
import type { ConnectCredentialMode } from './useProviderConnect';
@@ -69,218 +69,222 @@ export const ProviderAuthSection = ({
}) => {
const { t } = useT();
return (
- <PanelSection
- title={t('settings.ai.llmProviders')}
- description={t('settings.ai.llmProvidersDesc')}>
- {/* ─── Rejected-key notices ─────────────────────────────────────────
+ <Card title={t('settings.ai.llmProviders')} description={t('settings.ai.llmProvidersDesc')}>
+ <div className="flex w-full flex-col gap-4 p-4">
+ {/* ─── Rejected-key notices ─────────────────────────────────────────
A BYO key the provider rejected at runtime (401/403). Surfaced
here, next to the key editor, because the failing path is often a
silent background loop and the raw error is demoted from Sentry. */}
- {providerAuthErrors.length > 0 && (
- <div className="flex w-full flex-col gap-2">
- {providerAuthErrors.map(err => (
- <ProviderSetupErrorNotice key={err.provider} error={err.message} />
- ))}
- </div>
- )}
+ {providerAuthErrors.length > 0 && (
+ <div className="flex w-full flex-col gap-2">
+ {providerAuthErrors.map(err => (
+ <ProviderSetupErrorNotice key={err.provider} error={err.message} />
+ ))}
+ </div>
+ )}
- {/* #5339: non-fatal "key saved, but provider unreachable" advisory.
+ {/* #5339: non-fatal "key saved, but provider unreachable" advisory.
Amber (not coral): the save succeeded, only reachability is in
question. */}
- {providerSaveNotice && (
- <Alert variant="warning" role="status" className="items-start gap-2 px-3 py-2 text-xs">
- <LuCircleAlert className="mt-0.5 h-3.5 w-3.5 flex-shrink-0" />
- <span className="flex-1">{providerSaveNotice.message}</span>
- <Button
- type="button"
- variant="tertiary"
- size="xs"
- className="shrink-0 font-medium normal-case underline-offset-2 hover:underline"
- onClick={onDismissProviderSaveNotice}>
- {t('common.dismiss')}
- </Button>
- </Alert>
- )}
-
- {/* ─── Provider chip-toggle list ────────────────────────────────── */}
- <div className="flex w-full flex-col gap-3">
- {loading && <div className="text-xs text-content-muted">{t('common.loading')}</div>}
- {error && <StatusLine saving={false} error={error} savedNote={null} savingLabel="" />}
-
- <div className="flex flex-wrap gap-1.5">
- <ProviderToggleChip
- key="openhuman"
- slug="openhuman"
- label={t('settings.ai.routing.managed')}
- enabled
- alwaysOn
- />
+ {providerSaveNotice && (
+ <Alert variant="warning" role="status" className="items-start gap-2 px-3 py-2 text-xs">
+ <LuCircleAlert className="mt-0.5 h-3.5 w-3.5 flex-shrink-0" />
+ <span className="flex-1">{providerSaveNotice.message}</span>
+ <Button
+ type="button"
+ variant="tertiary"
+ size="xs"
+ className="shrink-0 font-medium normal-case underline-offset-2 hover:underline"
+ onClick={onDismissProviderSaveNotice}>
+ {t('common.dismiss')}
+ </Button>
+ </Alert>
+ )}
- {/* Built-in cloud providers */}
- {BUILTIN_CLOUD_PROVIDER_SLUGS.map(slug => {
- const meta = BUILTIN_PROVIDER_META[slug];
- const label = meta?.label ?? slug;
- const existing = draft.cloudProviders.find(cp => cp.slug === slug);
- const enabled = !!existing;
- return (
- <ProviderToggleChip
- key={slug}
- slug={slug}
- label={label}
- enabled={enabled}
- busy={busyAction === `toggle-${slug}`}
- onToggle={async () => {
- if (enabled && existing) {
- // Toggle OFF: remove the provider + scrub any routing
- // entries that pin to it. Drop its advisory too (#5341).
- onProviderRemoved(existing.slug);
- const remaining = draft.cloudProviders.filter(cp => cp.id !== existing.id);
- const nextRouting = routingWithProviderRemoved(
- draft.routing,
- { slug: existing.slug, isLocalRuntime: false },
- remaining
- );
- await persist({ ...draft, cloudProviders: remaining, routing: nextRouting });
- } else {
- // Toggle ON: open the API-key popup. The chip only flips
- // after the dialog saves.
- onOpenKeyDialog(slug, null);
- }
- }}
- />
- );
- })}
+ {/* ─── Provider chip-toggle list ────────────────────────────────── */}
+ <div className="flex w-full flex-col gap-3">
+ {loading && <div className="text-xs text-content-muted">{t('common.loading')}</div>}
+ {error && <StatusLine saving={false} error={error} savedNote={null} savingLabel="" />}
- {draft.cloudProviders
- .filter(cp => !BUILTIN_RESERVED_SLUGS.includes(cp.slug))
- .map(existing => (
- <ProviderToggleChip
- key={existing.id}
- slug="custom"
- label={existing.label}
- enabled
- busy={busyAction === `toggle-${existing.slug}`}
- onToggle={async () => {
- onProviderRemoved(existing.slug);
- const remaining = draft.cloudProviders.filter(cp => cp.id !== existing.id);
- const nextRouting = routingWithProviderRemoved(
- draft.routing,
- { slug: existing.slug, isLocalRuntime: false },
- remaining
- );
- await persist({ ...draft, cloudProviders: remaining, routing: nextRouting });
- }}
- />
- ))}
+ <div className="flex flex-wrap gap-1.5">
+ <ProviderToggleChip
+ key="openhuman"
+ slug="openhuman"
+ label={t('settings.ai.routing.managed')}
+ enabled
+ alwaysOn
+ />
- {/* LM Studio + Ollama — local runtimes stored with a slug of
- "lmstudio" / "ollama" so they're distinct from generic custom. */}
- {(['lmstudio', 'ollama', 'omlx'] as const).map(localKind => {
- const label = LOCAL_CHIP_LABEL[localKind as LocalChipSlug];
- const tone = LOCAL_CHIP_TONE[localKind as LocalChipSlug];
- const existing = draft.cloudProviders.find(cp => cp.slug === localKind);
- const enabled = !!existing;
- return (
- <div
- key={localKind}
- className={`inline-flex items-center gap-2 rounded-full px-2.5 py-1 text-xs font-medium ring-1 transition-colors ${tone}`}>
- <span>{label}</span>
- {enabled && (
- <Button
- type="button"
- iconOnly
- variant="tertiary"
- size="xs"
- aria-label={t('settings.ai.editEndpoint')}
- title={t('settings.ai.editEndpoint')}
- onClick={() => onOpenKeyDialog(localKind, label)}>
- <LuPencil className="h-3 w-3" />
- </Button>
- )}
- <Switch
- id={`local-runtime-toggle-${localKind}`}
- checked={enabled}
- onCheckedChange={async () => {
+ {/* Built-in cloud providers */}
+ {BUILTIN_CLOUD_PROVIDER_SLUGS.map(slug => {
+ const meta = BUILTIN_PROVIDER_META[slug];
+ const label = meta?.label ?? slug;
+ const existing = draft.cloudProviders.find(cp => cp.slug === slug);
+ const enabled = !!existing;
+ return (
+ <ProviderToggleChip
+ key={slug}
+ slug={slug}
+ label={label}
+ enabled={enabled}
+ busy={busyAction === `toggle-${slug}`}
+ onToggle={async () => {
if (enabled && existing) {
+ // Toggle OFF: remove the provider + scrub any routing
+ // entries that pin to it. Drop its advisory too (#5341).
+ onProviderRemoved(existing.slug);
const remaining = draft.cloudProviders.filter(cp => cp.id !== existing.id);
const nextRouting = routingWithProviderRemoved(
draft.routing,
- { slug: localKind, isLocalRuntime: true },
+ { slug: existing.slug, isLocalRuntime: false },
remaining
);
await persist({ ...draft, cloudProviders: remaining, routing: nextRouting });
} else {
- onOpenKeyDialog(localKind, label);
+ // Toggle ON: open the API-key popup. The chip only flips
+ // after the dialog saves.
+ onOpenKeyDialog(slug, null);
}
}}
- disabled={busyAction === `toggle-${localKind}`}
- aria-label={providerToggleAriaLabel(t, enabled, label)}
/>
- </div>
- );
- })}
- </div>
+ );
+ })}
+
+ {draft.cloudProviders
+ .filter(cp => !BUILTIN_RESERVED_SLUGS.includes(cp.slug))
+ .map(existing => (
+ <ProviderToggleChip
+ key={existing.id}
+ slug="custom"
+ label={existing.label}
+ enabled
+ busy={busyAction === `toggle-${existing.slug}`}
+ onToggle={async () => {
+ onProviderRemoved(existing.slug);
+ const remaining = draft.cloudProviders.filter(cp => cp.id !== existing.id);
+ const nextRouting = routingWithProviderRemoved(
+ draft.routing,
+ { slug: existing.slug, isLocalRuntime: false },
+ remaining
+ );
+ await persist({ ...draft, cloudProviders: remaining, routing: nextRouting });
+ }}
+ />
+ ))}
+
+ {/* LM Studio + Ollama — local runtimes stored with a slug of
+ "lmstudio" / "ollama" so they're distinct from generic custom. */}
+ {(['lmstudio', 'ollama', 'omlx'] as const).map(localKind => {
+ const label = LOCAL_CHIP_LABEL[localKind as LocalChipSlug];
+ const tone = LOCAL_CHIP_TONE[localKind as LocalChipSlug];
+ const existing = draft.cloudProviders.find(cp => cp.slug === localKind);
+ const enabled = !!existing;
+ return (
+ <div
+ key={localKind}
+ className={`inline-flex items-center gap-2 rounded-full px-2.5 py-1 text-xs font-medium ring-1 transition-colors ${tone}`}>
+ <span>{label}</span>
+ {enabled && (
+ <Button
+ type="button"
+ iconOnly
+ variant="tertiary"
+ size="xs"
+ aria-label={t('settings.ai.editEndpoint')}
+ title={t('settings.ai.editEndpoint')}
+ onClick={() => onOpenKeyDialog(localKind, label)}>
+ <LuPencil className="h-3 w-3" />
+ </Button>
+ )}
+ <Switch
+ id={`local-runtime-toggle-${localKind}`}
+ checked={enabled}
+ onCheckedChange={async () => {
+ if (enabled && existing) {
+ const remaining = draft.cloudProviders.filter(cp => cp.id !== existing.id);
+ const nextRouting = routingWithProviderRemoved(
+ draft.routing,
+ { slug: localKind, isLocalRuntime: true },
+ remaining
+ );
+ await persist({
+ ...draft,
+ cloudProviders: remaining,
+ routing: nextRouting,
+ });
+ } else {
+ onOpenKeyDialog(localKind, label);
+ }
+ }}
+ disabled={busyAction === `toggle-${localKind}`}
+ aria-label={providerToggleAriaLabel(t, enabled, label)}
+ />
+ </div>
+ );
+ })}
+ </div>
- {/* #3760: Managed is always-on and can't be turned off; point users
+ {/* #3760: Managed is always-on and can't be turned off; point users
who want a local model at the Routing card below instead of
letting them fight the (now badge, formerly locked) Managed chip. */}
- <p className="text-xs text-content-muted">{t('settings.ai.routing.managedHint')}</p>
+ <p className="text-xs text-content-muted">{t('settings.ai.routing.managedHint')}</p>
- <div className="flex flex-col gap-2 pt-1">
- {/* Codex — imports the existing Codex CLI login as an OpenAI credential. */}
- <div className="flex flex-wrap items-center gap-2">
- <Button
- type="button"
- variant="secondary"
- size="xs"
- leadingIcon={<LuKeyRound className="h-3.5 w-3.5" />}
- onClick={onConnectCodex}
- disabled={busyAction === 'codex-auth' || busyAction === 'toggle-openai'}>
- {busyAction === 'codex-auth' || busyAction === 'toggle-openai'
- ? t('settings.ai.connecting')
- : t('settings.ai.codexAuthButton', 'Connect Codex')}
- </Button>
- <span className="text-xs text-content-muted">
- {t(
- 'settings.ai.codexAuthHelper',
- 'Uses the existing Codex CLI login from ~/.codex/auth.json.'
- )}
- </span>
- </div>
- {codexAuthError ? <ProviderSetupErrorNotice error={codexAuthError} /> : null}
+ <div className="flex flex-col gap-2 pt-1">
+ {/* Codex — imports the existing Codex CLI login as an OpenAI credential. */}
+ <div className="flex flex-wrap items-center gap-2">
+ <Button
+ type="button"
+ variant="secondary"
+ size="xs"
+ leadingIcon={<LuKeyRound className="h-3.5 w-3.5" />}
+ onClick={onConnectCodex}
+ disabled={busyAction === 'codex-auth' || busyAction === 'toggle-openai'}>
+ {busyAction === 'codex-auth' || busyAction === 'toggle-openai'
+ ? t('settings.ai.connecting')
+ : t('settings.ai.codexAuthButton', 'Connect Codex')}
+ </Button>
+ <span className="text-xs text-content-muted">
+ {t(
+ 'settings.ai.codexAuthHelper',
+ 'Uses the existing Codex CLI login from ~/.codex/auth.json.'
+ )}
+ </span>
+ </div>
+ {codexAuthError ? <ProviderSetupErrorNotice error={codexAuthError} /> : null}
- {/* Claude Code CLI — connect control (peer of Codex). */}
- <ClaudeCodeConnect
- connected={draft.cloudProviders.some(cp => cp.slug === 'claude-code')}
- busy={busyAction === 'toggle-claude-code'}
- onConnect={() =>
- onConnectProvider({
- slug: 'claude-code',
- value: 'cli_login',
- credentialMode: 'cli_login',
- })
- }
- onDisconnect={async () => {
- const existing = draft.cloudProviders.find(cp => cp.slug === 'claude-code');
- if (!existing) return;
- const remaining = draft.cloudProviders.filter(cp => cp.id !== existing.id);
- const nextRouting = routingWithProviderRemoved(
- draft.routing,
- { slug: existing.slug, isLocalRuntime: false },
- remaining
- );
- await persist({ ...draft, cloudProviders: remaining, routing: nextRouting });
- }}
- />
- </div>
+ {/* Claude Code CLI — connect control (peer of Codex). */}
+ <ClaudeCodeConnect
+ connected={draft.cloudProviders.some(cp => cp.slug === 'claude-code')}
+ busy={busyAction === 'toggle-claude-code'}
+ onConnect={() =>
+ onConnectProvider({
+ slug: 'claude-code',
+ value: 'cli_login',
+ credentialMode: 'cli_login',
+ })
+ }
+ onDisconnect={async () => {
+ const existing = draft.cloudProviders.find(cp => cp.slug === 'claude-code');
+ if (!existing) return;
+ const remaining = draft.cloudProviders.filter(cp => cp.id !== existing.id);
+ const nextRouting = routingWithProviderRemoved(
+ draft.routing,
+ { slug: existing.slug, isLocalRuntime: false },
+ remaining
+ );
+ await persist({ ...draft, cloudProviders: remaining, routing: nextRouting });
+ }}
+ />
+ </div>
- <div className="flex pt-1">
- <Button type="button" variant="primary" size="xs" onClick={onAddCustomProvider}>
- {t('settings.ai.routing.addCustomProvider')}
- </Button>
+ <div className="flex pt-1">
+ <Button type="button" variant="primary" size="xs" onClick={onAddCustomProvider}>
+ {t('settings.ai.routing.addCustomProvider')}
+ </Button>
+ </div>
</div>
</div>
- </PanelSection>
+ </Card>
);
};