@revenium/anthropic 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -7,21 +7,21 @@
7
7
 
8
8
  Automatically track and meter your Anthropic Claude API usage with Revenium. This middleware provides seamless integration with **Anthropic Claude SDK**, requiring minimal code changes and featuring native TypeScript support.
9
9
 
10
- > **šŸ“¦ Package Renamed**: This package has been renamed from `revenium-middleware-anthropic-node` to `@revenium/anthropic` for better organization and simpler naming. Please update your dependencies accordingly.
10
+ > **Note - Package Renamed**: This package has been renamed from `revenium-middleware-anthropic-node` to `@revenium/anthropic` for better organization and simpler naming. Please update your dependencies accordingly.
11
11
 
12
- ## ✨ Features
12
+ ## Features
13
13
 
14
- - šŸ”„ **Seamless Integration**: Drop-in replacement with zero code changes required
15
- - šŸ“Š **Complete Metering**: Track tokens, costs, and performance metrics automatically
16
- - šŸŽÆ **Custom Metadata**: Add business context with native TypeScript support
17
- - 🌊 **Streaming Support**: Real-time streaming with comprehensive analytics
18
- - šŸ› ļø **Tool Use Support**: Full support for Anthropic's function calling and tools
19
- - šŸ–¼ļø **Multi-modal Support**: Works with text, images, and all Claude capabilities
20
- - šŸ›”ļø **Type Safe**: Complete TypeScript support with no type casting required
21
- - šŸš€ **Fire-and-forget**: Never blocks your application flow
22
- - šŸ“ˆ **Analytics**: Detailed usage analytics and reporting
14
+ - **Seamless Integration**: Drop-in replacement with zero code changes required
15
+ - **Complete Metering**: Track tokens, costs, and performance metrics automatically
16
+ - **Custom Metadata**: Add business context with native TypeScript support
17
+ - **Streaming Support**: Real-time streaming with comprehensive analytics
18
+ - **Tool Use Support**: Full support for Anthropic's function calling and tools
19
+ - **Multi-modal Support**: Works with text, images, and all Claude capabilities
20
+ - **Type Safe**: Complete TypeScript support with no type casting required
21
+ - **Fire-and-forget**: Never blocks your application flow
22
+ - **Analytics**: Detailed usage analytics and reporting
23
23
 
24
- ## ļæ½ Package Migration
24
+ ## Package Migration
25
25
 
26
26
  This package has been renamed from `revenium-middleware-anthropic-node` to `@revenium/anthropic` for better organization and simpler naming.
27
27
 
@@ -49,24 +49,24 @@ import "@revenium/anthropic";
49
49
 
50
50
  All functionality remains exactly the same - only the package name has changed.
51
51
 
52
- ## ļæ½šŸš€ Getting Started
52
+ ## Getting Started
53
53
 
54
54
  You have **3 options** to start using Revenium middleware:
55
55
 
56
56
  ### Option 1: Create Project from Scratch
57
57
 
58
58
  Perfect for new projects. We'll guide you step-by-step from `mkdir` to running tests.
