@codexapi/codexclaude 2.0.34 → 2.0.36
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/CUSTOMIZATIONS.md +8 -5
- package/README.md +17 -3
- package/bin/codexclaude.js +204 -4
- package/codexclaude.md +34 -11
- package/package.json +2 -2
package/CUSTOMIZATIONS.md
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
## Runtime
|
|
6
6
|
|
|
7
7
|
- Customer-facing app name: `MagnetAPI.org Codex CLI`
|
|
8
|
-
- Local launcher version: `2.0.
|
|
9
|
-
- Bundled official runtime dependency: `@openai/codex@0.
|
|
8
|
+
- Local launcher version: `2.0.36`
|
|
9
|
+
- Bundled official runtime dependency: `@openai/codex@0.152.0-alpha.6`
|
|
10
10
|
- Required install command: `npm install -g @codexapi/codexclaude@latest`
|
|
11
|
-
- Hosted fallback: `npm install -g https://codexapi.pro/downloads/codexapi-codexclaude-2.0.
|
|
11
|
+
- Hosted fallback: `npm install -g https://codexapi.pro/downloads/codexapi-codexclaude-2.0.36.tgz`
|
|
12
12
|
- Bundled runtime version is managed internally and must not be used for customer update prompts.
|
|
13
13
|
- Launcher update checks may call the CodexAPI.pro version endpoint and `@codexapi/codexclaude` npm metadata only.
|
|
14
14
|
- The launcher must never check `@openai/codex` npm metadata or OpenAI GitHub releases for update notices.
|
|
@@ -25,10 +25,12 @@
|
|
|
25
25
|
- Passes unknown commands directly to the bundled runtime after config is applied.
|
|
26
26
|
- Provides `codexclaude changelog` using the managed version endpoint.
|
|
27
27
|
- Does not expose separate `codexclaude status` or `codexclaude usage` commands; wallet information remains a compact pre-launch line.
|
|
28
|
-
- Version `2.0.
|
|
28
|
+
- Version `2.0.36` is forced by the backend minimum version and older clients must show an update-required message.
|
|
29
29
|
- Mandatory updates present a press-Enter `Upgrade Now` action in an interactive terminal, invoke npm with an argument array and no shell interpolation, verify the installed launcher version, use the hosted release if the registry fails or returns a stale version, then relaunch the requested action automatically.
|
|
30
30
|
- The npm package manifest exposes only `codexclaude`, preventing npm from colliding with a native `codex` or `claude` command before postinstall runs.
|
|
31
31
|
- Global installation creates optional `codex` and `claude` aliases only when no existing command is present in the npm prefix or anywhere on `PATH`; native clients must never be overwritten.
|
|
32
|
+
- `codexclaude topup` and `codexclaude /topup` authenticate with the saved System Token, map the six fixed packages to the correct site-specific plan ids, and call only `/api/v1/wallet/stripe/checkout` and `/api/v1/wallet/stripe/confirm`.
|
|
33
|
+
- The top-up flow never asks for or stores card numbers, CVCs, or issuer authentication codes. Stripe's hosted PCI surface owns payment-method collection and any required bank challenge; the launcher waits for idempotent server confirmation and then refreshes the wallet.
|
|
32
34
|
|
|
33
35
|
## Provider Config
|
|
34
36
|
|
|
@@ -65,7 +67,7 @@ Before launching the runtime, the launcher calls `/api/v1/wallet/status`, then `
|
|
|
65
67
|
Expected status line:
|
|
66
68
|
|
|
67
69
|
```text
|
|
68
|
-
MagnetAPI.org Codex CLI v2.0.
|
|
70
|
+
MagnetAPI.org Codex CLI v2.0.36 · GPT-5.6 SOL Extra High · ~/project · Wallet balance $20.00
|
|
69
71
|
Fable 5 is now available in codexclaude, exclusively.
|
|
70
72
|
```
|
|
71
73
|
|
|
@@ -90,3 +92,4 @@ When updating the bundled runtime:
|
|
|
90
92
|
15. Keep bearer username auth and the `X-CodexAPI-*` headers.
|
|
91
93
|
16. Update `README.md`, `CUSTOMIZATIONS.md`, and `codexclaude.md`.
|
|
92
94
|
17. Run syntax checks, temporary-home setup, alias-preservation tests, `npm pack --dry-run`, and endpoint validation before publishing.
|
|
95
|
+
18. Keep CLI top-up payment-method collection on Stripe's hosted surface and preserve checkout/confirm polling plus wallet refresh tests.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
`codexclaude` installs the MagnetAPI.org Codex CLI for customers who want one coding CLI that can use ChatGPT Daybreak Blue, GPT-5.6, GPT-5.6 Terra, GPT-5.6 SOL, GPT-5.6 SOL Max, GPT-5.6 SOL Ultra, ChatGPT-5.5, Opus 5, Opus 4.8, Sonnet 5, or Fable 5 against the same Token Wallet.
|
|
4
4
|
|
|
5
|
-
Version `2.0.
|
|
5
|
+
Version `2.0.36` bundles the exact Codex runtime dependency `@openai/codex@0.152.0-alpha.6` and makes GPT-5.6 SOL with visible Extra High reasoning the default for new or invalid configurations. Existing valid model selections remain unchanged. It preserves the collision-safe updater, platform-native runtime launch, managed account and wallet integration, Full Access defaults, upstream update suppression, and complete model metadata.
|
|
6
6
|
|
|
7
7
|
## Install Or Update
|
|
8
8
|
|
|
@@ -16,7 +16,7 @@ This does not delete local session history. The update replaces the `codexclaude
|
|
|
16
16
|
|
|
17
17
|
The launcher checks CodexAPI.pro's managed version endpoint and the `@codexapi/codexclaude` npm package metadata only. It must never check `@openai/codex` npm metadata or OpenAI GitHub releases for customer update prompts.
|
|
18
18
|
|
|
19
|
-
Version `2.0.
|
|
19
|
+
Version `2.0.36` is enforced as the minimum supported version. A compatible older launcher presents `✨ Update now available`; pressing Enter installs `@codexapi/codexclaude@latest` and relaunches the requested action automatically. If the npm registry install fails, the updater tries the hosted release before asking the user to intervene. Non-interactive terminals print the same npm command instead of hanging for input.
|
|
20
20
|
|
|
21
21
|
## First Login
|
|
22
22
|
|
|
@@ -62,12 +62,25 @@ Show current launcher changes:
|
|
|
62
62
|
codexclaude changelog
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
+
## Top Up From The CLI
|
|
66
|
+
|
|
67
|
+
Start the package selector with either command:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
codexclaude topup
|
|
71
|
+
codexclaude /topup
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
You can also choose a package directly, for example `codexclaude topup 25`. The launcher authenticates with the saved System Token, shows the current wallet, creates a server-authoritative Stripe Checkout session, waits for confirmed payment, and then prints the API Coding Credit added and the refreshed wallet balance.
|
|
75
|
+
|
|
76
|
+
Card numbers, CVCs, and bank authentication challenges are entered only on Stripe's secure payment form. They are never read, logged, or stored by `codexclaude`. The terminal can be left waiting while payment is completed; webhook fulfillment still credits a successful purchase if the terminal is closed.
|
|
77
|
+
|
|
65
78
|
## Startup Status
|
|
66
79
|
|
|
67
80
|
Before launching the coding runtime, the app prints a compact status line like:
|
|
68
81
|
|
|
69
82
|
```text
|
|
70
|
-
MagnetAPI.org Codex CLI v2.0.
|
|
83
|
+
MagnetAPI.org Codex CLI v2.0.36 · GPT-5.6 SOL Extra High · ~/project · Wallet balance $20.00
|
|
71
84
|
Fable 5 is now available in codexclaude, exclusively.
|
|
72
85
|
```
|
|
73
86
|
|
|
@@ -81,5 +94,6 @@ Fable 5 is now available in codexclaude, exclusively.
|
|
|
81
94
|
- A local `~/.codexclaude/model_catalog.json` file so the native `/model` picker lists only the supported MagnetAPI.org Codex CLI choices, including Terra, SOL Max, and SOL Ultra.
|
|
82
95
|
- No default fast service tier. Fast mode is billed only when the user enables it inside the client.
|
|
83
96
|
- Token Wallet balance lookup before launch without exposing separate `status` or `usage` launcher commands.
|
|
97
|
+
- Authenticated `topup` and `/topup` commands using fixed server-authoritative packages, idempotent Stripe fulfillment, and post-payment wallet refresh.
|
|
84
98
|
- Backend-identifying request headers so the API can enforce account and plan rules server-side.
|
|
85
99
|
- Direct platform binary launch so the upstream npm wrapper cannot emit OpenAI update prompts.
|
package/bin/codexclaude.js
CHANGED
|
@@ -12,8 +12,8 @@ import { installSafeCommandAliases } from "../scripts/install-safe-aliases.js";
|
|
|
12
12
|
|
|
13
13
|
const require = createRequire(import.meta.url);
|
|
14
14
|
|
|
15
|
-
const APP_VERSION = "2.0.
|
|
16
|
-
const CODEX_VERSION = "0.
|
|
15
|
+
const APP_VERSION = "2.0.36";
|
|
16
|
+
const CODEX_VERSION = "0.152.0-alpha.6";
|
|
17
17
|
const APP_DISPLAY_NAME = "MagnetAPI.org Codex CLI";
|
|
18
18
|
const DEFAULT_MODEL_ID = "gpt-5.6-sol";
|
|
19
19
|
const DEFAULT_DISPLAY_REASONING_EFFORT = "xhigh";
|
|
@@ -79,6 +79,17 @@ const SUPPORTED_REASONING_LEVELS = [
|
|
|
79
79
|
{ effort: "ultra", description: "GPT-5.6 SOL Ultra visible reasoning mode" },
|
|
80
80
|
];
|
|
81
81
|
|
|
82
|
+
const TOPUP_PACKAGES = [
|
|
83
|
+
{ amount: 5, credit: 50, sharedPlanId: "test", whiteLabelPlanId: "credit-5" },
|
|
84
|
+
{ amount: 10, credit: 100, sharedPlanId: "starter", whiteLabelPlanId: "credit-10" },
|
|
85
|
+
{ amount: 25, credit: 270, sharedPlanId: "pro", whiteLabelPlanId: "credit-25" },
|
|
86
|
+
{ amount: 40, credit: 600, sharedPlanId: "boost", whiteLabelPlanId: "credit-40" },
|
|
87
|
+
{ amount: 65, credit: 1000, sharedPlanId: "vip", whiteLabelPlanId: "credit-65" },
|
|
88
|
+
{ amount: 115, credit: 2000, sharedPlanId: "titan", whiteLabelPlanId: "credit-115" },
|
|
89
|
+
];
|
|
90
|
+
const TOPUP_POLL_INTERVAL_MS = positiveInteger(process.env.CODEXCLAUDE_TOPUP_POLL_INTERVAL_MS, 3000);
|
|
91
|
+
const TOPUP_TIMEOUT_MS = positiveInteger(process.env.CODEXCLAUDE_TOPUP_TIMEOUT_MS, 30 * 60 * 1000);
|
|
92
|
+
|
|
82
93
|
const MODELS = {
|
|
83
94
|
"claude-opus-5": {
|
|
84
95
|
id: "claude-opus-5",
|
|
@@ -179,6 +190,11 @@ async function main() {
|
|
|
179
190
|
await setupFlow();
|
|
180
191
|
return;
|
|
181
192
|
}
|
|
193
|
+
if (["topup", "/topup"].includes(command)) {
|
|
194
|
+
await ensureReady();
|
|
195
|
+
await topupFlow(args[0]);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
182
198
|
if (command === "resume") {
|
|
183
199
|
await ensureReady();
|
|
184
200
|
await runCodex(["resume", "--search", ...args]);
|
|
@@ -203,6 +219,7 @@ Commands:
|
|
|
203
219
|
codexclaude model Select Daybreak Blue, GPT-5.6, Opus 5, Terra, SOL modes, Opus 4.8, Sonnet 5, or Fable 5
|
|
204
220
|
codexclaude changelog Show the latest CodexAPI.pro launcher changes
|
|
205
221
|
codexclaude setup Rewrite ~/.codex/config.toml with Full Access defaults
|
|
222
|
+
codexclaude topup Select an API Coding Credit package and securely complete payment
|
|
206
223
|
codexclaude start Start ${APP_DISPLAY_NAME} with --search
|
|
207
224
|
codexclaude resume Resume the latest coding session with --search
|
|
208
225
|
codexclaude logout Remove saved codexclaude account state
|
|
@@ -386,6 +403,143 @@ async function setupFlow() {
|
|
|
386
403
|
console.log(`Configured ${CODEX_CONFIG_FILE} for ${MODELS[config.model].label} with Full Access, model-specific visible reasoning, and server-managed routing.`);
|
|
387
404
|
}
|
|
388
405
|
|
|
406
|
+
async function topupFlow(packageChoice = "") {
|
|
407
|
+
const config = normalizeConfig(requireConfig());
|
|
408
|
+
const walletBefore = await walletSnapshot(config);
|
|
409
|
+
const topupPackage = await selectTopupPackage(packageChoice);
|
|
410
|
+
const planId = topupPlanId(config, topupPackage);
|
|
411
|
+
const rl = readline.createInterface({ input, output });
|
|
412
|
+
try {
|
|
413
|
+
if (!packageChoice) {
|
|
414
|
+
const answer = (await rl.question(
|
|
415
|
+
`Deposit ${formatUsd(topupPackage.amount)} for ${formatUsd(topupPackage.credit)} API Coding Credit? [Y/n]: `,
|
|
416
|
+
)).trim().toLowerCase();
|
|
417
|
+
if (["n", "no"].includes(answer)) {
|
|
418
|
+
console.log("Top-up cancelled. No payment was created.");
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
} finally {
|
|
423
|
+
rl.close();
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
console.log(`Current wallet balance: ${formatUsd(walletBefore.balance)}`);
|
|
427
|
+
const checkout = await postJsonAuth(
|
|
428
|
+
"/api/v1/wallet/stripe/checkout",
|
|
429
|
+
{ planId },
|
|
430
|
+
config,
|
|
431
|
+
{ timeoutMs: 30000 },
|
|
432
|
+
);
|
|
433
|
+
const checkoutUrl = String(checkout?.checkoutUrl || "").trim();
|
|
434
|
+
const sessionId = String(checkout?.sessionId || "").trim();
|
|
435
|
+
if (!checkoutUrl || !sessionId) {
|
|
436
|
+
throw new Error("Stripe did not return a usable secure Checkout session.");
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
console.log("\nStripe secure payment link:");
|
|
440
|
+
console.log(checkoutUrl);
|
|
441
|
+
console.log(
|
|
442
|
+
"\nComplete the payment on Stripe's secure form. This terminal does not read or store card numbers, CVCs, or bank authentication codes.",
|
|
443
|
+
);
|
|
444
|
+
console.log("Waiting for Stripe to confirm payment. Press Ctrl+C to stop waiting; the webhook will still credit a successful payment.");
|
|
445
|
+
|
|
446
|
+
if (isTruthy(process.env.CODEXCLAUDE_TOPUP_NO_WAIT)) {
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
const confirmed = await waitForTopupConfirmation(config, sessionId);
|
|
450
|
+
const walletAfter = await walletSnapshot(config);
|
|
451
|
+
const confirmedCredit = numericWalletValue(
|
|
452
|
+
confirmed?.payment?.creditAddedUsd ??
|
|
453
|
+
confirmed?.payment?.creditUsd ??
|
|
454
|
+
confirmed?.selectedPlan?.creditUsd,
|
|
455
|
+
);
|
|
456
|
+
const credited = Math.max(0, walletAfter.balance - walletBefore.balance) || confirmedCredit;
|
|
457
|
+
console.log(`\nTop-up complete${confirmed?.alreadyFulfilled ? " (already reconciled)" : ""}.`);
|
|
458
|
+
console.log(`API Coding Credit added: ${formatUsd(credited)}`);
|
|
459
|
+
console.log(`New wallet balance: ${formatUsd(walletAfter.balance)}`);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
async function selectTopupPackage(packageChoice) {
|
|
463
|
+
const normalized = String(packageChoice || "").trim().toLowerCase().replace(/^\$/, "");
|
|
464
|
+
if (normalized) {
|
|
465
|
+
const selected = TOPUP_PACKAGES.find((item, index) =>
|
|
466
|
+
normalized === String(item.amount) ||
|
|
467
|
+
normalized === String(index + 1) ||
|
|
468
|
+
normalized === item.sharedPlanId ||
|
|
469
|
+
normalized === item.whiteLabelPlanId,
|
|
470
|
+
);
|
|
471
|
+
if (!selected) {
|
|
472
|
+
throw new Error("Unknown top-up package. Choose 5, 10, 25, 40, 65, or 115.");
|
|
473
|
+
}
|
|
474
|
+
return selected;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
if (!input.isTTY || !output.isTTY) {
|
|
478
|
+
throw new Error("Choose a package amount: codexclaude topup 5|10|25|40|65|115");
|
|
479
|
+
}
|
|
480
|
+
console.log("\nChoose an API Coding Credit package:");
|
|
481
|
+
TOPUP_PACKAGES.forEach((item, index) => {
|
|
482
|
+
console.log(` ${index + 1}. ${formatUsd(item.amount)} deposit -> ${formatUsd(item.credit)} API Coding Credit`);
|
|
483
|
+
});
|
|
484
|
+
const rl = readline.createInterface({ input, output });
|
|
485
|
+
try {
|
|
486
|
+
const answer = (await rl.question("Package [1]: ")).trim() || "1";
|
|
487
|
+
const selected = TOPUP_PACKAGES.find((item, index) => answer === String(index + 1) || answer === String(item.amount));
|
|
488
|
+
if (!selected) {
|
|
489
|
+
throw new Error("Unknown top-up package. Choose one of the numbered options.");
|
|
490
|
+
}
|
|
491
|
+
return selected;
|
|
492
|
+
} finally {
|
|
493
|
+
rl.close();
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
function topupPlanId(config, topupPackage) {
|
|
498
|
+
return ["myapi", "magnetapi"].includes(config.serviceId)
|
|
499
|
+
? topupPackage.whiteLabelPlanId
|
|
500
|
+
: topupPackage.sharedPlanId;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
async function waitForTopupConfirmation(config, sessionId) {
|
|
504
|
+
const startedAt = Date.now();
|
|
505
|
+
let lastDetail = "Payment is still pending.";
|
|
506
|
+
while (Date.now() - startedAt < TOPUP_TIMEOUT_MS) {
|
|
507
|
+
try {
|
|
508
|
+
const confirmation = await postJsonAuth(
|
|
509
|
+
"/api/v1/wallet/stripe/confirm",
|
|
510
|
+
{ sessionId },
|
|
511
|
+
config,
|
|
512
|
+
{ timeoutMs: 30000 },
|
|
513
|
+
);
|
|
514
|
+
const paymentStatus = String(
|
|
515
|
+
confirmation?.payment?.status ??
|
|
516
|
+
confirmation?.status ??
|
|
517
|
+
"",
|
|
518
|
+
).trim().toLowerCase();
|
|
519
|
+
if (
|
|
520
|
+
confirmation?.credited === true ||
|
|
521
|
+
["paid", "succeeded", "complete", "completed", "fulfilled"].includes(paymentStatus)
|
|
522
|
+
) {
|
|
523
|
+
return {
|
|
524
|
+
...confirmation,
|
|
525
|
+
alreadyFulfilled: confirmation?.credited !== true && paymentStatus === "paid",
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
lastDetail = confirmation?.detail || `Payment is ${paymentStatus || "pending"}.`;
|
|
529
|
+
} catch (error) {
|
|
530
|
+
if (![402, 409, 425].includes(Number(error.status))) {
|
|
531
|
+
throw error;
|
|
532
|
+
}
|
|
533
|
+
lastDetail = error.message || lastDetail;
|
|
534
|
+
}
|
|
535
|
+
await delay(TOPUP_POLL_INTERVAL_MS);
|
|
536
|
+
process.stdout.write(".");
|
|
537
|
+
}
|
|
538
|
+
throw new Error(
|
|
539
|
+
`Payment confirmation timed out. ${lastDetail} A successful Stripe payment will still be credited by the webhook; run codexclaude topup later to view the refreshed balance.`,
|
|
540
|
+
);
|
|
541
|
+
}
|
|
542
|
+
|
|
389
543
|
async function ensureReady() {
|
|
390
544
|
let config = readConfig();
|
|
391
545
|
if (!config?.username) {
|
|
@@ -464,6 +618,7 @@ async function enforceLauncherVersion() {
|
|
|
464
618
|
async function runMandatoryUpgrade(metadata) {
|
|
465
619
|
const latest = metadata?.latestVersion || "latest";
|
|
466
620
|
const minimum = metadata?.minimumVersion || latest;
|
|
621
|
+
const hostedTarballUrl = metadata?.hostedTarballUrl || HOSTED_TARBALL_URL;
|
|
467
622
|
const changes = Array.isArray(metadata?.changes) ? metadata.changes.slice(0, 4) : [];
|
|
468
623
|
console.error(`\n✨ Update now available · ${APP_DISPLAY_NAME} v${latest}`);
|
|
469
624
|
console.error(`${APP_DISPLAY_NAME} v${latest} is required before your next coding session.`);
|
|
@@ -501,13 +656,13 @@ async function runMandatoryUpgrade(metadata) {
|
|
|
501
656
|
console.log(`\nThe npm registry returned v${installedAfterRegistry || "unknown"}, below required v${minimum}.`);
|
|
502
657
|
}
|
|
503
658
|
console.log("\nThe npm registry install did not complete. Trying the hosted release automatically...");
|
|
504
|
-
exitCode = await spawnAndWait(npmCommand, ["install", "-g",
|
|
659
|
+
exitCode = await spawnAndWait(npmCommand, ["install", "-g", hostedTarballUrl]);
|
|
505
660
|
}
|
|
506
661
|
const installedVersion = exitCode === 0 ? installedLauncherVersion() : null;
|
|
507
662
|
if (exitCode !== 0 || isOlderVersion(installedVersion, minimum)) {
|
|
508
663
|
throw new Error(
|
|
509
664
|
`Automatic upgrade failed with exit code ${exitCode} and installed version ${installedVersion || "unknown"}. Run ${UPDATE_COMMAND}. ` +
|
|
510
|
-
`If npm is unavailable, use: ${
|
|
665
|
+
`If npm is unavailable, use: npm install -g ${hostedTarballUrl}`,
|
|
511
666
|
);
|
|
512
667
|
}
|
|
513
668
|
console.log(`\nUpgrade complete. Restarting ${APP_DISPLAY_NAME} now...`);
|
|
@@ -631,6 +786,42 @@ async function getJsonAuth(pathname, config, options = {}) {
|
|
|
631
786
|
}
|
|
632
787
|
}
|
|
633
788
|
|
|
789
|
+
async function postJsonAuth(pathname, body, config, options = {}) {
|
|
790
|
+
const controller = new AbortController();
|
|
791
|
+
const timeoutMs = Number(options.timeoutMs || 10000);
|
|
792
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
793
|
+
timer.unref?.();
|
|
794
|
+
try {
|
|
795
|
+
const response = await fetch(`${config.apiOrigin || API_ORIGIN}${pathname}`, {
|
|
796
|
+
method: "POST",
|
|
797
|
+
headers: {
|
|
798
|
+
"accept": "application/json",
|
|
799
|
+
"authorization": `Bearer ${config.username}`,
|
|
800
|
+
"content-type": "application/json",
|
|
801
|
+
"user-agent": `codexclaude/${APP_VERSION}`,
|
|
802
|
+
},
|
|
803
|
+
body: JSON.stringify(body),
|
|
804
|
+
signal: controller.signal,
|
|
805
|
+
});
|
|
806
|
+
const text = await response.text();
|
|
807
|
+
let payload = null;
|
|
808
|
+
try {
|
|
809
|
+
payload = text ? JSON.parse(text) : null;
|
|
810
|
+
} catch {
|
|
811
|
+
payload = { detail: text };
|
|
812
|
+
}
|
|
813
|
+
if (!response.ok) {
|
|
814
|
+
const error = new Error(payload?.detail || `Request failed with HTTP ${response.status}.`);
|
|
815
|
+
error.status = response.status;
|
|
816
|
+
error.payload = payload;
|
|
817
|
+
throw error;
|
|
818
|
+
}
|
|
819
|
+
return payload;
|
|
820
|
+
} finally {
|
|
821
|
+
clearTimeout(timer);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
|
|
634
825
|
async function tryGetJsonAuth(pathname, config, options = {}) {
|
|
635
826
|
try {
|
|
636
827
|
return await getJsonAuth(pathname, config, options);
|
|
@@ -1259,6 +1450,15 @@ function formatUsd(value) {
|
|
|
1259
1450
|
})}`;
|
|
1260
1451
|
}
|
|
1261
1452
|
|
|
1453
|
+
function positiveInteger(value, fallback) {
|
|
1454
|
+
const parsed = Number(value);
|
|
1455
|
+
return Number.isInteger(parsed) && parsed > 0 ? parsed : fallback;
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
function delay(milliseconds) {
|
|
1459
|
+
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1262
1462
|
function formatCwd(cwd) {
|
|
1263
1463
|
const home = homedir();
|
|
1264
1464
|
if (cwd === home) {
|
package/codexclaude.md
CHANGED
|
@@ -5,12 +5,12 @@ This file is the durable handoff for the `@codexapi/codexclaude` package in `/ro
|
|
|
5
5
|
## Current Release
|
|
6
6
|
|
|
7
7
|
- Package name: `@codexapi/codexclaude`
|
|
8
|
-
- Launcher version: `2.0.
|
|
8
|
+
- Launcher version: `2.0.36`
|
|
9
9
|
- Customer-facing app name: `MagnetAPI.org Codex CLI`
|
|
10
|
-
- Bundled runtime dependency: `@openai/codex@0.
|
|
10
|
+
- Bundled runtime dependency: `@openai/codex@0.152.0-alpha.6`
|
|
11
11
|
- Required install command: `npm install -g @codexapi/codexclaude@latest`
|
|
12
|
-
- Hosted fallback: `npm install -g https://codexapi.pro/downloads/codexapi-codexclaude-2.0.
|
|
13
|
-
- Backend minimum version: `2.0.
|
|
12
|
+
- Hosted fallback: `npm install -g https://codexapi.pro/downloads/codexapi-codexclaude-2.0.36.tgz`
|
|
13
|
+
- Backend minimum version: `2.0.36`
|
|
14
14
|
- Default visible model: `GPT-5.6 SOL`
|
|
15
15
|
- Default model slug: `gpt-5.6-sol`
|
|
16
16
|
- Default visible reasoning effort: `Extra High`, stored as `xhigh`; premium SOL Max and SOL Ultra retain their explicit `max` and `ultra` labels.
|
|
@@ -25,13 +25,13 @@ This file is the durable handoff for the `@codexapi/codexclaude` package in `/ro
|
|
|
25
25
|
The launcher must present itself as:
|
|
26
26
|
|
|
27
27
|
```text
|
|
28
|
-
MagnetAPI.org Codex CLI v2.0.
|
|
28
|
+
MagnetAPI.org Codex CLI v2.0.36
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
Normal pre-launch status should look like:
|
|
32
32
|
|
|
33
33
|
```text
|
|
34
|
-
MagnetAPI.org Codex CLI v2.0.
|
|
34
|
+
MagnetAPI.org Codex CLI v2.0.36 · GPT-5.6 SOL Extra High · ~/project · Wallet balance $20.00
|
|
35
35
|
Fable 5 is now available in codexclaude, exclusively.
|
|
36
36
|
```
|
|
37
37
|
|
|
@@ -60,7 +60,7 @@ GPT-5.6 SOL must be the default when a new config is created or a legacy config
|
|
|
60
60
|
- `https://codexapi.pro/api/v1/codexclaude/version`
|
|
61
61
|
- `https://registry.npmjs.org/@codexapi%2Fcodexclaude/latest`
|
|
62
62
|
|
|
63
|
-
It must not check `@openai/codex` npm metadata, OpenAI GitHub releases, or any upstream OpenAI update endpoint. Version `2.0.
|
|
63
|
+
It must not check `@openai/codex` npm metadata, OpenAI GitHub releases, or any upstream OpenAI update endpoint. Version `2.0.36` is both the enforced minimum and current latest release. Compatible older launchers offer an interactive `Upgrade Now` action; pressing Enter invokes `npm install -g @codexapi/codexclaude@latest` without shell interpolation. If that registry install fails, the launcher automatically tries the hosted tarball. Non-interactive terminals print the exact update command and exit instead of waiting for input. After a successful interactive update, the launcher starts the requested action again automatically.
|
|
64
64
|
|
|
65
65
|
The npm package manifest owns only `codexclaude`. This is deliberate: npm creates manifest binaries before postinstall, so claiming `codex` there causes an `EEXIST` upgrade failure on machines with native Codex CLI. During a global installation, postinstall may create optional `codex` and `claude` aliases only when neither the target npm prefix nor any directory on `PATH` already contains the command. Existing native clients are preserved and no install path requires `--force`.
|
|
66
66
|
|
|
@@ -96,7 +96,7 @@ base_url = "<service Responses URL>"
|
|
|
96
96
|
experimental_bearer_token = "<customer System Token/API username>"
|
|
97
97
|
wire_api = "responses"
|
|
98
98
|
supports_websockets = false
|
|
99
|
-
http_headers = { "X-CodexAPI-Client" = "codexclaude", "X-CodexAPI-Client-Version" = "2.0.
|
|
99
|
+
http_headers = { "X-CodexAPI-Client" = "codexclaude", "X-CodexAPI-Client-Version" = "2.0.36", "X-CodexAPI-Selected-Model" = "<selected model>" }
|
|
100
100
|
|
|
101
101
|
[tui]
|
|
102
102
|
status_line = ["model-with-reasoning", "fast-mode", "current-dir"]
|
|
@@ -124,6 +124,21 @@ The launcher supports CodexAPI.pro, ChatPlus.chat, MyAPI.world, and MagnetAPI.or
|
|
|
124
124
|
|
|
125
125
|
The saved `username` is the System Token/API username returned by the service and is used as the bearer value. Do not store dashboard session tokens in the launcher config.
|
|
126
126
|
|
|
127
|
+
## CLI Top-Up Contract
|
|
128
|
+
|
|
129
|
+
`codexclaude topup` and `codexclaude /topup` expose the six server-authoritative API Coding Credit packages. An amount may be supplied directly, for example `codexclaude topup 25`. CodexAPI.pro and ChatPlus.chat map those amounts to `test`, `starter`, `pro`, `boost`, `vip`, and `titan`; MyAPI.world and MagnetAPI.org map them to `credit-5`, `credit-10`, `credit-25`, `credit-40`, `credit-65`, and `credit-115`.
|
|
130
|
+
|
|
131
|
+
The launcher must:
|
|
132
|
+
|
|
133
|
+
1. Authenticate every wallet, checkout, and confirmation call with the saved System Token.
|
|
134
|
+
2. Show the wallet before checkout.
|
|
135
|
+
3. Call `POST /api/v1/wallet/stripe/checkout` with only the selected server plan id.
|
|
136
|
+
4. Print the returned Stripe-hosted payment URL without launching a browser process.
|
|
137
|
+
5. Poll `POST /api/v1/wallet/stripe/confirm` until the server has confirmed and idempotently fulfilled the payment.
|
|
138
|
+
6. Refresh `/api/v1/wallet/status` and show the credit added plus the new wallet balance.
|
|
139
|
+
|
|
140
|
+
Never collect card numbers, expiry dates, CVCs, or issuer authentication codes through readline, command arguments, environment variables, config files, logs, or model prompts. Stripe-hosted Checkout owns payment-method collection and any 3DS challenge. Closing the terminal must not affect webhook fulfillment of a successful payment.
|
|
141
|
+
|
|
127
142
|
## Routing Expectations
|
|
128
143
|
|
|
129
144
|
The launcher is not the source of truth for upstream runtime routing. Admin Manage Models controls execution routing server-side. The launcher must preserve the user-selected model slug and pass it through the Responses request so billing, logs, and the dashboard can record what the user chose.
|
|
@@ -168,7 +183,7 @@ tmp_home="$(mktemp -d)"
|
|
|
168
183
|
mkdir -p "$tmp_home/.codexclaude"
|
|
169
184
|
cat > "$tmp_home/.codexclaude/config.json" <<'JSON'
|
|
170
185
|
{
|
|
171
|
-
"version": "2.0.
|
|
186
|
+
"version": "2.0.36",
|
|
172
187
|
"serviceId": "codexapi",
|
|
173
188
|
"serviceLabel": "CodexAPI.pro",
|
|
174
189
|
"apiOrigin": "https://codexapi.pro",
|
|
@@ -207,10 +222,18 @@ After packaging, copy the tarball to the public downloads directories, restart t
|
|
|
207
222
|
|
|
208
223
|
```bash
|
|
209
224
|
curl -fsS "https://codexapi.pro/api/v1/codexclaude/version?current=2.0.17"
|
|
210
|
-
curl -fsSI "https://codexapi.pro/downloads/codexapi-codexclaude-2.0.
|
|
225
|
+
curl -fsSI "https://codexapi.pro/downloads/codexapi-codexclaude-2.0.36.tgz"
|
|
211
226
|
```
|
|
212
227
|
|
|
213
|
-
The version endpoint must report `latestVersion = 2.0.
|
|
228
|
+
The version endpoint must report `latestVersion = 2.0.36`, `minimumVersion = 2.0.36`, and `updateRequired = true` for every older client.
|
|
229
|
+
|
|
230
|
+
## Version 2.0.36 Changes
|
|
231
|
+
|
|
232
|
+
- Updated the bundled coding runtime to exact `@openai/codex@0.152.0-alpha.6`.
|
|
233
|
+
- Added authenticated `topup` and `/topup` commands for all four account services and all six fixed API Coding Credit packages.
|
|
234
|
+
- Added Stripe checkout confirmation polling and a refreshed wallet summary after successful payment.
|
|
235
|
+
- Kept card and issuer-authentication data outside the CLI on Stripe's secure payment surface.
|
|
236
|
+
- Made `2.0.36` mandatory while preserving projects, history, login state, model choice, Full Access, and native `codex`/`claude` commands.
|
|
214
237
|
|
|
215
238
|
## Version 2.0.34 Changes
|
|
216
239
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codexapi/codexclaude",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.36",
|
|
4
4
|
"description": "MagnetAPI.org Codex CLI for ChatGPT Daybreak Blue, GPT-5.6, Opus 5, Sonnet 5, and Fable 5.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"node": ">=20"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@openai/codex": "0.
|
|
25
|
+
"@openai/codex": "0.152.0-alpha.6"
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|