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
import { HTTP_STATUS } from "@omniroute/open-sse/config/constants.ts";
import { unavailableResponse } from "@omniroute/open-sse/utils/error.ts";
export type RateLimitedCredentials = {
allRateLimited: true;
retryAfter?: string | number | Date | null;
retryAfterHuman?: string;
};
export function isAllRateLimitedCredentials(value: unknown): value is RateLimitedCredentials {
return (
!!value &&
typeof value === "object" &&
(value as RateLimitedCredentials).allRateLimited === true
);
}
export function rateLimitedProviderResponse(
provider: string,
credentials: RateLimitedCredentials
): Response {
return unavailableResponse(
HTTP_STATUS.RATE_LIMITED,
`[${provider}] All accounts rate limited`,
credentials.retryAfter,
credentials.retryAfterHuman
);
}