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
const OPENAI_SIZE_TO_ASPECT_RATIO: Record<string, string> = {
"256x256": "1:1",
"512x512": "1:1",
"1024x1024": "1:1",
"1792x1024": "16:9",
"1024x1792": "9:16",
"1536x1024": "3:2",
"1024x1536": "2:3",
};
// Supports direct aspect ratios (e.g. "16:9")
const ASPECT_RATIO_PASSTHROUGH = /^\d+:\d+$/;
export function mapImageSize(sizeParam?: string | null): string {
if (!sizeParam) return "1:1"; // default
// Native aspect ratio (e.g. "16:9") — pass-through
if (ASPECT_RATIO_PASSTHROUGH.test(sizeParam)) return sizeParam;
// Map OpenAI sizes to aspect ratios
return OPENAI_SIZE_TO_ASPECT_RATIO[sizeParam] ?? "1:1";
}