The users page helps you keep track of your users. You can tag each of your API calls with a customer_identifier and we will keep track of the usage of each of your users.

We keep track of each user’s behavior with the following metrics:

  • Last active time, when the user last made an API call
  • Active for, how long the user has been active in days
  • Requests, the number of API calls the user has made
  • Tokens, the number of tokens the user has used

After making an API call with customer_identifier, specified, you can see the aggregated data of each users:

Example:

Prerequisite: You have made your first API call

  1. Add the customer_identifier to your API call
{
    ...other_params,
+  "customer_identifier": "user_123"
}
  1. Call the function with the customer_identifier specified
import requests

def  keywords_ai_generate( 
                messages, 
                api_key=None,
                **kwargs
                ):

    headers = {
        'Content-Type': 'application/json',
        'Authorization': f'Bearer {api_key}',
    }
    data = {
        "messages": messages,
        **kwargs
    }
        
    response = requests.post(
        'https://api.keywordsai.co/api/generate/', headers=headers, json=data)
    return response

response = keywords_ai_generate(
    messages=[{"role":"user", "content":"Hi"}], 
                     model="gpt-3.5-turbo", 
                     api_key="En5XoPkf.kSE2edr33UCjttnqhCzlN5tz5niosedg",
                     # Add the customer_identifier
                    customer_identifier="customer_1"
              )
  1. Go to the users page and you will see the user’s data being logged
  1. You are all set! You can now keep track of your users’ usage and behavior.