@plexor-dev/claude-code-plugin 0.1.0-beta.6 → 0.1.0-beta.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.
@@ -24,49 +24,75 @@ The config file contains:
24
24
 
25
25
  If `apiKey` is missing or empty, tell the user to run `/plexor-login` first.
26
26
 
27
- **Step 3: Call the stats API**
27
+ **Step 3: Call the APIs**
28
28
 
29
- Make a request to get usage statistics:
29
+ First, get user info:
30
30
  ```
31
- GET {apiUrl}/api/users/me/usage
31
+ GET {apiUrl}/v1/user
32
32
  X-Plexor-Key: {apiKey}
33
33
  ```
34
34
 
35
- Note: Use the X-Plexor-Key header with the API key (not Authorization Bearer).
35
+ Then, get usage statistics:
36
+ ```
37
+ GET {apiUrl}/v1/stats
38
+ X-Plexor-Key: {apiKey}
39
+ ```
40
+
41
+ The stats response contains:
42
+ - `summary.total_requests`: number of requests
43
+ - `summary.original_tokens`: tokens before optimization
44
+ - `summary.optimized_tokens`: tokens after optimization
45
+ - `summary.tokens_saved`: tokens saved
46
+ - `summary.tokens_saved_percent`: percentage saved
47
+ - `summary.baseline_cost`: cost without optimization
48
+ - `summary.total_cost`: actual cost
49
+ - `summary.cost_saved`: money saved
50
+ - `summary.cost_saved_percent`: percentage saved
51
+ - `summary.cache_hit_rate`: cache hit rate
52
+ - `period.start` / `period.end`: date range
36
53
 
37
54
  **Step 4: Display the status**
38
55
 
39
- Show the user a formatted status display using this box-style format. Calculate weekly date range (Monday to Sunday of current week):
56
+ Show the user a formatted status display:
40
57
 
41
58
  ```
42
- ┌─────────────────────────────────────────────┐
43
- │ Plexor Status │
44
- ├─────────────────────────────────────────────┤
45
- │ Account: [tier, e.g., "Pro" or "beta"]
46
- │ Email: [email from config]
47
- │ Status: ● Active │
48
- ├─────────────────────────────────────────────┤
49
- │ This Week ([start date] - [end date])
50
- │ ├── Requests: [totalRequests]
51
- │ ├── Tokens saved: [tokensUsed] ([optimizationPercent]%)
52
- │ ├── Avg latency: [avgLatency]ms
53
- └── Savings: $[costSavings]
54
- ├─────────────────────────────────────────────┤
55
- Settings
56
- ├── Optimization: [Enabled/Disabled]
57
- │ ├── Local cache: [Enabled/Disabled] │
58
- ├── Mode: [mode]
59
- │ └── Provider routing: [preferredProvider]
60
- └─────────────────────────────────────────────┘
61
-
62
- Dashboard: [apiUrl base]/dashboard.html
59
+ ┌─────────────────────────────────────────────┐
60
+ │ Plexor Status │
61
+ ├─────────────────────────────────────────────┤
62
+ │ Account: [tier from /v1/user]
63
+ │ Email: [email from /v1/user]
64
+ │ Status: ● Active │
65
+ ├─────────────────────────────────────────────┤
66
+ │ This Week ([period.start] - [period.end])
67
+ │ ├── Requests: [total_requests]
68
+ │ ├── Original tokens: [original_tokens]
69
+ │ ├── Optimized tokens: [optimized_tokens]
70
+ ├── Tokens saved: [tokens_saved] ([tokens_saved_percent]%)
71
+ ├── Baseline cost: $[baseline_cost] │
72
+ ├── Actual cost: $[total_cost]
73
+ └── Cost saved: $[cost_saved] ([cost_saved_percent]%)
74
+ ├─────────────────────────────────────────────┤
75
+ Performance
76
+ │ └── Cache hit rate: [cache_hit_rate]%
77
+ ├─────────────────────────────────────────────┤
78
+ │ Limits │
79
+ ├── Monthly optimizations: [from tier]
80
+ │ └── Monthly completions: [from tier] │
81
+ ├─────────────────────────────────────────────┤
82
+ │ Settings │
83
+ │ ├── Optimization: [Enabled/Disabled] │
84
+ │ ├── Local cache: [Enabled/Disabled] │
85
+ │ ├── Mode: [mode] │
86
+ │ └── Provider routing: [preferredProvider] │
87
+ └─────────────────────────────────────────────┘
88
+
89
+ Dashboard: [apiUrl]/dashboard
63
90
  ```
64
91
 
65
92
  Notes:
66
93
  - Use "● Active" (green dot) if enabled, "○ Inactive" if disabled
67
94
  - Format token counts with commas (e.g., 46,700)
68
95
  - Format costs with 2 decimal places (e.g., $8.02)
69
- - Calculate current week dates dynamically
70
- - Use the apiUrl from config to construct the dashboard link (replace /api with empty string)
96
+ - Multiply cache_hit_rate by 100 for percentage display
71
97
 
72
98
  If the API call fails, show the configuration status and mention the API is unavailable.
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Plexor Claude Code Plugin - Constants
3
+ */
4
+
5
+ const path = require('path');
6
+ const os = require('os');
7
+
8
+ module.exports = {
9
+ // API endpoints
10
+ PLEXOR_API_URL: process.env.PLEXOR_API_URL || 'https://api.plexor.dev',
11
+ PLEXOR_GATEWAY_URL: process.env.PLEXOR_GATEWAY_URL || 'https://api.plexor.dev/v1',
12
+ PLEXOR_AUTH_URL: 'https://plexor.dev/auth/device',
13
+
14
+ // File paths
15
+ PLEXOR_CONFIG_DIR: process.env.PLEXOR_CONFIG_DIR || path.join(os.homedir(), '.plexor'),
16
+ PLEXOR_CONFIG_FILE: path.join(
17
+ process.env.PLEXOR_CONFIG_DIR || path.join(os.homedir(), '.plexor'),
18
+ 'config.json'
19
+ ),
20
+ CLAUDE_COMMANDS_DIR: path.join(os.homedir(), '.claude', 'commands'),
21
+
22
+ // Config schema version
23
+ CONFIG_VERSION: 1,
24
+
25
+ // Default settings
26
+ DEFAULTS: {
27
+ enabled: true,
28
+ preferred_provider: 'auto',
29
+ telemetry: true,
30
+ local_cache: false
31
+ },
32
+
33
+ // API key prefix for identification
34
+ API_KEY_PREFIX: 'plx_',
35
+
36
+ // Timeouts (ms)
37
+ DEVICE_CODE_POLL_INTERVAL: 5000,
38
+ DEVICE_CODE_TIMEOUT: 900000, // 15 minutes
39
+ API_TIMEOUT: 30000
40
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexor-dev/claude-code-plugin",
3
- "version": "0.1.0-beta.6",
3
+ "version": "0.1.0-beta.7",
4
4
  "description": "LLM cost optimization plugin for Claude Code - Save up to 90% on AI costs",
5
5
  "main": "lib/constants.js",
6
6
  "scripts": {