How to calculate the number of API request in a code?

Hi all,
I am trying to write a Python3 code to take some inputs and send SMS, Email to alert. But was not sure what should be the delay duration.
Is every digitalRead/Write an API request?
I am using Twilio and Mailgun to SMS and Email (as in the training), are those API requests considered in the rate limiting?
If I am using Google Assistant to activate/ deactivate the system using IFTTT, is that an API request too?
What are other commands that are an API request?

I am attaching a screenshot of a code, how many API requests are present in the code and what are those?

API Introduction

This should clear your query. If you still have any doubts, feel free to share it out.
Always here to help.