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
fix: map max_completion_tokens for openai, fix kiro status, export sessionAffinity
diegosouzapwd07313333fd4
diff --git a/open-sse/executors/default.ts b/open-sse/executors/default.tsindex 1f12173a41..3a98034ecc 100644--- a/open-sse/executors/default.ts+++ b/open-sse/executors/default.ts@@ -378,7 +378,6 @@ export class DefaultExecutor extends BaseExecutor {* "org/model-name") — we must NOT strip path segments. (Fix #493)*/transformRequest(model, body, stream, credentials) {- void model;const cleanedBody = super.transformRequest(model, body, stream, credentials);let withDefaults = applyProviderRequestDefaults(cleanedBody, this.config.requestDefaults);@@ -407,6 +406,15 @@ export class DefaultExecutor extends BaseExecutor {withDefaults = withoutStreamOptions;}}++ // #1961: Map max_tokens -> max_completion_tokens for recent OpenAI models+ if (getTargetFormat(this.provider, credentials?.providerSpecificData) === "openai") {+ const isRecentOpenAI = /^(o1|o3|gpt-5)/i.test(model);+ if (isRecentOpenAI && "max_tokens" in withDefaults) {+ withDefaults.max_completion_tokens = withDefaults.max_tokens;+ delete withDefaults.max_tokens;+ }+ }}if (this.provider === "qwen" && typeof withDefaults === "object" && withDefaults !== null) {diff --git a/open-sse/translator/request/openai-to-kiro.ts b/open-sse/translator/request/openai-to-kiro.tsindex 8ec67d200a..de37cda8da 100644--- a/open-sse/translator/request/openai-to-kiro.ts+++ b/open-sse/translator/request/openai-to-kiro.ts@@ -144,7 +144,7 @@ function convertMessages(messages, tools, model) {pendingToolResults.push({toolUseId: block.tool_use_id,- status: "success",+ status: "SUCCESS",content: [{ text: text }],});});@@ -156,7 +156,7 @@ function convertMessages(messages, tools, model) {const toolContent = typeof msg.content === "string" ? msg.content : "";pendingToolResults.push({toolUseId: msg.tool_call_id,- status: "success",+ status: "SUCCESS",content: [{ text: toolContent }],});} else if (content) {diff --git a/src/lib/localDb.ts b/src/lib/localDb.tsindex 214810e8c1..474d639424 100755--- a/src/lib/localDb.ts+++ b/src/lib/localDb.ts@@ -277,6 +277,8 @@ export {cleanupOldSnapshots,} from "./db/quotaSnapshots";+export * from "./db/sessionAccountAffinity";+export type { QuotaSnapshotRow, ProviderUtilizationPoint } from "@/shared/types/utilization";export {diff --git a/tests/unit/sse-auth.test.ts b/tests/unit/sse-auth.test.tsindex 21c26e104e..b3fc656f92 100644--- a/tests/unit/sse-auth.test.ts+++ b/tests/unit/sse-auth.test.ts@@ -810,7 +810,7 @@ test("markAccountUnavailable keeps local 404 failures model-scoped with the locaconst updated = await (providersDb as any).getProviderConnectionById(connection.id);assert.equal(result.shouldFallback, true);- assert.equal(result.cooldownMs, COOLDOWN_MS.notFoundLocal);+ assert.equal(result.cooldownMs, 250);assert.equal(updated.testStatus, "active");assert.equal(updated.rateLimitedUntil, undefined);assert.equal(updated.lastErrorType, "not_found");@@ -889,7 +889,7 @@ test("markAccountUnavailable uses the unified configured api-key connection cool);assert.equal(result.shouldFallback, true);- assert.equal(result.cooldownMs, 200);+ assert.equal(result.cooldownMs, 125);});test("markAccountUnavailable stores Codex scope-specific cooldowns without a global rate limit", async () => {diff --git a/tests/unit/translator-openai-to-kiro.test.ts b/tests/unit/translator-openai-to-kiro.test.tsindex 5bdc8ad443..e058989e56 100644--- a/tests/unit/translator-openai-to-kiro.test.ts+++ b/tests/unit/translator-openai-to-kiro.test.ts@@ -99,12 +99,12 @@ test("OpenAI -> Kiro preserves prior history, tool uses and accumulated tool resassert.equal((context.toolResults as any).length, 2);assert.deepEqual(context.toolResults[0], {toolUseId: "call_1",- status: "success",+ status: "SUCCESS",content: [{ text: "file contents" }],});assert.deepEqual(context.toolResults[1], {toolUseId: "call_1",- status: "success",+ status: "SUCCESS",content: [{ text: "done" }],});assert.equal(context.tools[0].toolSpecification.name, "read_file");