59
- [šŸ‘‰ Go to Step-by-Step Guide](#option-1-create-project-from-scratch)
59
+ [Go to Step-by-Step Guide](#option-1-create-project-from-scratch)
60
60
 
61
61
  ### Option 2: Clone Our Repository
62
62
 
63
63
  Clone and run the repository with working examples.
64
- [šŸ‘‰ Go to Repository Guide](#option-2-clone-our-repository)
64
+ [Go to Repository Guide](#option-2-clone-our-repository)
65
65
 
66
66
  ### Option 3: Add to Existing Project
67
67
 
68
68
  Already have a project? Just install and replace imports.
69
- [šŸ‘‰ Go to Quick Integration](#option-3-add-to-existing-project)
69
+ [Go to Quick Integration](#option-3-add-to-existing-project)
70
70
 
71
71
  ---
72
72
 
@@ -119,9 +119,9 @@ REVENIUM_METERING_BASE_URL=https://api.revenium.io/meter
119
119
  REVENIUM_DEBUG=true
120
120
  ```
121
121
 
122
- **šŸ’” NOTE**: Replace each `your_..._here` with your actual values.
122
+ **NOTE**: Replace each `your_..._here` with your actual values.
123
123
 
124
- **āš ļø IMPORTANT - Environment Matching**:
124
+ **IMPORTANT - Environment Matching**:
125
125
 
126
126
  - If using QA environment URL `"https://api.qa.hcapp.io/meter"`, ensure your `REVENIUM_METERING_API_KEY` is from the **QA environment**
127
127
  - If using Production environment URL `"https://api.revenium.io/meter"`, ensure your `REVENIUM_METERING_API_KEY` is from the **Production environment**
@@ -271,9 +271,9 @@ async function streamingExample() {
271
271
  }
272
272
  }
273
273
 
274
- console.log("\nāœ… Streaming completed with metering!");
274
+ console.log("\nStreaming completed with metering!");
275
275
  } catch (error) {
276
- console.error("āŒ Streaming error:", error);
276
+ console.error("Streaming error:", error);
277
277
  }
278
278
  }
279
279
 
@@ -335,8 +335,8 @@ my-anthropic-project/
335
335
 
336
336
  ```bash
337
337
  # Clone the repository
338
- git clone https://github.com/revenium/revenium-middleware-anthropic-node-internal.git
339
- cd revenium-middleware-anthropic-node-internal
338
+ git clone git@github.com:revenium/revenium-middleware-anthropic-node.git
339
+ cd revenium-middleware-anthropic-node
340
340
  ```
341
341
 
342
342
  ### Step 2: Install Dependencies
@@ -369,7 +369,7 @@ REVENIUM_METERING_BASE_URL=https://api.revenium.io/meter
369
369
  REVENIUM_DEBUG=true
370
370
  ```
371
371
 
372
- **āš ļø IMPORTANT - Environment Matching**:
372
+ **IMPORTANT - Environment Matching**:
373
373
 
374
374
  - If using QA environment URL `"https://api.qa.hcapp.io/meter"`, ensure your `REVENIUM_METERING_API_KEY` is from the **QA environment**
375
375
  - If using Production environment URL `"https://api.revenium.io/meter"`, ensure your `REVENIUM_METERING_API_KEY` is from the **Production environment**
@@ -488,7 +488,7 @@ const response = await anthropic.messages.create({
488
488
 
489
489
  ---
490
490
 
491
- ## šŸ“Š What Gets Tracked
491
+ ## What Gets Tracked
492
492
 
493
493
  The middleware automatically captures:
494
494
 
@@ -500,7 +500,7 @@ The middleware automatically captures:
500
500
  - **Streaming Metrics**: Time to first token for streaming responses
501
501
  - **Custom Metadata**: Business context you provide
502
502
 
503
- ## šŸ”§ Advanced Usage
503
+ ## Advanced Usage
504
504
 
505
505
  ### Initialization Options
506
506
 
@@ -641,18 +641,18 @@ interface UsageMetadata {
641
641
  }
642
642
  ```
643
643
 
644
- ## šŸ› ļø Configuration Options
644
+ ## Configuration Options
645
645
 
646
646
  ### Environment Variables
647
647
 
648
648
  | Variable | Required | Default | Description |
649
649
  | ---------------------------- | -------- | ------------------------------- | --------------------------------- |
650
- | `REVENIUM_METERING_API_KEY` | āœ… | - | Your Revenium API key |
651
- | `ANTHROPIC_API_KEY` | āœ… | - | Anthropic Claude API key |
652
- | `REVENIUM_METERING_BASE_URL` | āŒ | `https://api.revenium.io/meter` | Revenium metering API base URL |
653
- | `REVENIUM_DEBUG` | āŒ | `false` | Enable debug logging (true/false) |
650
+ | `REVENIUM_METERING_API_KEY` | Yes | - | Your Revenium API key |
651
+ | `ANTHROPIC_API_KEY` | Yes | - | Anthropic Claude API key |
652
+ | `REVENIUM_METERING_BASE_URL` | No | `https://api.revenium.io/meter` | Revenium metering API base URL |
653
+ | `REVENIUM_DEBUG` | No | `false` | Enable debug logging (true/false) |
654
654
 
655
- **āš ļø Important Note about `REVENIUM_METERING_BASE_URL`:**
655
+ **Important Note about `REVENIUM_METERING_BASE_URL`:**
656
656
 
657
657
  - This variable is **optional** and defaults to the production URL (`https://api.revenium.io/meter`)
658
658
  - If you don't set it explicitly, the middleware will use the default production endpoint
@@ -684,7 +684,7 @@ configure({
684
684
  });
685
685
  ```
686
686
 
687
- ## 🚨 Troubleshooting
687
+ ## Troubleshooting
688
688
 
689
689
  ### Common Issues
690
690
 
@@ -747,29 +747,28 @@ Look for log messages like:
747
747
  - `[Revenium] Usage metadata extracted`
748
748
  - `[Revenium] Revenium tracking successful`
749
749
 
750
- ## šŸ”— Supported Models
750
+ ## Supported Models
751
751
 
752
752
  All Claude models are supported:
753
753
 
754
- | Model | Status | Use Case |
755
- | -------------------------- | --------- | ------------------------------------- |
756
- | `claude-3-5-sonnet-latest` | āœ… Latest | General purpose, best performance |
757
- | `claude-3-5-haiku-latest` | āœ… Latest | Fast responses, cost-effective |
758
- | `claude-3-opus-latest` | āœ… Latest | Complex reasoning, highest capability |
759
- | `claude-3-sonnet-20240229` | āœ… Stable | Production workloads |
760
- | `claude-3-haiku-20240307` | āœ… Stable | High-volume applications |
754
+ | Model | Status | Use Case |
755
+ | -------------------------- | ------------------ | ------------------------------------- |
756
+ | `claude-3-5-sonnet-latest` | Supported (Latest) | General purpose, best performance |
757
+ | `claude-3-5-haiku-latest` | Supported (Latest) | Fast responses, cost-effective |
758
+ | `claude-3-opus-latest` | Supported (Latest) | Complex reasoning, highest capability |
759
+ | `claude-3-sonnet-20240229` | Supported (Stable) | Production workloads |
760
+ | `claude-3-haiku-20240307` | Supported (Stable) | High-volume applications |
761
761
 
762
- ## šŸ“š Included Examples
762
+ ## Included Examples
763
763
 
764
764
  The package includes these example files:
765
765
 
766
766
  - **basic-usage.ts**: Simple chat completions with all initialization methods
767
767
  - **advanced-features.ts**: Streaming, tools, and custom metadata
768
- - **typescript-monorepo.ts**: TypeScript monorepo integration patterns
769
768
 
770
- All examples are in the `examples/` directory of the installed package.
769
+ All examples are in the `examples/` directory of the installed package. For detailed TypeScript patterns and usage, see [examples/README.md](examples/README.md).
771
770
 
772
- ## šŸ”„ How It Works
771
+ ## How It Works
773
772
 
774
773
  1. **Automatic Patching**: When imported, the middleware patches Anthropic's `messages.create` method
775
774
  2. **Request Interception**: All Anthropic requests are intercepted to extract metadata
@@ -779,23 +778,23 @@ All examples are in the `examples/` directory of the installed package.
779
778
 
780
779
  The middleware never blocks your application - if Revenium tracking fails, your Anthropic requests continue normally.
781
780
 
782
- ## šŸ“‹ Requirements
781
+ ## Requirements
783
782
 
784
783
  - Node.js 16+
785
784
  - Anthropic SDK (@anthropic-ai/sdk) v0.20.0+
786
785
  - TypeScript 5.0+ (for TypeScript projects)
787
786
  - Revenium API key
788
787
 
789
- ## šŸ“„ License
788
+ ## License
790
789
 
791
790
  This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
792
791
 
793
- ## šŸ¤ Support
792
+ ## Support
794
793
 
795
794
  For issues, feature requests, or contributions:
796
795
 
797
- - **GitHub Repository**: [revenium/revenium-middleware-anthropic-node-internal](https://github.com/revenium/revenium-middleware-anthropic-node-internal)
798
- - **Issues**: [Report bugs or request features](https://github.com/revenium/revenium-middleware-anthropic-node-internal/issues)
796
+ - **GitHub Repository**: [revenium/revenium-middleware-anthropic-node](https://github.com/revenium/revenium-middleware-anthropic-node)
797
+ - **Issues**: [Report bugs or request features](https://github.com/revenium/revenium-middleware-anthropic-node/issues)
799
798
  - **Contact**: Reach out to the Revenium team for additional support
800
799
 
801
800
  ## Development
@@ -804,4 +803,4 @@ For development and testing instructions, see [DEVELOPMENT.md](DEVELOPMENT.md).
804
803
 
805
804
  ---
806
805
 
807
- **Built with ā¤ļø by Revenium**
806
+ **Built by Revenium**
@@ -23,7 +23,7 @@
23
23
  *
24
24
  * ### Basic Usage:
25
25
  * ```typescript
26
- * import 'revenium-middleware-anthropic-node';
26
+ * import '@revenium/anthropic';
27
27
  * import Anthropic from '@anthropic-ai/sdk';
28
28
  *
29
29
  * const anthropic = new Anthropic();
@@ -22,7 +22,7 @@
22
22
  *
23
23
  * ### Basic Usage:
24
24
  * ```typescript
25
- * import 'revenium-middleware-anthropic-node';
25
+ * import '@revenium/anthropic';
26
26
  * import Anthropic from '@anthropic-ai/sdk';
27
27
  *
28
28
  * const anthropic = new Anthropic();
@@ -22,7 +22,7 @@
22
22
  *
23
23
  * ### Basic Usage:
24
24
  * ```typescript
25
- * import 'revenium-middleware-anthropic-node';
25
+ * import '@revenium/anthropic';
26
26
  * import Anthropic from '@anthropic-ai/sdk';
27
27
  *
28
28
  * const anthropic = new Anthropic();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revenium/anthropic",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Transparent TypeScript middleware for automatic Revenium usage tracking with Anthropic Claude AI",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -44,6 +44,14 @@
44
44
  ],
45
45
  "author": "Revenium",
46
46
  "license": "MIT",
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/revenium/revenium-middleware-anthropic-node.git"
50
+ },
51
+ "homepage": "https://github.com/revenium/revenium-middleware-anthropic-node#readme",
52
+ "bugs": {
53
+ "url": "https://github.com/revenium/revenium-middleware-anthropic-node/issues"
54
+ },
47
55
  "dependencies": {
48
56
  "node-fetch": "^3.3.2"
49
57
  },