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
refactor: address PR review feedback
ivan_yakimkinf09c2d6b8793
diff --git a/open-sse/executors/antigravity.ts b/open-sse/executors/antigravity.tsindex 1193916a05..42e5cb835f 100644--- a/open-sse/executors/antigravity.ts+++ b/open-sse/executors/antigravity.ts@@ -41,6 +41,15 @@ const CREDITS_EXHAUSTED_TTL_MS = 5 * 60 * 60 * 1000; // 5 hoursconst BARE_PRO_IDS = new Set(["gemini-3.1-pro"]);+function getChunkedOrFixedBody(bodyStr: string, stream: boolean) {+ if (stream) {+ return (async function* () {+ yield new TextEncoder().encode(bodyStr);+ })();+ }+ return bodyStr;+}+function cloneAntigravityRequestBody(body: unknown): unknown {if (!body || typeof body !== "object") {return body;@@ -757,19 +766,10 @@ export class AntigravityExecutor extends BaseExecutor {);}- const getChunkedOrFixedBody = (bodyStr: string) => {- if (stream) {- return (async function* () {- yield new TextEncoder().encode(bodyStr);- })();- }- return bodyStr;- };-let response = await fetch(url, {method: "POST",headers: finalHeaders,- body: getChunkedOrFixedBody(serializedRequest.bodyString),+ body: getChunkedOrFixedBody(serializedRequest.bodyString, stream),...(stream ? { duplex: "half" } : {}),signal,});@@ -781,7 +781,7 @@ export class AntigravityExecutor extends BaseExecutor {response = await fetch(url, {method: "POST",headers: retryHeaders,- body: getChunkedOrFixedBody(serializedRequest.bodyString),+ body: getChunkedOrFixedBody(serializedRequest.bodyString, stream),...(stream ? { duplex: "half" } : {}),signal,});@@ -851,7 +851,7 @@ export class AntigravityExecutor extends BaseExecutor {const creditsResp = await fetch(url, {method: "POST",headers: finalCreditsHeaders,- body: getChunkedOrFixedBody(serializedCreditsRequest.bodyString),+ body: getChunkedOrFixedBody(serializedCreditsRequest.bodyString, stream),...(stream ? { duplex: "half" } : {}),signal,});diff --git a/open-sse/services/antigravityIdentity.ts b/open-sse/services/antigravityIdentity.tsindex e3992eb250..98764c8ea2 100644--- a/open-sse/services/antigravityIdentity.ts+++ b/open-sse/services/antigravityIdentity.ts@@ -1,4 +1,5 @@import crypto from "node:crypto";+import os from "node:os";type AntigravityCredentialsLike = {accessToken?: string | null;@@ -66,8 +67,8 @@ export function deriveAntigravitySessionId(accountKey?: string | null): string |let hash = FNV_OFFSET_I64;for (const byte of Buffer.from(key, "utf8")) {- hash = BigInt.asIntN(64, hash * FNV_PRIME_I64);hash = BigInt.asIntN(64, hash ^ BigInt(byte));+ hash = BigInt.asIntN(64, hash * FNV_PRIME_I64);}return hash.toString();}@@ -83,8 +84,6 @@ export function getAntigravitySessionId();}-import os from "node:os";-const STABLE_MACHINE_ID = crypto.createHash("sha256").update(`omniroute:machine_id:${os.hostname()}`)diff --git a/open-sse/translator/request/openai-to-gemini.ts b/open-sse/translator/request/openai-to-gemini.tsindex 58d0cbdb51..9f1d6aa3a8 100644--- a/open-sse/translator/request/openai-to-gemini.ts+++ b/open-sse/translator/request/openai-to-gemini.ts@@ -597,7 +597,12 @@ export function openaiToAntigravityRequest(model, body, stream, credentials = nu// hasn't explicitly specified max_tokens / max_completion_tokens.// The Cloud Code server decides the output limit on its own.const clientRequestedMaxTokens = body.max_tokens ?? body.max_completion_tokens;- if (clientRequestedMaxTokens === undefined && envelope.request?.generationConfig) {+ const hasThinking = !!envelope.request?.generationConfig?.thinkingConfig?.thinkingBudget;+ if (+ clientRequestedMaxTokens === undefined &&+ !hasThinking &&+ envelope.request?.generationConfig+ ) {delete envelope.request.generationConfig.maxOutputTokens;}