Content Moderation Question

Hello, first post!

I am building a consumer facing GPT4 bot and the flow of my code runs as follows:

  1. The user’s input first goes to the moderation API

  2. If the user’s input is not flagged by the API, it goes on to the completion API.

The order is sequential so that that way no input that a user generates ever goes through to the completion API without passing the moderation API first. I do this to hopefully eliminate the possibility that openAI bans my account.

The problem is that, because of the sequential nature of these API calls, the output returns to the user much slower than I would ideally like.

Is there any way I can get around this issue? Perhaps there is a form of the moderation API that I can run locally on my backend to speed things up? Or perhaps I can run both functions at the same time but not return the output to my user unless it has cleared the moderation API? Or some other possibilities?