A desktop coding agent with free access to frontier models.
TypeScript
/** @jsxImportSource react */
import { useEffect, useState } from "react";
import { providerLogoCandidates } from "./provider-logo-src";
export type ProviderIconProps = {
providerId?: string | null;
/**
* Optional provider display name. When the id is an opaque cloud id
* (e.g. a uuid), the name is what tells us whether it's an Anthropic /
* OpenAI / OpenCode provider. Ported from dev 022b68a8 ("key cloud
* providers by cloud id") so the icon still resolves by family.
*/
providerName?: string | null;
/** Configured provider base URL, used as a favicon source for custom providers. */
baseUrl?: string | null;
className?: string;
size?: number;
};
export function ProviderIcon(props: ProviderIconProps) {
const size = props.size ?? 16;
const normalizedId = props.providerId?.trim().toLowerCase() ?? "";
const normalizedName = props.providerName?.trim().toLowerCase() ?? "";
const hasProviderFamily = (family: string) =>
normalizedId === family || normalizedName.includes(family);
const isAnthropic = hasProviderFamily("anthropic");
const isOpenAI = hasProviderFamily("openai");
const isOpenCode = hasProviderFamily("opencode");
const hasInlineMark = isAnthropic || isOpenAI || isOpenCode;
// Remote logos are walked in order and each failure advances one step, so a
// provider only falls back to its monogram once every source is exhausted.
const candidates = hasInlineMark
? []
: providerLogoCandidates({ providerId: props.providerId, baseUrl: props.baseUrl });
const [candidateIndex, setCandidateIndex] = useState(0);
useEffect(() => {
setCandidateIndex(0);
}, [normalizedId, props.baseUrl]);
const logoUrl = candidates[candidateIndex];
const fallbackLetters = (() => {
if (normalizedId === "z-ai") return "Z";
if (normalizedId === "openrouter") return "OR";
if (normalizedId === "deepseek") return "DS";
if (normalizedId === "google") return "GO";
if (normalizedId.length >= 2) return normalizedId.substring(0, 2).toUpperCase();
return "AI";
})();
return (
<div
className={`flex shrink-0 items-center justify-center rounded-md ${
props.className ?? ""
}`}
style={{ width: `${size}px`, height: `${size}px` }}
>
{isOpenAI ? (
<svg
role="img"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
width={size}
height={size}
>
<path d="M22.28 9.82a5.98 5.98 0 0 0-.52-4.91 6.05 6.05 0 0 0-6.51-2.9A6.07 6.07 0 0 0 4.98 4.18a5.98 5.98 0 0 0-4 2.9 6.05 6.05 0 0 0 .74 7.1 5.98 5.98 0 0 0 .51 4.91 6.05 6.05 0 0 0 6.51 2.9A5.98 5.98 0 0 0 13.26 24a6.06 6.06 0 0 0 5.77-4.21 5.99 5.99 0 0 0 4-2.9 6.06 6.06 0 0 0-.75-7.07zm-9.02 12.61a4.48 4.48 0 0 1-2.88-1.04l.14-.08 4.78-2.76a.79.79 0 0 0 .39-.68v-6.74l2.02 1.17a.07.07 0 0 1 .04.05v5.58a4.5 4.5 0 0 1-4.49 4.49zm-9.66-4.13a4.47 4.47 0 0 1-.53-3.01l.14.09 4.78 2.76a.77.77 0 0 0 .78 0l5.84-3.37v2.33a.08.08 0 0 1-.03.06l-4.84 2.79A4.5 4.5 0 0 1 3.6 18.3zM2.34 7.9a4.49 4.49 0 0 1 2.37-1.97v5.68a.77.77 0 0 0 .39.68l5.81 3.35-2.02 1.17a.08.08 0 0 1-.07 0l-4.83-2.79A4.5 4.5 0 0 1 2.34 7.87zm16.6 3.86-5.83-3.39 2.02-1.16a.08.08 0 0 1 .07 0l4.83 2.79a4.49 4.49 0 0 1-.68 8.1v-5.68a.79.79 0 0 0-.41-.67zm2.01-3.02-.14-.09-4.77-2.78a.78.78 0 0 0-.79 0L9.41 9.23V6.9a.07.07 0 0 1 .03-.06l4.83-2.79a4.5 4.5 0 0 1 6.68 4.66zM8.31 12.86l-2.02-1.16a.08.08 0 0 1-.04-.06V6.07a4.5 4.5 0 0 1 7.38-3.45l-.14.08-4.78 2.76a.79.79 0 0 0-.39.68zm1.1-2.37 2.6-1.5 2.61 1.5v3l-2.6 1.5-2.61-1.5Z" />
</svg>
) : isAnthropic ? (
<svg
role="img"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
width={size}
height={size}
>
<path d="M17.304 3.541h-3.672l6.696 16.918H24Zm-10.608 0L0 20.459h3.744l1.369-3.553h7.005l1.369 3.553h3.744L10.536 3.541Zm-.371 10.223 2.291-5.946 2.291 5.946Z" />
</svg>
) : isOpenCode ? (
<svg
role="img"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
fill="none"
stroke="currentColor"
strokeWidth={2}
strokeLinecap="round"
strokeLinejoin="round"
width={size}
height={size}
>
<path d="M12 2L2 7l10 5 10-5-10-5Z" />
<path d="M2 17l10 5 10-5" />
<path d="M2 12l10 5 10-5" />
</svg>
) : logoUrl ? (
<img
src={logoUrl}
alt=""
loading="lazy"
width={size}
height={size}
className="object-contain"
style={{ width: `${size}px`, height: `${size}px` }}
onError={() => setCandidateIndex((index) => index + 1)}
/>
) : (
<div
className="flex h-full w-full items-center justify-center rounded bg-gray-3 text-[10px] font-bold tracking-tight text-gray-11"
style={{ fontSize: `${Math.max(8, size * 0.45)}px` }}
>
{fallbackLetters}
</div>
)}
</div>
);
}