Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
"use client";
import { useTranslations } from "next-intl";
export type SourceId = "1proxy" | "proxifly" | "iplocate" | "webshare";
export const ALL_SOURCE_IDS: SourceId[] = ["1proxy", "proxifly", "iplocate", "webshare"];
export const FREE_POOL_DISABLED_SOURCES_KEY = "freePool.disabledSources";
export function loadDisabledSources(): Set<SourceId> {
try {
const raw = globalThis.localStorage?.getItem(FREE_POOL_DISABLED_SOURCES_KEY);
if (!raw) return new Set();
const arr = JSON.parse(raw) as unknown[];
return new Set(arr.filter((id): id is SourceId => ALL_SOURCE_IDS.includes(id as SourceId)));
} catch {
return new Set();
}
}
export function saveDisabledSources(disabled: Set<SourceId>): void {
try {
globalThis.localStorage?.setItem(FREE_POOL_DISABLED_SOURCES_KEY, JSON.stringify([...disabled]));
} catch {}
}
interface SourceToggleBarProps {
disabledSources: Set<SourceId>;
onToggle: (source: SourceId) => void;
}
const SOURCES: Array<{ id: SourceId; label: string }> = [
{ id: "1proxy", label: "1proxy" },
{ id: "proxifly", label: "Proxifly" },
{ id: "iplocate", label: "IPLocate" },
{ id: "webshare", label: "Webshare" },
];
export default function SourceToggleBar({ disabledSources, onToggle }: SourceToggleBarProps) {
const t = useTranslations("settings");
return (
<div className="flex flex-wrap gap-2" role="group" aria-label={t("proxyToggleSources")}>
{SOURCES.map((s) => {
const enabled = !disabledSources.has(s.id);
return (
<button
key={s.id}
className={`flex items-center gap-1.5 px-3 py-1 rounded text-xs font-medium border transition-colors ${
enabled
? "bg-primary/20 border-primary text-primary"
: "border-border text-text-muted hover:border-primary/50"
}`}
onClick={() => onToggle(s.id)}
aria-pressed={enabled}
>
<span
className={`w-1.5 h-1.5 rounded-full ${enabled ? "bg-primary" : "bg-text-muted"}`}
/>
{s.label}
</button>
);
})}
</div>
);
}