@revenium/anthropic 1.0.6 → 1.0.7
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.0.7] - 2025-10-25
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- Updated all examples to use `claude-haiku-4-5` (validated Anthropic model identifier)
|
|
9
|
+
- Improved examples documentation with getting_started.ts reference
|
|
10
|
+
- Streamlined README by removing OpenRouter section for clarity
|
|
11
|
+
|
|
5
12
|
## [1.0.6] - 2025-10-24
|
|
6
13
|
|
|
7
14
|
### Added
|
package/README.md
CHANGED
|
@@ -191,14 +191,6 @@ npm install
|
|
|
191
191
|
npm run build
|
|
192
192
|
```
|
|
193
193
|
|
|
194
|
-
### OpenRouter Users
|
|
195
|
-
|
|
196
|
-
**Note:** Revenium's automatic token cost calculation uses AI model names from the providers themselves (e.g., `claude-sonnet-4-20250514`).
|
|
197
|
-
|
|
198
|
-
If you are using a service like OpenRouter that changes model names (from `claude-sonnet-4-20250514` to `anthropic/claude-sonnet-4`), automatic cost calculations may not work properly in Revenium (though all other processing will work normally).
|
|
199
|
-
|
|
200
|
-
Supporting OpenRouter AI model names is something we're working on for the future. If this is critical for your use case, please use the 'provide feedback' button in the Help Center to let us know.
|
|
201
|
-
|
|
202
194
|
### Debug Mode
|
|
203
195
|
|
|
204
196
|
Enable detailed logging to troubleshoot issues:
|
|
@@ -10,7 +10,13 @@
|
|
|
10
10
|
"Bash(tee:*)",
|
|
11
11
|
"Bash(npm run clean:*)",
|
|
12
12
|
"Bash(npm run build:*)",
|
|
13
|
-
"Bash(node -e \"require(''@revenium/anthropic''); console.log(''✅ Option A (Auto-init) - Import works'')\")"
|
|
13
|
+
"Bash(node -e \"require(''@revenium/anthropic''); console.log(''✅ Option A (Auto-init) - Import works'')\")",
|
|
14
|
+
"Bash(for section in \"Features\" \"Package Migration\" \"Getting Started\" \"Advanced Usage\" \"Configuration Options\" \"Troubleshooting\" \"Requirements\" \"Documentation\" \"Contributing\" \"Code of Conduct\" \"Security\" \"License\" \"Support\" \"Development\")",
|
|
15
|
+
"Bash(do)",
|
|
16
|
+
"Bash(echo:*)",
|
|
17
|
+
"Bash(done)",
|
|
18
|
+
"Bash(grep:*)",
|
|
19
|
+
"Bash(gitleaks detect:*)"
|
|
14
20
|
],
|
|
15
21
|
"deny": [],
|
|
16
22
|
"ask": []
|
package/examples/README.md
CHANGED
|
@@ -46,6 +46,7 @@ npm run example:basic
|
|
|
46
46
|
npm run example:advanced
|
|
47
47
|
|
|
48
48
|
# Or use tsx directly
|
|
49
|
+
npx tsx examples/getting_started.ts
|
|
49
50
|
npx tsx examples/basic-usage.ts
|
|
50
51
|
npx tsx examples/advanced-features.ts
|
|
51
52
|
```
|
|
@@ -55,12 +56,32 @@ npx tsx examples/advanced-features.ts
|
|
|
55
56
|
Examples are included in your `node_modules/@revenium/anthropic/examples/` directory:
|
|
56
57
|
|
|
57
58
|
```bash
|
|
59
|
+
npx tsx node_modules/@revenium/anthropic/examples/getting_started.ts
|
|
58
60
|
npx tsx node_modules/@revenium/anthropic/examples/basic-usage.ts
|
|
59
61
|
npx tsx node_modules/@revenium/anthropic/examples/advanced-features.ts
|
|
60
62
|
```
|
|
61
63
|
|
|
62
64
|
## Available Examples
|
|
63
65
|
|
|
66
|
+
### `getting_started.ts` - Simple Entry Point
|
|
67
|
+
|
|
68
|
+
The simplest example to get you started with Revenium tracking:
|
|
69
|
+
|
|
70
|
+
- **Minimal setup** - Just import, configure, and start tracking
|
|
71
|
+
- **Complete metadata example** - Shows all 11 optional metadata fields
|
|
72
|
+
- **Ready to customize** - Uncomment the metadata section to add tracking context
|
|
73
|
+
|
|
74
|
+
**Key Features:**
|
|
75
|
+
|
|
76
|
+
- Auto-initialization from environment variables
|
|
77
|
+
- Native `usageMetadata` support via module augmentation
|
|
78
|
+
- All metadata fields documented with examples
|
|
79
|
+
- Single API call demonstration
|
|
80
|
+
|
|
81
|
+
**Perfect for:** First-time users, quick validation, understanding metadata structure
|
|
82
|
+
|
|
83
|
+
**See the file for complete code examples.**
|
|
84
|
+
|
|
64
85
|
### `basic-usage.ts` - Initialization Methods
|
|
65
86
|
|
|
66
87
|
Demonstrates the three ways to initialize the Revenium middleware:
|
|
@@ -122,7 +122,7 @@ async function demonstrateAdvancedFeatures(): Promise<void> {
|
|
|
122
122
|
});
|
|
123
123
|
|
|
124
124
|
const stream1 = await anthropic.messages.create({
|
|
125
|
-
model: "claude-
|
|
125
|
+
model: "claude-haiku-4-5",
|
|
126
126
|
max_tokens: 150,
|
|
127
127
|
messages: [
|
|
128
128
|
{
|
|
@@ -187,7 +187,7 @@ async function demonstrateAdvancedFeatures(): Promise<void> {
|
|
|
187
187
|
const now = new Date();
|
|
188
188
|
const trackingData: TrackingData = {
|
|
189
189
|
requestId: `manual_${Date.now()}`,
|
|
190
|
-
model: "claude-
|
|
190
|
+
model: "claude-haiku-4-5",
|
|
191
191
|
inputTokens: 25,
|
|
192
192
|
outputTokens: 150,
|
|
193
193
|
duration: 2500,
|
|
@@ -245,7 +245,7 @@ async function demonstrateAdvancedFeatures(): Promise<void> {
|
|
|
245
245
|
} satisfies UsageMetadata;
|
|
246
246
|
|
|
247
247
|
const stream2 = await anthropic.messages.create({
|
|
248
|
-
model: "claude-
|
|
248
|
+
model: "claude-haiku-4-5",
|
|
249
249
|
max_tokens: 100,
|
|
250
250
|
messages: [
|
|
251
251
|
{
|
|
@@ -296,7 +296,7 @@ async function demonstrateAdvancedFeatures(): Promise<void> {
|
|
|
296
296
|
} satisfies UsageMetadata;
|
|
297
297
|
|
|
298
298
|
const toolStream = await anthropic.messages.create({
|
|
299
|
-
model: "claude-
|
|
299
|
+
model: "claude-haiku-4-5",
|
|
300
300
|
max_tokens: 200,
|
|
301
301
|
tools: [
|
|
302
302
|
{
|
package/examples/basic-usage.ts
CHANGED
|
@@ -52,7 +52,7 @@ async function demonstrateBasicUsage() {
|
|
|
52
52
|
// Example 1: Basic request without metadata (still tracked automatically)
|
|
53
53
|
console.log("Example 1: Basic request without metadata...");
|
|
54
54
|
const basicResponse = await anthropic.messages.create({
|
|
55
|
-
model: "claude-
|
|
55
|
+
model: "claude-haiku-4-5",
|
|
56
56
|
max_tokens: 50,
|
|
57
57
|
messages: [
|
|
58
58
|
{ role: "user", content: "What is the capital of France? Be concise." },
|
|
@@ -73,7 +73,7 @@ async function demonstrateBasicUsage() {
|
|
|
73
73
|
// Example 2: Request with rich metadata for enhanced tracking
|
|
74
74
|
console.log("Example 2: Request with rich metadata...");
|
|
75
75
|
const metadataResponse = await anthropic.messages.create({
|
|
76
|
-
model: "claude-
|
|
76
|
+
model: "claude-haiku-4-5",
|
|
77
77
|
max_tokens: 80,
|
|
78
78
|
messages: [
|
|
79
79
|
{ role: "user", content: "Explain quantum computing in one sentence." },
|
|
@@ -146,7 +146,7 @@ async function demonstrateExplicitInitialization() {
|
|
|
146
146
|
// Now use Anthropic with guaranteed tracking
|
|
147
147
|
const anthropic = new Anthropic();
|
|
148
148
|
const response = await anthropic.messages.create({
|
|
149
|
-
model: "claude-
|
|
149
|
+
model: "claude-haiku-4-5",
|
|
150
150
|
max_tokens: 60,
|
|
151
151
|
messages: [
|
|
152
152
|
{
|
|
@@ -222,7 +222,7 @@ async function demonstrateManualConfiguration() {
|
|
|
222
222
|
});
|
|
223
223
|
|
|
224
224
|
const response = await anthropic.messages.create({
|
|
225
|
-
model: "claude-
|
|
225
|
+
model: "claude-haiku-4-5",
|
|
226
226
|
max_tokens: 80,
|
|
227
227
|
messages: [
|
|
228
228
|
{
|
|
@@ -8,7 +8,7 @@ async function main() {
|
|
|
8
8
|
|
|
9
9
|
// Chat completion with metadata
|
|
10
10
|
const response = await anthropic.messages.create({
|
|
11
|
-
model: 'claude-
|
|
11
|
+
model: 'claude-haiku-4-5',
|
|
12
12
|
max_tokens: 2000,
|
|
13
13
|
messages: [
|
|
14
14
|
{ role: 'user', content: 'Please verify you are ready to assist me.' }
|
package/package.json
CHANGED