@revenium/perplexity 2.0.5 → 2.0.6

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +113 -97
  2. package/LICENSE +21 -21
  3. package/README.md +292 -290
  4. package/SECURITY.md +34 -34
  5. package/dist/cjs/core/client/manager.js +6 -3
  6. package/dist/cjs/core/client/manager.js.map +1 -1
  7. package/dist/cjs/core/config/validator.js +18 -16
  8. package/dist/cjs/core/config/validator.js.map +1 -1
  9. package/dist/cjs/core/middleware/interfaces.js +4 -4
  10. package/dist/cjs/core/middleware/interfaces.js.map +1 -1
  11. package/dist/cjs/core/middleware/streaming-wrapper.js +4 -4
  12. package/dist/cjs/core/middleware/streaming-wrapper.js.map +1 -1
  13. package/dist/cjs/core/tracking/api-client.js +3 -3
  14. package/dist/cjs/core/tracking/api-client.js.map +1 -1
  15. package/dist/cjs/index.js +1 -6
  16. package/dist/cjs/index.js.map +1 -1
  17. package/dist/esm/core/client/manager.js +6 -3
  18. package/dist/esm/core/client/manager.js.map +1 -1
  19. package/dist/esm/core/config/validator.js +18 -16
  20. package/dist/esm/core/config/validator.js.map +1 -1
  21. package/dist/esm/core/middleware/interfaces.js +1 -1
  22. package/dist/esm/core/middleware/interfaces.js.map +1 -1
  23. package/dist/esm/core/middleware/streaming-wrapper.js +2 -2
  24. package/dist/esm/core/middleware/streaming-wrapper.js.map +1 -1
  25. package/dist/esm/core/tracking/api-client.js +1 -1
  26. package/dist/esm/core/tracking/api-client.js.map +1 -1
  27. package/dist/esm/index.js +0 -4
  28. package/dist/esm/index.js.map +1 -1
  29. package/dist/types/core/client/manager.d.ts.map +1 -1
  30. package/dist/types/core/config/validator.d.ts.map +1 -1
  31. package/dist/types/index.d.ts +0 -5
  32. package/dist/types/index.d.ts.map +1 -1
  33. package/examples/README.md +226 -226
  34. package/examples/advanced.ts +123 -123
  35. package/examples/basic.ts +45 -45
  36. package/examples/getting_started.ts +41 -41
  37. package/examples/metadata.ts +68 -68
  38. package/examples/stream.ts +53 -53
  39. package/package.json +72 -71
  40. package/dist/cjs/constants/models.js +0 -38
  41. package/dist/cjs/constants/models.js.map +0 -1
  42. package/dist/esm/constants/models.js +0 -35
  43. package/dist/esm/constants/models.js.map +0 -1
  44. package/dist/types/constants/models.d.ts +0 -39
  45. package/dist/types/constants/models.d.ts.map +0 -1
