@revenium/perplexity 2.0.7 → 2.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +23 -0
- package/CHANGELOG.md +99 -113
- package/LICENSE +21 -21
- package/README.md +528 -376
- package/SECURITY.md +34 -34
- package/dist/cjs/core/config/loader.js +16 -0
- package/dist/cjs/core/config/loader.js.map +1 -1
- package/dist/cjs/core/config/manager.js +9 -0
- package/dist/cjs/core/config/manager.js.map +1 -1
- package/dist/cjs/core/tracking/api-client.js +2 -0
- package/dist/cjs/core/tracking/api-client.js.map +1 -1
- package/dist/cjs/core/tracking/payload-builder.js +20 -1
- package/dist/cjs/core/tracking/payload-builder.js.map +1 -1
- package/dist/cjs/core/tracking/usage-tracker.js +1 -1
- package/dist/cjs/core/tracking/usage-tracker.js.map +1 -1
- package/dist/cjs/utils/summary-printer.js +237 -0
- package/dist/cjs/utils/summary-printer.js.map +1 -0
- package/dist/cjs/utils/trace-fields.js +136 -0
- package/dist/cjs/utils/trace-fields.js.map +1 -0
- package/dist/esm/core/config/loader.js +16 -0
- package/dist/esm/core/config/loader.js.map +1 -1
- package/dist/esm/core/config/manager.js +9 -0
- package/dist/esm/core/config/manager.js.map +1 -1
- package/dist/esm/core/tracking/api-client.js +2 -0
- package/dist/esm/core/tracking/api-client.js.map +1 -1
- package/dist/esm/core/tracking/payload-builder.js +20 -1
- package/dist/esm/core/tracking/payload-builder.js.map +1 -1
- package/dist/esm/core/tracking/usage-tracker.js +1 -1
- package/dist/esm/core/tracking/usage-tracker.js.map +1 -1
- package/dist/esm/utils/summary-printer.js +233 -0
- package/dist/esm/utils/summary-printer.js.map +1 -0
- package/dist/esm/utils/trace-fields.js +121 -0
- package/dist/esm/utils/trace-fields.js.map +1 -0
- package/dist/types/core/config/loader.d.ts.map +1 -1
- package/dist/types/core/config/manager.d.ts.map +1 -1
- package/dist/types/core/tracking/api-client.d.ts.map +1 -1
- package/dist/types/core/tracking/payload-builder.d.ts +1 -1
- package/dist/types/core/tracking/payload-builder.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +13 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/utils/summary-printer.d.ts +23 -0
- package/dist/types/utils/summary-printer.d.ts.map +1 -0
- package/dist/types/utils/trace-fields.d.ts +11 -0
- package/dist/types/utils/trace-fields.d.ts.map +1 -0
- package/examples/README.md +274 -230
- package/examples/advanced.ts +123 -123
- package/examples/basic.ts +45 -45
- package/examples/getting_started.ts +41 -41
- package/examples/metadata.ts +68 -68
- package/examples/stream.ts +53 -53
- package/package.json +82 -72
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Summary Printer Module
|
|
3
|
+
*
|
|
4
|
+
* Provides terminal output for cost/metrics summary after API requests.
|
|
5
|
+
* Fetches cost data from Revenium's completions API and formats for console display.
|
|
6
|
+
*
|
|
7
|
+
* NOTE: This module intentionally uses console.log() for user-facing output,
|
|
8
|
+
* which is an exception to the standard logging practices.
|
|
9
|
+
* The Logger class is used for debug/error messages, while console.log
|
|
10
|
+
* is used for the formatted summary that users want to see in their terminal.
|
|
11
|
+
*/
|
|
12
|
+
import { ReveniumPayload } from "../types/index.js";
|
|
13
|
+
type SummaryFormat = "human" | "json";
|
|
14
|
+
interface Config {
|
|
15
|
+
reveniumApiKey?: string;
|
|
16
|
+
reveniumBaseUrl?: string;
|
|
17
|
+
teamId?: string;
|
|
18
|
+
printSummary?: boolean | SummaryFormat;
|
|
19
|
+
}
|
|
20
|
+
export declare function setConfig(config: Config | null): void;
|
|
21
|
+
export declare function printUsageSummary(payload: ReveniumPayload): void;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=summary-printer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summary-printer.d.ts","sourceRoot":"","sources":["../../../src/utils/summary-printer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,KAAK,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;AAEtC,UAAU,MAAM;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;CACxC;AAID,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAErD;AA4SD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CA0BhE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function resetRegionCache(): void;
|
|
2
|
+
export declare function getEnvironment(): string | null;
|
|
3
|
+
export declare function getRegion(): Promise<string | null>;
|
|
4
|
+
export declare function getCredentialAlias(): string | null;
|
|
5
|
+
export declare function getTraceType(): string | null;
|
|
6
|
+
export declare function getTraceName(): string | null;
|
|
7
|
+
export declare function detectOperationSubtype(requestBody?: any): string | null;
|
|
8
|
+
export declare function getParentTransactionId(): string | null;
|
|
9
|
+
export declare function getTransactionName(): string | null;
|
|
10
|
+
export declare function getRetryNumber(): number | null;
|
|
11
|
+
//# sourceMappingURL=trace-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace-fields.d.ts","sourceRoot":"","sources":["../../../src/utils/trace-fields.ts"],"names":[],"mappings":"AASA,wBAAgB,gBAAgB,IAAI,IAAI,CAIvC;AAED,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAqB9C;AAED,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAuCxD;AAED,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAiBlD;AAED,wBAAgB,YAAY,IAAI,MAAM,GAAG,IAAI,CAwB5C;AAED,wBAAgB,YAAY,IAAI,MAAM,GAAG,IAAI,CAa5C;AAED,wBAAgB,sBAAsB,CAAC,WAAW,CAAC,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI,CAKvE;AAED,wBAAgB,sBAAsB,IAAI,MAAM,GAAG,IAAI,CAEtD;AAED,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAElD;AAED,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAU9C"}
|
package/examples/README.md
CHANGED
|
@@ -1,230 +1,274 @@
|
|
|
1
|
-
# Revenium Perplexity Middleware - Examples
|
|
2
|
-
|
|
3
|
-
This directory contains examples demonstrating how to use the Revenium Perplexity middleware.
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
Before running the examples, make sure you have:
|
|
8
|
-
|
|
9
|
-
1. **Node.js 20+** installed
|
|
10
|
-
2. **Revenium API Key** - Get one from [Revenium Dashboard](https://app.revenium.ai)
|
|
11
|
-
3. **Perplexity API Key** - Get one from [Perplexity Platform](https://www.perplexity.ai)
|
|
12
|
-
|
|
13
|
-
## Setup
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
###
|
|
72
|
-
|
|
73
|
-
**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
**
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
1
|
+
# Revenium Perplexity Middleware - Examples
|
|
2
|
+
|
|
3
|
+
This directory contains examples demonstrating how to use the Revenium Perplexity middleware.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
Before running the examples, make sure you have:
|
|
8
|
+
|
|
9
|
+
1. **Node.js 20+** installed
|
|
10
|
+
2. **Revenium API Key** - Get one from [Revenium Dashboard](https://app.revenium.ai)
|
|
11
|
+
3. **Perplexity API Key** - Get one from [Perplexity Platform](https://www.perplexity.ai)
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
Choose one of the following approaches:
|
|
16
|
+
|
|
17
|
+
### Option 1: Create a New Project (Recommended)
|
|
18
|
+
|
|
19
|
+
Follow the step-by-step guide below to create a new project and install the middleware from npm.
|
|
20
|
+
|
|
21
|
+
### Option 2: Clone the Repository (Optional)
|
|
22
|
+
|
|
23
|
+
If you want to explore the source code or contribute to the project:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
git clone https://github.com/revenium/revenium-middleware-perplexity-node.git
|
|
27
|
+
cd revenium-middleware-perplexity-node
|
|
28
|
+
npm install
|
|
29
|
+
npm run build
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Then skip to [Step 3: Environment Setup](#3-environment-setup) below.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Getting Started - Step by Step
|
|
37
|
+
|
|
38
|
+
### 1. Create Your Project
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Create project directory
|
|
42
|
+
mkdir my-perplexity-project
|
|
43
|
+
cd my-perplexity-project
|
|
44
|
+
|
|
45
|
+
# Initialize Node.js project
|
|
46
|
+
npm init -y
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 2. Install Dependencies
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm install @revenium/perplexity openai
|
|
53
|
+
npm install -D typescript tsx @types/node # For TypeScript
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 3. Environment Setup
|
|
57
|
+
|
|
58
|
+
Create a `.env` file in the project root with your API keys:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Required
|
|
62
|
+
REVENIUM_METERING_API_KEY=hak_your_revenium_api_key
|
|
63
|
+
PERPLEXITY_API_KEY=pplx_your_perplexity_api_key
|
|
64
|
+
|
|
65
|
+
# Optional
|
|
66
|
+
REVENIUM_METERING_BASE_URL=https://api.revenium.ai
|
|
67
|
+
PERPLEXITY_API_BASE_URL=https://api.perplexity.ai
|
|
68
|
+
REVENIUM_DEBUG=false
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 4. Run Examples
|
|
72
|
+
|
|
73
|
+
**If you cloned from GitHub:**
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Run examples directly (or use npm run example:<name> scripts)
|
|
77
|
+
npx tsx examples/getting_started.ts
|
|
78
|
+
npx tsx examples/basic.ts
|
|
79
|
+
npx tsx examples/metadata.ts
|
|
80
|
+
npx tsx examples/stream.ts
|
|
81
|
+
npx tsx examples/advanced.ts
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**If you installed via npm:**
|
|
85
|
+
|
|
86
|
+
Examples are included in your `node_modules/@revenium/perplexity/examples/` directory:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npx tsx node_modules/@revenium/perplexity/examples/getting_started.ts
|
|
90
|
+
npx tsx node_modules/@revenium/perplexity/examples/basic.ts
|
|
91
|
+
npx tsx node_modules/@revenium/perplexity/examples/metadata.ts
|
|
92
|
+
npx tsx node_modules/@revenium/perplexity/examples/stream.ts
|
|
93
|
+
npx tsx node_modules/@revenium/perplexity/examples/advanced.ts
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Examples
|
|
97
|
+
|
|
98
|
+
### 1. Getting Started
|
|
99
|
+
|
|
100
|
+
**File:** `getting_started.ts`
|
|
101
|
+
|
|
102
|
+
The simplest example to get you started with Revenium tracking:
|
|
103
|
+
|
|
104
|
+
- Initialize the middleware
|
|
105
|
+
- Create a basic chat completion
|
|
106
|
+
- Display response and usage metrics
|
|
107
|
+
|
|
108
|
+
**Run:**
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
npx tsx examples/getting_started.ts
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**What it does:**
|
|
115
|
+
|
|
116
|
+
- Loads configuration from environment variables
|
|
117
|
+
- Creates a simple chat completion request
|
|
118
|
+
- Automatically sends metering data to Revenium API
|
|
119
|
+
- Displays the response
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
### 2. Basic Usage
|
|
124
|
+
|
|
125
|
+
**File:** `basic.ts`
|
|
126
|
+
|
|
127
|
+
Demonstrates standard Perplexity API usage:
|
|
128
|
+
|
|
129
|
+
- Chat completions with metadata
|
|
130
|
+
- Simple metadata tracking
|
|
131
|
+
|
|
132
|
+
**Run:**
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
npx tsx examples/basic.ts
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**What it does:**
|
|
139
|
+
|
|
140
|
+
- Creates chat completions with metadata tracking
|
|
141
|
+
- Demonstrates basic metadata usage
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
### 3. Metadata
|
|
146
|
+
|
|
147
|
+
**File:** `metadata.ts`
|
|
148
|
+
|
|
149
|
+
Demonstrates all available metadata fields:
|
|
150
|
+
|
|
151
|
+
- Complete metadata structure
|
|
152
|
+
- All optional fields documented
|
|
153
|
+
- Subscriber information
|
|
154
|
+
|
|
155
|
+
**Run:**
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
npx tsx examples/metadata.ts
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**What it does:**
|
|
162
|
+
|
|
163
|
+
- Shows all available metadata fields
|
|
164
|
+
- Demonstrates subscriber tracking
|
|
165
|
+
- Includes organization and product tracking
|
|
166
|
+
|
|
167
|
+
**Metadata fields supported:**
|
|
168
|
+
|
|
169
|
+
- `traceId` - Session or conversation tracking identifier
|
|
170
|
+
- `taskType` - Type of AI task being performed
|
|
171
|
+
- `agent` - AI agent or bot identifier
|
|
172
|
+
- `organizationId` - Organization identifier
|
|
173
|
+
- `productId` - Product or service identifier
|
|
174
|
+
- `subscriptionId` - Subscription tier identifier
|
|
175
|
+
- `responseQualityScore` - Quality rating (0.0-1.0)
|
|
176
|
+
- `subscriber` - Nested subscriber object with `id`, `email`, `credential` (with `name` and `value`)
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
### 4. Streaming
|
|
181
|
+
|
|
182
|
+
**File:** `stream.ts`
|
|
183
|
+
|
|
184
|
+
Demonstrates streaming responses:
|
|
185
|
+
|
|
186
|
+
- Real-time token streaming
|
|
187
|
+
- Accumulating responses
|
|
188
|
+
- Streaming metrics
|
|
189
|
+
|
|
190
|
+
**Run:**
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
npx tsx examples/stream.ts
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**What it does:**
|
|
197
|
+
|
|
198
|
+
- Creates a streaming chat completion
|
|
199
|
+
- Displays tokens as they arrive in real-time
|
|
200
|
+
- Tracks streaming metrics
|
|
201
|
+
- Sends metering data after stream completes
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
### 5. Advanced Features
|
|
206
|
+
|
|
207
|
+
**File:** `advanced.ts`
|
|
208
|
+
|
|
209
|
+
Demonstrates advanced Perplexity features:
|
|
210
|
+
|
|
211
|
+
- Multi-turn conversations
|
|
212
|
+
- Different temperature settings
|
|
213
|
+
- Multiple Perplexity models
|
|
214
|
+
|
|
215
|
+
**Run:**
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
npx tsx examples/advanced.ts
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**What it does:**
|
|
222
|
+
|
|
223
|
+
- Demonstrates multi-turn conversation with system prompt
|
|
224
|
+
- Shows creative responses with higher temperature
|
|
225
|
+
- Uses sonar-reasoning model for complex reasoning tasks
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Common Issues
|
|
230
|
+
|
|
231
|
+
### "Client not initialized" error
|
|
232
|
+
|
|
233
|
+
**Solution:** Make sure to call `Initialize()` before using `GetClient()`.
|
|
234
|
+
|
|
235
|
+
### "REVENIUM_METERING_API_KEY is required" error
|
|
236
|
+
|
|
237
|
+
**Solution:** Set the `REVENIUM_METERING_API_KEY` environment variable in your `.env` file.
|
|
238
|
+
|
|
239
|
+
### "invalid Revenium API key format" error
|
|
240
|
+
|
|
241
|
+
**Solution:** Revenium API keys should start with `hak_`. Check your API key format.
|
|
242
|
+
|
|
243
|
+
### Environment variables not loading
|
|
244
|
+
|
|
245
|
+
**Solution:** Make sure your `.env` file is in the project root directory and contains the required variables.
|
|
246
|
+
|
|
247
|
+
### Perplexity API errors
|
|
248
|
+
|
|
249
|
+
**Solution:** Make sure you have set `PERPLEXITY_API_KEY` in your `.env` file and that it starts with `pplx-`.
|
|
250
|
+
|
|
251
|
+
### Debug Mode
|
|
252
|
+
|
|
253
|
+
Enable detailed logging to troubleshoot issues:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# In .env file
|
|
257
|
+
REVENIUM_DEBUG=true
|
|
258
|
+
|
|
259
|
+
# Then run examples
|
|
260
|
+
npm run example:getting-started
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Next Steps
|
|
264
|
+
|
|
265
|
+
- Check the [main README](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/README.md) for detailed documentation
|
|
266
|
+
- Visit the [Revenium Dashboard](https://app.revenium.ai) to view your metering data
|
|
267
|
+
- See [.env.example](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/.env.example) for all configuration options
|
|
268
|
+
|
|
269
|
+
## Support
|
|
270
|
+
|
|
271
|
+
For issues or questions:
|
|
272
|
+
|
|
273
|
+
- Documentation: https://docs.revenium.io
|
|
274
|
+
- Email: support@revenium.io
|