Skip to content

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

603 B
Raw Blame
/**
 * Redact credentials from a subscription URL before it is returned to the
 * client (dashboard). The URL is stored intact in the DB so the server-side
 * fetch can still authenticate, but the operator UI must never receive
 * `user:pass@host`.
 */
export function redactSubscriptionUrl(url: string): string {
  if (!url) return url;
  try {
    const u = new URL(url);
    if (!u.username && !u.password) return url;
    u.username = "";
    u.password = "";
    return u.toString();
  } catch {
    // Not a parseable URL — return unchanged; the caller validates upstream.
    return url;
  }
}