package/README.md CHANGED
@@ -1,290 +1,292 @@
1
- # Revenium Middleware for Perplexity
2
-
3
- A lightweight, production-ready middleware that adds **Revenium metering and tracking** to Perplexity AI API calls.
4
-
5
- [![npm version](https://img.shields.io/npm/v/@revenium/perplexity.svg)](https://www.npmjs.com/package/@revenium/perplexity)
6
- [![Node.js](https://img.shields.io/badge/Node.js-20%2B-green)](https://nodejs.org/)
7
- [![Documentation](https://img.shields.io/badge/docs-revenium.io-blue)](https://docs.revenium.io)
8
- [![Website](https://img.shields.io/badge/website-revenium.ai-blue)](https://www.revenium.ai)
9
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10
-
11
- ## Features
12
-
13
- - **Automatic Metering** - Tracks all API calls with detailed usage metrics
14
- - **Streaming Support** - Full support for streaming responses
15
- - **TypeScript First** - Built with TypeScript, includes full type definitions
16
- - **Multi-Format** - Supports both ESM and CommonJS
17
- - **Custom Metadata** - Add custom tracking metadata to any request
18
- - **Production Ready** - Battle-tested and optimized for production use
19
-
20
- ## Getting Started
21
-
22
- ### Quick Start
23
-
24
- ```bash
25
- npm install @revenium/perplexity dotenv
26
- ```
27
-
28
- For complete setup instructions, TypeScript patterns, and usage examples, see [examples/README.md](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/examples/README.md).
29
-
30
- ### Step-by-Step Guide
31
-
32
- The following guide walks you through creating a new project from scratch:
33
-
34
- #### Step 1: Create Your Project
35
-
36
- ```bash
37
- # Create project directory
38
- mkdir my-perplexity-project
39
- cd my-perplexity-project
40
-
41
- # Initialize npm project
42
- npm init -y
43
- ```
44
-
45
- #### Step 2: Install Dependencies
46
-
47
- ```bash
48
- # Install Revenium middleware and Perplexity dependencies
49
- npm install @revenium/perplexity dotenv
50
-
51
- # For TypeScript projects (optional)
52
- npm install -D typescript tsx @types/node
53
- ```
54
-
55
- #### Step 3: Setup Environment Variables
56
-
57
- Create a `.env` file in your project root.
58
-
59
- ```bash
60
- # Copy the example file
61
- cp .env.example .env
62
-
63
- # Then edit .env with your actual API keys
64
- ```
65
-
66
- See [`.env.example`](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/.env.example) for the complete list of environment variables and where to get your API keys.
67
-
68
- **Replace the placeholder values with your actual keys!**
69
-
70
- #### Step 4: Follow the Examples
71
-
72
- **For complete examples and usage patterns, see [examples/README.md](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/examples/README.md) for complete examples and setup instructions.
73
-
74
- **Cloned from GitHub?** Run examples with:
75
-
76
- ```bash
77
- npm install
78
- npm run example:getting-started # Start here!
79
- npm run example:basic
80
- npm run example:stream
81
- npm run example:metadata
82
- npm run example:advanced
83
- ```
84
-
85
- ---
86
-
87
- ## What Gets Tracked
88
-
89
- The middleware automatically captures comprehensive usage data:
90
-
91
- ### **Usage Metrics**
92
-
93
- - **Token Counts** - Input tokens, output tokens, total tokens
94
- - **Model Information** - Model name, provider (Perplexity)
95
- - **Request Timing** - Request duration, response time
96
- - **Cost Calculation** - Estimated costs based on current pricing
97
-
98
- ### **Business Context (Optional)**
99
-
100
- - **User Tracking** - Subscriber ID, email, credentials
101
- - **Organization Data** - Organization ID, subscription ID, product ID
102
- - **Task Classification** - Task type, agent identifier, trace ID
103
- - **Quality Metrics** - Response quality scores, task identifiers
104
-
105
- ### **Technical Details**
106
-
107
- - **API Endpoints** - Chat completions
108
- - **Request Types** - Streaming vs non-streaming
109
- - **Error Tracking** - Failed requests, error types, retry attempts
110
- - **Environment Info** - Development vs production usage
111
-
112
- ## API Overview
113
-
114
- The middleware provides a Go-aligned API with the following main functions:
115
-
116
- - **`Initialize(config?)`** - Initialize the middleware (from environment or explicit config)
117
- - **`GetClient()`** - Get the global Revenium client instance
118
- - **`Configure(config)`** - Alias for `Initialize()` for programmatic configuration
119
- - **`IsInitialized()`** - Check if the middleware is initialized
120
- - **`Reset()`** - Reset the global client (useful for testing)
121
-
122
- **For complete API documentation and usage examples, see [`examples/README.md`](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/examples/README.md).**
123
-
124
- ## Metadata Fields
125
-
126
- The middleware supports the following optional metadata fields for tracking:
127
-
128
- | Field | Type | Description |
129
- | ----------------------- | ------ | ---------------------------------------------------------- |
130
- | `traceId` | string | Unique identifier for session or conversation tracking |
131
- | `taskType` | string | Type of AI task being performed (e.g., "chat", "research") |
132
- | `agent` | string | AI agent or bot identifier |
133
- | `organizationId` | string | Organization or company identifier |
134
- | `productId` | string | Your product or feature identifier |
135
- | `subscriptionId` | string | Subscription plan identifier |
136
- | `responseQualityScore` | number | Custom quality rating (0.0-1.0) |
137
- | `subscriber.id` | string | Unique user identifier |
138
- | `subscriber.email` | string | User email address |
139
- | `subscriber.credential` | object | Authentication credential (`name` and `value` fields) |
140
-
141
- **All metadata fields are optional.** For complete metadata documentation and usage examples, see:
142
-
143
- - [`examples/README.md`](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/examples/README.md) - All usage examples
144
- - [Revenium API Reference](https://revenium.readme.io/reference/meter_ai_completion) - Complete API documentation
145
-
146
- ## Configuration Options
147
-
148
- ### Environment Variables
149
-
150
- For a complete list of all available environment variables with examples, see [`.env.example`](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/.env.example).
151
-
152
- ## Examples
153
-
154
- The package includes comprehensive examples in the [`examples/`](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/examples/) directory.
155
-
156
-
157
- ## Project Structure
158
-
159
- ```
160
- revenium-middleware-perplexity-node/
161
- ├── src/
162
- │ ├── core/
163
- │ │ ├── config/ # Configuration management
164
- ├── tracking/ # Metering and tracking
165
- │ │ └── wrapper/ # Perplexity API wrapper
166
- │ ├── types/ # TypeScript type definitions
167
- ├── utils/ # Utility functions
168
- └── index.ts # Main entry point
169
- ├── examples/ # TypeScript examples
170
- ├── .env.example # Example environment variables
171
- ├── package.json
172
- ├── tsconfig.json
173
- └── README.md
174
- ```
175
-
176
- ## How It Works
177
-
178
- 1. **Initialize**: Call `Initialize()` to set up the middleware with your configuration
179
- 2. **Get Client**: Call `GetClient()` to get a wrapped Perplexity client instance
180
- 3. **Make Requests**: Use the client normally - all requests are automatically tracked
181
- 4. **Async Tracking**: Usage data is sent to Revenium in the background (fire-and-forget)
182
- 5. **Transparent Response**: Original Perplexity responses are returned unchanged
183
-
184
- The middleware never blocks your application - if Revenium tracking fails, your Perplexity requests continue normally.
185
-
186
- **Supported APIs:**
187
-
188
- - Chat Completions API (`client.chat().completions().create()`)
189
- - Streaming API (`client.chat().completions().createStreaming()`)
190
-
191
- ## Troubleshooting
192
-
193
- ### Common Issues
194
-
195
- **No tracking data appears:**
196
-
197
- 1. Verify environment variables are set correctly in `.env`
198
- 2. Enable debug logging by setting `REVENIUM_DEBUG=true` in `.env`
199
- 3. Check console for `[Revenium]` log messages
200
- 4. Verify your `REVENIUM_METERING_API_KEY` is valid
201
-
202
- **Client not initialized error:**
203
-
204
- - Make sure you call `Initialize()` before `GetClient()`
205
- - Check that your `.env` file is in the project root
206
- - Verify `REVENIUM_METERING_API_KEY` is set
207
-
208
- **Perplexity API errors:**
209
-
210
- - Verify `PERPLEXITY_API_KEY` is set correctly
211
- - Check that your API key starts with `pplx-`
212
- - Ensure you're using a valid model name
213
-
214
- ### Debug Mode
215
-
216
- Enable detailed logging by adding to your `.env`:
217
-
218
- ```env
219
- REVENIUM_DEBUG=true
220
- ```
221
-
222
- ### Getting Help
223
-
224
- If issues persist:
225
-
226
- 1. Enable debug logging (`REVENIUM_DEBUG=true`)
227
- 2. Check the [`examples/`](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/examples/) directory for working examples
228
- 3. Review [`examples/README.md`](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/examples/README.md) for detailed setup instructions
229
- 4. Contact support@revenium.io with debug logs
230
-
231
- ## Supported Models
232
-
233
- This middleware works with any Perplexity model. For the complete model list, see the [Perplexity Models Documentation](https://docs.perplexity.ai/getting-started/models).
234
-
235
- ### API Support Matrix
236
-
237
- The following table shows what has been tested and verified with working examples:
238
-
239
- | Feature | Chat Completions | Streaming |
240
- | --------------------- | ---------------- | --------- |
241
- | **Basic Usage** | Yes | Yes |
242
- | **Metadata Tracking** | Yes | Yes |
243
- | **Token Counting** | Yes | Yes |
244
-
245
- **Note:** "Yes" = Tested with working examples in [`examples/`](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/examples/) directory
246
-
247
-
248
- ## Requirements
249
-
250
- - Node.js 20+
251
- - TypeScript 5.0+ (for TypeScript projects)
252
- - Revenium API key
253
- - Perplexity API key
254
-
255
- ## Documentation
256
-
257
- For detailed documentation, visit [docs.revenium.io](https://docs.revenium.io)
258
-
259
- ## Contributing
260
-
261
- See [CONTRIBUTING.md](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/CONTRIBUTING.md)
262
-
263
- ## Code of Conduct
264
-
265
- See [CODE_OF_CONDUCT.md](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/CODE_OF_CONDUCT.md)
266
-
267
- ## Security
268
-
269
- See [SECURITY.md](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/SECURITY.md)
270
-
271
- ## License
272
-
273
- This project is licensed under the MIT License - see the [LICENSE](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/LICENSE) file for details.
274
-
275
- ## Support
276
-
277
- For issues, feature requests, or contributions:
278
-
279
- - **GitHub Repository**: [revenium/revenium-middleware-perplexity-node](https://github.com/revenium/revenium-middleware-perplexity-node)
280
- - **Issues**: [Report bugs or request features](https://github.com/revenium/revenium-middleware-perplexity-node/issues)
281
- - **Documentation**: [docs.revenium.io](https://docs.revenium.io)
282
- - **Contact**: Reach out to the Revenium team for additional support
283
-
284
- ## Development
285
-
286
- For development and testing instructions, see [DEVELOPMENT.md](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/DEVELOPMENT.md).
287
-
288
- ---
289
-
290
- **Built by Revenium**
1
+ # Revenium Middleware for Perplexity
2
+
3
+ A lightweight, production-ready middleware that adds **Revenium metering and tracking** to Perplexity AI API calls.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@revenium/perplexity.svg)](https://www.npmjs.com/package/@revenium/perplexity)
6
+ [![Node.js](https://img.shields.io/badge/Node.js-20%2B-green)](https://nodejs.org/)
7
+ [![Documentation](https://img.shields.io/badge/docs-revenium.io-blue)](https://docs.revenium.io)
8
+ [![Website](https://img.shields.io/badge/website-revenium.ai-blue)](https://www.revenium.ai)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10
+
11
+ ## Features
12
+
13
+ - **Zero Configuration** - Works out of the box with environment variables
14
+ - **Automatic Metering** - Tracks all API calls with detailed usage metrics
15
+ - **Streaming Support** - Full support for streaming responses
16
+ - **TypeScript First** - Built with TypeScript, includes full type definitions
17
+ - **Multi-Format** - Supports both ESM and CommonJS
18
+ - **Custom Metadata** - Add custom tracking metadata to any request
19
+ - **Production Ready** - Battle-tested and optimized for production use
20
+
21
+ ## Getting Started
22
+
23
+ ### Quick Start
24
+
25
+ ```bash
26
+ npm install @revenium/perplexity dotenv
27
+ ```
28
+
29
+ For complete setup instructions, TypeScript patterns, and usage examples, see [examples/README.md](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/examples/README.md).
30
+
31
+ ### Step-by-Step Guide
32
+
33
+ The following guide walks you through creating a new project from scratch:
34
+
35
+ #### Step 1: Create Your Project
36
+
37
+ ```bash
38
+ # Create project directory
39
+ mkdir my-perplexity-project
40
+ cd my-perplexity-project
41
+
42
+ # Initialize npm project
43
+ npm init -y
44
+ ```
45
+
46
+ #### Step 2: Install Dependencies
47
+
48
+ ```bash
49
+ # Install Revenium middleware and Perplexity dependencies
50
+ npm install @revenium/perplexity dotenv
51
+
52
+ # For TypeScript projects (optional)
53
+ npm install -D typescript tsx @types/node
54
+ ```
55
+
56
+ #### Step 3: Setup Environment Variables
57
+
58
+ Create a `.env` file in your project root.
59
+
60
+ ```bash
61
+ # Copy the example file
62
+ cp .env.example .env
63
+
64
+ # Then edit .env with your actual API keys
65
+ ```
66
+
67
+ See [`.env.example`](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/.env.example) for the complete list of environment variables and where to get your API keys.
68
+
69
+ **Replace the placeholder values with your actual keys!**
70
+
71
+ #### Step 4: Follow the Examples
72
+
73
+ **For complete examples and usage patterns, see [examples/README.md](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/examples/README.md) for complete examples and setup instructions.
74
+
75
+ **Cloned from GitHub?** Run examples with:
76
+
77
+ ```bash
78
+ npm install
79
+ npm run example:basic
80
+ npm run example:streaming
81
+ npm run example:chat
82
+ npm run example:metadata
83
+ npm run example:advanced
84
+ npm run example:getting-started
85
+ ```
86
+
87
+ ---
88
+
89
+ ## What Gets Tracked
90
+
91
+ The middleware automatically captures comprehensive usage data:
92
+
93
+ ### **Usage Metrics**
94
+
95
+ - **Token Counts** - Input tokens, output tokens, total tokens
96
+ - **Model Information** - Model name, provider (Perplexity)
97
+ - **Request Timing** - Request duration, response time
98
+ - **Cost Calculation** - Estimated costs based on current pricing
99
+
100
+ ### **Business Context (Optional)**
101
+
102
+ - **User Tracking** - Subscriber ID, email, credentials
103
+ - **Organization Data** - Organization ID, subscription ID, product ID
104
+ - **Task Classification** - Task type, agent identifier, trace ID
105
+ - **Quality Metrics** - Response quality scores, task identifiers
106
+
107
+ ### **Technical Details**
108
+
109
+ - **API Endpoints** - Chat completions
110
+ - **Request Types** - Streaming vs non-streaming
111
+ - **Error Tracking** - Failed requests, error types, retry attempts
112
+ - **Environment Info** - Development vs production usage
113
+
114
+ ## API Overview
115
+
116
+ The middleware provides a Go-aligned API with the following main functions:
117
+
118
+ - **`Initialize(config?)`** - Initialize the middleware (from environment or explicit config)
119
+ - **`GetClient()`** - Get the global Revenium client instance
120
+ - **`Configure(config)`** - Alias for `Initialize()` for programmatic configuration
121
+ - **`IsInitialized()`** - Check if the middleware is initialized
122
+ - **`Reset()`** - Reset the global client (useful for testing)
123
+
124
+ **For complete API documentation and usage examples, see [`examples/README.md`](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/examples/README.md).**
125
+
126
+ ## Metadata Fields
127
+
128
+ The middleware supports the following optional metadata fields for tracking:
129
+
130
+ | Field | Type | Description |
131
+ | ----------------------- | ------ | ---------------------------------------------------------- |
132
+ | `traceId` | string | Unique identifier for session or conversation tracking |
133
+ | `taskType` | string | Type of AI task being performed (e.g., "chat", "research") |
134
+ | `agent` | string | AI agent or bot identifier |
135
+ | `organizationId` | string | Organization or company identifier |
136
+ | `productId` | string | Your product or feature identifier |
137
+ | `subscriptionId` | string | Subscription plan identifier |
138
+ | `responseQualityScore` | number | Custom quality rating (0.0-1.0) |
139
+ | `subscriber.id` | string | Unique user identifier |
140
+ | `subscriber.email` | string | User email address |
141
+ | `subscriber.credential` | object | Authentication credential (`name` and `value` fields) |
142
+
143
+ **All metadata fields are optional.** For complete metadata documentation and usage examples, see:
144
+
145
+ - [`examples/README.md`](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/examples/README.md) - All usage examples
146
+ - [Revenium API Reference](https://revenium.readme.io/reference/meter_ai_completion) - Complete API documentation
147
+
148
+ ## Configuration Options
149
+
150
+ ### Environment Variables
151
+
152
+ For a complete list of all available environment variables with examples, see [`.env.example`](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/.env.example).
153
+
154
+ ## Examples
155
+
156
+ The package includes comprehensive examples in the [`examples/`](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/examples/) directory.
157
+
158
+
159
+ ## Project Structure
160
+
161
+ ```
162
+ revenium-middleware-perplexity-node/
163
+ ├── src/
164
+ │ ├── core/
165
+ │ │ ├── config/ # Configuration management
166
+ ├── tracking/ # Metering and tracking
167
+ │ └── wrapper/ # Perplexity API wrapper
168
+ ├── types/ # TypeScript type definitions
169
+ ├── utils/ # Utility functions
170
+ │ └── index.ts # Main entry point
171
+ ├── examples/ # TypeScript examples
172
+ ├── .env.example # Example environment variables
173
+ ├── package.json
174
+ ├── tsconfig.json
175
+ └── README.md
176
+ ```
177
+
178
+ ## How It Works
179
+
180
+ 1. **Initialize**: Call `Initialize()` to set up the middleware with your configuration
181
+ 2. **Get Client**: Call `GetClient()` to get a wrapped Perplexity client instance
182
+ 3. **Make Requests**: Use the client normally - all requests are automatically tracked
183
+ 4. **Async Tracking**: Usage data is sent to Revenium in the background (fire-and-forget)
184
+ 5. **Transparent Response**: Original Perplexity responses are returned unchanged
185
+
186
+ The middleware never blocks your application - if Revenium tracking fails, your Perplexity requests continue normally.
187
+
188
+ **Supported APIs:**
189
+
190
+ - Chat Completions API (`client.chat().completions().create()`)
191
+ - Streaming API (`client.chat().completions().createStreaming()`)
192
+
193
+ ## Troubleshooting
194
+
195
+ ### Common Issues
196
+
197
+ **No tracking data appears:**
198
+
199
+ 1. Verify environment variables are set correctly in `.env`
200
+ 2. Enable debug logging by setting `REVENIUM_DEBUG=true` in `.env`
201
+ 3. Check console for `[Revenium]` log messages
202
+ 4. Verify your `REVENIUM_METERING_API_KEY` is valid
203
+
204
+ **Client not initialized error:**
205
+
206
+ - Make sure you call `Initialize()` before `GetClient()`
207
+ - Check that your `.env` file is in the project root
208
+ - Verify `REVENIUM_METERING_API_KEY` is set
209
+
210
+ **Perplexity API errors:**
211
+
212
+ - Verify `PERPLEXITY_API_KEY` is set correctly
213
+ - Check that your API key starts with `pplx-`
214
+ - Ensure you're using a valid model name
215
+
216
+ ### Debug Mode
217
+
218
+ Enable detailed logging by adding to your `.env`:
219
+
220
+ ```env
221
+ REVENIUM_DEBUG=true
222
+ ```
223
+
224
+ ### Getting Help
225
+
226
+ If issues persist:
227
+
228
+ 1. Enable debug logging (`REVENIUM_DEBUG=true`)
229
+ 2. Check the [`examples/`](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/examples/) directory for working examples
230
+ 3. Review [`examples/README.md`](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/examples/README.md) for detailed setup instructions
231
+ 4. Contact support@revenium.io with debug logs
232
+
233
+ ## Supported Models
234
+
235
+ This middleware works with any Perplexity model. For the complete model list, see the [Perplexity Models Documentation](https://docs.perplexity.ai/getting-started/models).
236
+
237
+ ### API Support Matrix
238
+
239
+ The following table shows what has been tested and verified with working examples:
240
+
241
+ | Feature | Chat Completions | Streaming |
242
+ | --------------------- | ---------------- | --------- |
243
+ | **Basic Usage** | Yes | Yes |
244
+ | **Metadata Tracking** | Yes | Yes |
245
+ | **Token Counting** | Yes | Yes |
246
+
247
+ **Note:** "Yes" = Tested with working examples in [`examples/`](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/examples/) directory
248
+
249
+
250
+ ## Requirements
251
+
252
+ - Node.js 20+
253
+ - TypeScript 5.0+ (for TypeScript projects)
254
+ - Revenium API key
255
+ - Perplexity API key
256
+
257
+ ## Documentation
258
+
259
+ For detailed documentation, visit [docs.revenium.io](https://docs.revenium.io)
260
+
261
+ ## Contributing
262
+
263
+ See [CONTRIBUTING.md](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/CONTRIBUTING.md)
264
+
265
+ ## Code of Conduct
266
+
267
+ See [CODE_OF_CONDUCT.md](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/CODE_OF_CONDUCT.md)
268
+
269
+ ## Security
270
+
271
+ See [SECURITY.md](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/SECURITY.md)
272
+
273
+ ## License
274
+
275
+ This project is licensed under the MIT License - see the [LICENSE](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/LICENSE) file for details.
276
+
277
+ ## Support
278
+
279
+ For issues, feature requests, or contributions:
280
+
281
+ - **GitHub Repository**: [revenium/revenium-middleware-perplexity-node](https://github.com/revenium/revenium-middleware-perplexity-node)
282
+ - **Issues**: [Report bugs or request features](https://github.com/revenium/revenium-middleware-perplexity-node/issues)
283
+ - **Documentation**: [docs.revenium.io](https://docs.revenium.io)
284
+ - **Contact**: Reach out to the Revenium team for additional support
285
+
286
+ ## Development
287
+
288
+ For development and testing instructions, see [DEVELOPMENT.md](https://github.com/revenium/revenium-middleware-perplexity-node/blob/HEAD/DEVELOPMENT.md).
289
+
290
+ ---
291
+
292
+ **Built by Revenium**