Merge pull request #481 from beyondkmp/fix/remove-unsupported-openai-fields

fix: remove unsupported safety_identifier and previous_response_id fields from upstream requests
This commit is contained in:
Wesley Liddick
2026-02-05 08:35:12 +08:00
committed by GitHub

View File

@@ -846,12 +846,14 @@ func (s *OpenAIGatewayService) Forward(ctx context.Context, c *gin.Context, acco
}
}
// Remove prompt_cache_retention (not supported by upstream OpenAI API)
if _, has := reqBody["prompt_cache_retention"]; has {
delete(reqBody, "prompt_cache_retention")
// Remove unsupported fields (not supported by upstream OpenAI API)
for _, unsupportedField := range []string{"prompt_cache_retention", "safety_identifier", "previous_response_id"} {
if _, has := reqBody[unsupportedField]; has {
delete(reqBody, unsupportedField)
bodyModified = true
}
}
}
// Re-serialize body only if modified
if bodyModified {