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(translator): strip safety_identifier in openai-responses cleanup (#2770) (#2809)
Diego Rodrigues de Sa e Souza5f886dc73a13
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex b13475ba0f..428e911361 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -22,6 +22,7 @@- **combo:** resolve custom `openai-compatible-responses-*` provider targets correctly when called via combo name — combo steps storing the internal UUID-prefixed provider id now match the provider node by id as well as by prefix, fixing 503 errors for users with custom providers used inside combos (#2778)- **combos:** fix combo handling so transient 429 rate limit errors do not poison or persist the rate limited state for the same-provider connection (#2800 — thanks @apoapostolov)- **gemini:** translate signature-less Gemini thinking model tool calls to text parts to prevent `400 "missing thought_signature"` errors (#2801 — thanks @herjarsa)+- **translator:** strip `safety_identifier` from `/v1/responses` body before forwarding to Chat Completions upstream; fixes LobeHub-originated `400` errors (#2770)- **warning-cleanup:** relax node engine constraint to `>=22.0.0` and clean dependencies (keeping `marked-terminal` to prevent TUI REPL crash) (#2792 — thanks @oyi77)- **fix(cli):** register openclaw in the CLI tool-detector so it appears in `omniroute status` alongside its existing API and config support ([#2833](https://github.com/diegosouzapw/OmniRoute/issues/2833))diff --git a/open-sse/translator/request/openai-responses.ts b/open-sse/translator/request/openai-responses.tsindex eadb2e8811..8b25bbb67e 100644--- a/open-sse/translator/request/openai-responses.ts+++ b/open-sse/translator/request/openai-responses.ts@@ -345,6 +345,9 @@ export function openaiResponsesToOpenAIRequest(}}delete result.reasoning;+ // Strip Responses-API-only fields that Chat Completions rejects with 400.+ // safety_identifier is sent by LobeHub and has no Chat Completions equivalent (#2770).+ delete result.safety_identifier;return result;}diff --git a/tests/unit/translator-openai-responses-req.test.ts b/tests/unit/translator-openai-responses-req.test.tsindex f7e3587a98..ece658aa5d 100644--- a/tests/unit/translator-openai-responses-req.test.ts+++ b/tests/unit/translator-openai-responses-req.test.ts@@ -216,6 +216,23 @@ test("Responses -> Chat passes through when background flag is unset or false (n}});+test("Responses -> Chat strips safety_identifier (LobeHub #2770)", () => {+ // LobeHub sends safety_identifier in Responses API bodies. Chat Completions rejects it+ // with HTTP 400. The translator must strip it in the Responses-API cleanup block.+ const result = openaiResponsesToOpenAIRequest(+ "gpt-4o",+ {+ input: [{ role: "user", content: [{ type: "input_text", text: "hi" }] }],+ safety_identifier: "sid-xyz",+ },+ false,+ null+ ) as Record<string, unknown>;++ assert.equal(result.safety_identifier, undefined, "safety_identifier must be stripped before forwarding to Chat Completions");+ assert.ok(Array.isArray(result.messages), "translation must still produce messages");+});+test("Chat -> Responses converts messages, tool calls, tool outputs, tools and pass-through params", () => {const result = openaiToOpenAIResponsesRequest("gpt-4o",