๐Quick Start Guide
Initial Connection
Installation Steps
Choose your implementation method.
Recommended: Install one of Revenium's middleware libraries (python and npm) that can be integrated using just a few lines of code. You can also view our full list of supported integrations.
Each SDK contains a configuration guide and examples for how to properly implement the middleware in your code.
You can also create a direct integration using our metering API.
Add the middleware into your current code with a single import line. Revenium's code will wrap your existing AI calls and begin metering immediately.
๐ You're Connected!
LLM Agents Looking for Agent-Friendly API Documentation?
Load the text version of our API documentation here.
Advanced Config
Enhance your AI calls with additional metadata to enable powerful reporting by customer, by agent, by task, by product, by subscriber, and more.
Set up spending & performance alerts in Revenium to avoid spending or performance surprises.
Customize Revenium's standard dashboards as you see fit to provide the information you need at a glance.
Example Configuration using OpenAI
Remember, the latest middleware options & configuration startup scripts can always be found in the 'get connected' page in the Revenium app. From within the app, you can copy the exact code required to install the middleware and execute a sample script with your account's API key.
Install Appropriate Middleware for Your Use Case
pip install revenium-middleware-openaiConfigure Environment Variables
export REVENIUM_METERING_API_KEY="YOUR_REVENIUM_KEY"
export OPENAI_API_KEY="YOUR_OPENAI_KEY"Import Revenium Middleware to Existing Python Script
import openai
import revenium_middleware_openai
response = openai.chat.completions.create(
model="gpt-4o", # You can change this to other models like "gpt-3.5-turbo"
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{
"role": "user",
"content": "What is the meaning of life, the universe and everything?",
},
],
max_tokens=500,
usage_metadata={
"trace_id": "conv-28a7e9d4",
"task_type": "summarize-customer-issue",
"subscriber": {
"id": "subscriberid-1234567890",
"email": "[email protected]",
"credential": {
"name": "engineering-api-key",
"value": "actual-api-key-value"
}
},
"organization_id": "acme-corp",
"subscription_id": "startup-plan-Q1",
"product_id": "saas-app-gold-tier",
"agent": "support-agent",
},
)
print(response.choices[0].message.content)Usage Metdata Schema
View the reference guide to see the list supported metadata across middleware packages.
Additional Middleware
Last updated
Was this helpful?
