How to limit OpenAI API usage and avoid spam messages?

Hey! I am new to the world of AI and I want to build a Mood tracker web app using MERN and openAI's AI assistant.

So the project is basically around mental health and the AI acts as a virtual therapist who kind of analyzes the mood of the user by asking different questions and helps them.

I want the AI assistant to focus on the conversation around the topic and avoid spamming messages.

Note: I am using a free trial of the API key.

How do I do it?

Also If you have any suggestions and ideas about this project. Feel free to comment down:)