@plexor-dev/claude-code-plugin 0.1.0-beta.25 → 0.1.0-beta.26
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.
|
@@ -90,7 +90,8 @@ function main() {
|
|
|
90
90
|
if (newEnabled) {
|
|
91
91
|
// Enable routing - need API key from config
|
|
92
92
|
if (apiKey) {
|
|
93
|
-
|
|
93
|
+
// Default to staging for now - will change to production later
|
|
94
|
+
const apiUrl = config.settings?.apiUrl || 'https://staging.api.plexor.dev';
|
|
94
95
|
const useStaging = apiUrl.includes('staging');
|
|
95
96
|
routingUpdated = settingsManager.enablePlexorRouting(apiKey, { useStaging });
|
|
96
97
|
} else {
|
package/commands/plexor-login.js
CHANGED
|
@@ -18,7 +18,8 @@ const { settingsManager } = require('../lib/settings-manager');
|
|
|
18
18
|
|
|
19
19
|
const CONFIG_PATH = path.join(process.env.HOME, '.plexor', 'config.json');
|
|
20
20
|
const PLEXOR_DIR = path.join(process.env.HOME, '.plexor');
|
|
21
|
-
|
|
21
|
+
// Default to staging for now - will change to production later
|
|
22
|
+
const DEFAULT_API_URL = 'https://staging.api.plexor.dev';
|
|
22
23
|
|
|
23
24
|
function loadConfig() {
|
|
24
25
|
try {
|
package/commands/plexor-setup.md
CHANGED
|
@@ -31,15 +31,15 @@ Run /plexor-settings to modify configuration.
|
|
|
31
31
|
Run /plexor-enabled off to disable routing.
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
**Step 2: Ask about Claude
|
|
34
|
+
**Step 2: Ask about Claude subscription**
|
|
35
35
|
|
|
36
36
|
Use the AskUserQuestion tool:
|
|
37
37
|
|
|
38
|
-
Question: "
|
|
39
|
-
Header: "
|
|
38
|
+
Question: "How do you pay for Claude usage?"
|
|
39
|
+
Header: "Billing"
|
|
40
40
|
Options:
|
|
41
|
-
1. **
|
|
42
|
-
2. **
|
|
41
|
+
1. **Claude MAX subscription (Pro/Team/Enterprise)** - I have a subscription and want Plexor for optimization & tracking (you'll still need a Plexor API key)
|
|
42
|
+
2. **Pay-per-use via Plexor** - I want Plexor to handle billing and route to the cheapest provider
|
|
43
43
|
|
|
44
44
|
**Step 3A: Claude MAX User Setup**
|
|
45
45
|
|
|
@@ -11,8 +11,30 @@ const https = require('https');
|
|
|
11
11
|
|
|
12
12
|
const CONFIG_PATH = path.join(process.env.HOME, '.plexor', 'config.json');
|
|
13
13
|
const SESSION_PATH = path.join(process.env.HOME, '.plexor', 'session.json');
|
|
14
|
+
const CLAUDE_SETTINGS_PATH = path.join(process.env.HOME, '.claude', 'settings.json');
|
|
14
15
|
const SESSION_TIMEOUT_MS = 30 * 60 * 1000; // 30 minutes
|
|
15
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Check if Claude Code is actually routing through Plexor
|
|
19
|
+
* by reading ~/.claude/settings.json
|
|
20
|
+
*/
|
|
21
|
+
function getRoutingStatus() {
|
|
22
|
+
try {
|
|
23
|
+
const data = fs.readFileSync(CLAUDE_SETTINGS_PATH, 'utf8');
|
|
24
|
+
const settings = JSON.parse(data);
|
|
25
|
+
const baseUrl = settings.env?.ANTHROPIC_BASE_URL || '';
|
|
26
|
+
const hasToken = !!settings.env?.ANTHROPIC_AUTH_TOKEN;
|
|
27
|
+
const isPlexorRouting = baseUrl.includes('plexor') || baseUrl.includes('staging.api');
|
|
28
|
+
return {
|
|
29
|
+
active: isPlexorRouting && hasToken,
|
|
30
|
+
baseUrl,
|
|
31
|
+
isStaging: baseUrl.includes('staging')
|
|
32
|
+
};
|
|
33
|
+
} catch {
|
|
34
|
+
return { active: false, baseUrl: null, isStaging: false };
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
16
38
|
function loadSessionStats() {
|
|
17
39
|
try {
|
|
18
40
|
const data = fs.readFileSync(SESSION_PATH, 'utf8');
|
|
@@ -138,8 +160,13 @@ ${line(`├── Tokens saved: ${sessionTokensSaved} (${sessionTokensSavedPct}%
|
|
|
138
160
|
${line(`└── Cost saved: $${sessionCostSaved}`)}
|
|
139
161
|
` : '';
|
|
140
162
|
|
|
163
|
+
// Get routing status from Claude settings.json
|
|
164
|
+
const routing = getRoutingStatus();
|
|
165
|
+
const routingIndicator = routing.active ? '🟢 PLEXOR MODE: ON' : '🔴 PLEXOR MODE: OFF';
|
|
166
|
+
const envLabel = routing.isStaging ? '(staging)' : '(production)';
|
|
167
|
+
|
|
141
168
|
console.log(` ┌─────────────────────────────────────────────┐
|
|
142
|
-
${line('
|
|
169
|
+
${line(routingIndicator + (routing.active ? ' ' + envLabel : ''))}
|
|
143
170
|
├─────────────────────────────────────────────┤
|
|
144
171
|
${line(`Account: ${tierName}`)}
|
|
145
172
|
${line(`Email: ${email}`)}
|
package/lib/constants.js
CHANGED
|
@@ -11,7 +11,8 @@ const CACHE_PATH = path.join(PLEXOR_DIR, 'cache.json');
|
|
|
11
11
|
|
|
12
12
|
const SESSION_TIMEOUT_MS = 30 * 60 * 1000; // 30 minutes
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// Default to staging for now - will change to production later
|
|
15
|
+
const DEFAULT_API_URL = 'https://staging.api.plexor.dev';
|
|
15
16
|
const DEFAULT_TIMEOUT = 5000;
|
|
16
17
|
|
|
17
18
|
module.exports = {
|
package/lib/settings-manager.js
CHANGED
|
@@ -74,6 +74,8 @@ class ClaudeSettingsManager {
|
|
|
74
74
|
* @returns {boolean} success status
|
|
75
75
|
*/
|
|
76
76
|
enablePlexorRouting(apiKey, options = {}) {
|
|
77
|
+
// Default to staging for now - will change to production later
|
|
78
|
+
// TODO: Auto-detect staging keys (plx_protodemo_*, plx_staging_*) vs production
|
|
77
79
|
const { useStaging = true } = options;
|
|
78
80
|
const apiUrl = useStaging ? PLEXOR_STAGING_URL : PLEXOR_PROD_URL;
|
|
79
81
|
|
package/package.json
CHANGED