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

fix(codex): translate messages to input for Cursor 5.5 compact endpoint passthrough (#1832)

Antigravity Assistantf8c7e7904ef7
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 60062b385f..2669a2562c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,8 @@
### 🐛 Bug Fixes
+- **Combo Routing:** Fixed an issue where Gemini `-preview` models were incorrectly normalized to their canonical names, causing 404 errors during combo routing (#1834)
+- **Codex Native Passthrough:** Added support for Cursor 5.5 sending `messages` arrays to the `responses/compact` endpoint, preventing upstream rejections with empty requests (#1832)
- **Rate-limit Watchdog:** Implemented a new rate-limit watchdog with environment override capabilities and Stage Tracing to prevent and diagnose silent wedges (#1828)
- **Encryption Resiliency:** Prevent sending encrypted tokens to providers by returning null on decryption failure (#763d353)
- **i18n & Locales:** Fixed OpenCode baseUrl locale placeholders and added compression keys across 32 languages
diff --git a/open-sse/executors/codex.ts b/open-sse/executors/codex.ts
index 8c4d36eb90..5bc413ba96 100644
--- a/open-sse/executors/codex.ts
+++ b/open-sse/executors/codex.ts
@@ -1251,6 +1251,23 @@ export class CodexExecutor extends BaseExecutor {
// so any references to previous response items would cause 404 errors.
stripStoredItemReferences(body);
+ // Issue #1832: Map messages to input for clients like Cursor 5.5 that use responses/compact but send messages instead of input
+ if (!body.input && Array.isArray(body.messages)) {
+ body.input = body.messages.map((msg: any) => ({
+ type: "message",
+ role: typeof msg.role === "string" ? msg.role : "user",
+ content:
+ typeof msg.content === "string"
+ ? [{ type: "input_text", text: msg.content }]
+ : Array.isArray(msg.content)
+ ? msg.content.map((c: any) => {
+ if (c && c.type === "text") return { type: "input_text", text: c.text };
+ return c;
+ })
+ : [],
+ }));
+ }
+
// Issue #806: Even for native passthrough, some clients (purist completions) might indiscriminately inject
// a `messages` or `prompt` array which the strict Codex Responses schema rejects.
delete body.messages;