It’s unlikely that the 500 error is on OpenAI’s end. Their status page shows no issues at the moment. This means there’s something amiss with your implementation.
Let’s take a look at Steve T’s Content Filtering code. He uses JSON.stringify on a parameter variable before passing it. If that doesn’t resolve the issue, try adding an Authorization header like the one Steve T has implemented.