API metering for application

HI is there a way to expose a consumer rate limit usage API call. We want to show each consumer usage on the application. I’m assuming custom plugin can help me on this but not sure it has the capability to expose an API. Can anyone help me to get a solution on this? also is there a brief document for writing a custom plugin.