# Quick Start Guide

## Initial Connection

{% @storylane/embed subdomain="revenium" url="<https://revenium.storylane.io/share/cjef8ah2hlym>" linkValue="cjef8ah2hlym" %}

#### Installation Steps

[Sign up here](https://app.revenium.ai/sign-up) to get an API key

1. Choose your implementation method.
   1. **Recommended:** Install one of Revenium's SDKs ([python](https://pypi.org/org/revenium/) and [npm](https://www.npmjs.com/org/revenium)) that can be integrated using just a few lines of code. You can also view our [full list of supported integrations](/integration-options-for-ai-metering.md).
   2. Each SDK contains a configuration guide and examples for how to properly implement the SDK in your code.
   3. You can also create a direct integration using our [metering API](https://revenium.readme.io/reference/meter_ai_completion).
2. Add the SDK into your current code with a single import line. Revenium's code will wrap your existing AI calls and begin metering immediately.

:tada: **You're Connected!**

### AI Agents

Access Revenium documentation directly from your AI coding assistant. See [For AI Agents](/for-ai-agents.md).

## Advanced Config

1. Enhance your AI calls with additional metadata to enable powerful reporting by customer, by agent, by task, by product, by subscriber, and more.
2. Set up spending & performance alerts in Revenium to avoid spending or performance surprises.
3. Customize Revenium's standard dashboards as you see fit to provide the information you need at a glance.

## Example Configuration using OpenAI

{% hint style="warning" %}
Remember, the latest SDK 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 SDK and execute a sample script with your account's API key.
{% endhint %}

#### Install Appropriate SDK for Your Use Case

```bash
# Create project directory and navigate to it
mkdir my-openai-project
cd my-openai-project

# Create virtual environment
python -m venv .venv

# Activate virtual environment
source .venv/bin/activate

# Install packages (run after activation)
pip install "revenium-python-sdk[openai]" openai
```

#### Configure Environment Variables

```bash
export REVENIUM_METERING_API_KEY="YOUR_REVENIUM_KEY"
export OPENAI_API_KEY="YOUR_OPENAI_KEY"
```

#### Import Revenium SDK to Existing Python Script

```python
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": "user@example.com",
             "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 Metadata Schema

View the [reference guide](/integration-options-for-ai-metering.md#usage-metadata-reference) to see the list of supported metadata across our SDKs.

## Additional SDKs

:blue\_book: [Complete list of supported SDKs](/integration-options-for-ai-metering.md) →


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.revenium.io/quick-start-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
