🗣️Customer & Subscriber Management

In Revenium, the following hierarchy and nomenclature is used to manage internal or external customers, users, subscribers, and credentials / API keys.

Term
Usage
Middleware Parameter

Organizations

Organizations can be either company names or internal business units. The organization object in Revenium supports various metadata fields to allow you to easily sync these objects to internal systems (typically CRM).

Example Values:

AcmeSoft (customer)

Finance (internal)

Organizations can be associated with one or many subscribers

organization_id

Subscribers

Subscribers are individuals who consume AI or digital products. The subscriber object contains their email address and name. Email addresses are used to identify the subscriber in API / middleware calls.

Example Values: [email protected]

Subscribers can be associated with one or many subscriber credentials.

subscriber_email, subscriber_id

Subscriber Credentials

Credentials contain unique identifiers used by subscribers to access services. In some use cases, it will be the email address of the subscriber, but it could also be an alias for different API keys used by internal developers or external customers, particularly when one subscriber could have multiple API keys and you wish to track usage for each credential separately. Example Values: key1-hubspot, key2-financeProject

subscriber_credential_name, subscriber_credential_value

Example API Call Incorporating Customer Data

import openai
import revenium_middleware_openai

# Ensure REVENIUM_METERING_API_KEY & 
# OPENAI_API_KEY environment variables are set

response = openai.chat.completions.create(
    model="gpt-4",
    messages=[
        {
            "role": "system",
            "content": "You are a helpful assistant."
        },
        {
            "role": "user",
            "content": "What is the meaning of life?"
        },
    ],
    max_tokens=500,

    # Example usage data showing how organizations, subscribers,
    # and credentials are used.
    usage_metadata={
            "organization_id": "AcmeSoft",
            "subscriber_identity": "[email protected]",
            "subscriber_credential": "key1-hubspot",
        },
)
print(response.choices[0].message.content)

Last updated

Was this helpful?