@codexapi/codexclaude 2.0.34 → 2.0.37

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 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.34`
9
- - Bundled official runtime dependency: `@openai/codex@0.149.0`
8
+ - Local launcher version: `2.0.37`
9
+ - Bundled official runtime dependency: `@openai/codex@0.153.4`
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.34.tgz`
11
+ - Hosted fallback: `npm install -g https://codexapi.pro/downloads/codexapi-codexclaude-2.0.37.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.34` is forced by the backend minimum version and older clients must show an update-required message.
28
+ - Version `2.0.37` 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
 
@@ -46,17 +48,17 @@ The launcher writes a model provider named `codexapi`:
46
48
  ## Runtime Defaults
47
49
 
48
50
  - Default model: `gpt-5.6-sol` displayed as `GPT-5.6 SOL`
49
- - Supported launcher choices: `gpt-daybreak-blue-latest`, `gpt-5.6`, `gpt-5.6-sol-max`, `gpt-5.6-sol-ultra`, `gpt-5.6-sol`, `gpt-5.5`, `claude-opus-5`, `claude-opus-4-8`, `claude-sonnet-5`, `claude-fable-5`, and `gpt-5.6-terra`
51
+ - Supported launcher choices: `gpt-6-astra`, `gpt-daybreak-blue-latest`, `gpt-5.6`, `gpt-5.6-sol-max`, `gpt-5.6-sol-ultra`, `gpt-5.6-sol`, `gpt-5.5`, `claude-opus-5`, `claude-opus-4-8`, `claude-sonnet-5`, `claude-fable-5`, and `gpt-5.6-terra`
50
52
  - Default reasoning effort displayed locally: `Extra High`, stored as `xhigh`; SOL Max and SOL Ultra retain their explicit premium labels.
51
53
  - Reasoning hint written to managed runtime config: model-specific
52
54
  - Approval policy: `never`
53
55
  - Sandbox mode: `danger-full-access`
54
56
  - Display wording for permissions: `Full Access` in launcher-owned copy
55
- - Local model catalog: `~/.codexclaude/model_catalog.json`; this keeps the native `/model` picker limited to the supported choices and prevents fallback metadata warnings for ChatGPT Daybreak Blue, GPT-5.6 Terra, SOL, SOL Max, SOL Ultra, Opus 5, Opus 4.8, Sonnet 5, and Fable 5.
57
+ - Local model catalog: `~/.codexclaude/model_catalog.json`; this keeps the native `/model` picker limited to the supported choices and prevents fallback metadata warnings for ChatGPT-6 Astra, ChatGPT Daybreak Blue, GPT-5.6 Terra, SOL, SOL Max, SOL Ultra, Opus 5, Opus 4.8, Sonnet 5, and Fable 5.
56
58
  - Service tier: omitted by default; `/fast` remains user-controlled and billed server-side when active.
57
59
  - TUI status line: `model-with-reasoning`, `fast-mode`, `current-dir`
58
60
  - Fable 5 stays visible to the user while the backend applies its server-managed route and billing policy.
59
- - Premium model billing remains server-managed and is not rendered in the customer model picker or model descriptions.
61
+ - Premium model billing remains server-managed. ChatGPT-6 Astra is the explicit exception: its native signed-in 2x usage notice is printed when the user selects it, without injecting billing text into a model prompt or assistant output.
60
62
 
61
63
  ## Wallet Display
62
64
 
@@ -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.34 · GPT-5.6 SOL Extra High · ~/project · Wallet balance $20.00
70
+ MagnetAPI.org Codex CLI v2.0.37 · 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
 
@@ -86,7 +88,8 @@ When updating the bundled runtime:
86
88
  11. Keep update checks limited to `/api/v1/codexclaude/version` and `@codexapi/codexclaude` npm metadata.
87
89
  12. Keep the interactive `Upgrade Now` flow installing `@codexapi/codexclaude@latest` without a shell and relaunching automatically.
88
90
  13. Keep `codexclaude` as the only manifest-owned command and preserve the conditional, non-overwriting `codex` and `claude` postinstall aliases.
89
- 14. Keep the managed `MODELS` map and local model catalog, including Terra, SOL Max, and SOL Ultra.
91
+ 14. Keep the managed `MODELS` map and local model catalog, including Astra, Terra, SOL Max, and SOL Ultra.
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
@@ -1,8 +1,8 @@
1
1
  # codexclaude
2
2
 
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.
3
+ `codexclaude` installs the MagnetAPI.org Codex CLI for customers who want one coding CLI that can use ChatGPT-6 Astra, 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.34` bundles the official Codex runtime dependency `@openai/codex@0.149.0` 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.
5
+ Version `2.0.37` bundles the exact Codex runtime dependency `@openai/codex@0.153.4` and adds ChatGPT-6 Astra with its supported reasoning levels and complete model metadata. GPT-5.6 SOL with visible Extra High reasoning remains the default for new or invalid configurations, and existing valid model selections remain unchanged. The release preserves the collision-safe updater, platform-native runtime launch, managed account and wallet integration, Full Access defaults, upstream update suppression, and every MagnetAPI customization.
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.34` 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.
19
+ Version `2.0.37` 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
 
@@ -44,7 +44,7 @@ Switch model:
44
44
  codexclaude model
45
45
  ```
46
46
 
47
- Available model labels are `ChatGPT Daybreak Blue`, `GPT-5.6`, `GPT-5.6 SOL Max`, `GPT-5.6 SOL Ultra`, `GPT-5.6 SOL`, `ChatGPT-5.5`, `Opus 5`, `Opus 4.8`, `Sonnet 5`, `Fable 5`, and `GPT-5.6 Terra`. All models use a Responses-compatible endpoint and the same customer Token Wallet.
47
+ Available model labels are `ChatGPT-6 Astra`, `ChatGPT Daybreak Blue`, `GPT-5.6`, `GPT-5.6 SOL Max`, `GPT-5.6 SOL Ultra`, `GPT-5.6 SOL`, `ChatGPT-5.5`, `Opus 5`, `Opus 4.8`, `Sonnet 5`, `Fable 5`, and `GPT-5.6 Terra`. All models use a Responses-compatible endpoint and the same customer Token Wallet. Selecting ChatGPT-6 Astra displays its billing notice before the choice is saved; native signed-in Astra usage is charged at 2x the normal Codex rate, while managed cross-model execution follows that route's normal billing.
48
48
 
49
49
  ## Launch Commands
50
50
 
@@ -62,24 +62,38 @@ 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.34 · GPT-5.6 SOL Extra High · ~/project · Wallet balance $20.00
83
+ MagnetAPI.org Codex CLI v2.0.37 · 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
 
74
87
  ## Preserved Customizations
75
88
 
76
89
  - Dashboard Username or Email Address plus password login for CodexAPI.pro, ChatPlus.chat, MyAPI.world, and MagnetAPI.org.
77
- - ChatGPT Daybreak Blue, Opus 5, GPT-5.6, GPT-5.6 Terra, GPT-5.6 SOL Max, GPT-5.6 SOL Ultra, GPT-5.6 SOL, ChatGPT-5.5, Opus 4.8, Sonnet 5, or Fable 5 model selection, with GPT-5.6 SOL/Extra High as the default.
90
+ - ChatGPT-6 Astra, ChatGPT Daybreak Blue, Opus 5, GPT-5.6, GPT-5.6 Terra, GPT-5.6 SOL Max, GPT-5.6 SOL Ultra, GPT-5.6 SOL, ChatGPT-5.5, Opus 4.8, Sonnet 5, or Fable 5 model selection, with GPT-5.6 SOL/Extra High as the default.
78
91
  - Service-specific Responses-compatible provider for the dashboard account that logged in.
79
92
  - Full Access defaults: approval policy `never` and sandbox mode `danger-full-access`.
80
93
  - Model-specific visible reasoning in the local UI while the API server keeps upstream runtime effort server-managed.
81
- - 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.
94
+ - A local `~/.codexclaude/model_catalog.json` file so the native `/model` picker lists only the supported MagnetAPI.org Codex CLI choices, including Astra, 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.
@@ -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.34";
16
- const CODEX_VERSION = "0.149.0";
15
+ const APP_VERSION = "2.0.37";
16
+ const CODEX_VERSION = "0.153.4";
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",
@@ -142,6 +153,16 @@ const MODELS = {
142
153
  aliases: ["11", "terra", "gpt-5.6-terra", "gpt56-terra"],
143
154
  reasoningEffort: "xhigh",
144
155
  },
156
+ "gpt-6-astra": {
157
+ id: "gpt-6-astra",
158
+ label: "ChatGPT-6 Astra",
159
+ aliases: ["12", "astra", "gpt-6", "gpt-6-astra", "gpt6-astra", "chatgpt-6-astra"],
160
+ reasoningEffort: "xhigh",
161
+ contextWindow: 1050000,
162
+ maxOutputTokens: 128000,
163
+ premium: true,
164
+ supportedReasoningLevels: SUPPORTED_REASONING_LEVELS.filter(({ effort }) => effort !== "ultra"),
165
+ },
145
166
  };
146
167
 
147
168
  async function main() {
@@ -179,6 +200,11 @@ async function main() {
179
200
  await setupFlow();
180
201
  return;
181
202
  }
203
+ if (["topup", "/topup"].includes(command)) {
204
+ await ensureReady();
205
+ await topupFlow(args[0]);
206
+ return;
207
+ }
182
208
  if (command === "resume") {
183
209
  await ensureReady();
184
210
  await runCodex(["resume", "--search", ...args]);
@@ -200,9 +226,10 @@ ${APP_DISPLAY_NAME} v${APP_VERSION}
200
226
 
201
227
  Commands:
202
228
  codexclaude login Login with dashboard username/email and password
203
- codexclaude model Select Daybreak Blue, GPT-5.6, Opus 5, Terra, SOL modes, Opus 4.8, Sonnet 5, or Fable 5
229
+ codexclaude model Select GPT-6 Astra, Daybreak Blue, GPT-5.6, Opus 5, Terra, SOL modes, Opus 4.8, Sonnet 5, or Fable 5
204
230
  codexclaude changelog Show the latest CodexAPI.pro launcher changes
205
231
  codexclaude setup Rewrite ~/.codex/config.toml with Full Access defaults
232
+ codexclaude topup Select an API Coding Credit package and securely complete payment
206
233
  codexclaude start Start ${APP_DISPLAY_NAME} with --search
207
234
  codexclaude resume Resume the latest coding session with --search
208
235
  codexclaude logout Remove saved codexclaude account state
@@ -386,6 +413,143 @@ async function setupFlow() {
386
413
  console.log(`Configured ${CODEX_CONFIG_FILE} for ${MODELS[config.model].label} with Full Access, model-specific visible reasoning, and server-managed routing.`);
387
414
  }
388
415
 
416
+ async function topupFlow(packageChoice = "") {
417
+ const config = normalizeConfig(requireConfig());
418
+ const walletBefore = await walletSnapshot(config);
419
+ const topupPackage = await selectTopupPackage(packageChoice);
420
+ const planId = topupPlanId(config, topupPackage);
421
+ const rl = readline.createInterface({ input, output });
422
+ try {
423
+ if (!packageChoice) {
424
+ const answer = (await rl.question(
425
+ `Deposit ${formatUsd(topupPackage.amount)} for ${formatUsd(topupPackage.credit)} API Coding Credit? [Y/n]: `,
426
+ )).trim().toLowerCase();
427
+ if (["n", "no"].includes(answer)) {
428
+ console.log("Top-up cancelled. No payment was created.");
429
+ return;
430
+ }
431
+ }
432
+ } finally {
433
+ rl.close();
434
+ }
435
+
436
+ console.log(`Current wallet balance: ${formatUsd(walletBefore.balance)}`);
437
+ const checkout = await postJsonAuth(
438
+ "/api/v1/wallet/stripe/checkout",
439
+ { planId },
440
+ config,
441
+ { timeoutMs: 30000 },
442
+ );
443
+ const checkoutUrl = String(checkout?.checkoutUrl || "").trim();
444
+ const sessionId = String(checkout?.sessionId || "").trim();
445
+ if (!checkoutUrl || !sessionId) {
446
+ throw new Error("Stripe did not return a usable secure Checkout session.");
447
+ }
448
+
449
+ console.log("\nStripe secure payment link:");
450
+ console.log(checkoutUrl);
451
+ console.log(
452
+ "\nComplete the payment on Stripe's secure form. This terminal does not read or store card numbers, CVCs, or bank authentication codes.",
453
+ );
454
+ console.log("Waiting for Stripe to confirm payment. Press Ctrl+C to stop waiting; the webhook will still credit a successful payment.");
455
+
456
+ if (isTruthy(process.env.CODEXCLAUDE_TOPUP_NO_WAIT)) {
457
+ return;
458
+ }
459
+ const confirmed = await waitForTopupConfirmation(config, sessionId);
460
+ const walletAfter = await walletSnapshot(config);
461
+ const confirmedCredit = numericWalletValue(
462
+ confirmed?.payment?.creditAddedUsd ??
463
+ confirmed?.payment?.creditUsd ??
464
+ confirmed?.selectedPlan?.creditUsd,
465
+ );
466
+ const credited = Math.max(0, walletAfter.balance - walletBefore.balance) || confirmedCredit;
467
+ console.log(`\nTop-up complete${confirmed?.alreadyFulfilled ? " (already reconciled)" : ""}.`);
468
+ console.log(`API Coding Credit added: ${formatUsd(credited)}`);
469
+ console.log(`New wallet balance: ${formatUsd(walletAfter.balance)}`);
470
+ }
471
+
472
+ async function selectTopupPackage(packageChoice) {
473
+ const normalized = String(packageChoice || "").trim().toLowerCase().replace(/^\$/, "");
474
+ if (normalized) {
475
+ const selected = TOPUP_PACKAGES.find((item, index) =>
476
+ normalized === String(item.amount) ||
477
+ normalized === String(index + 1) ||
478
+ normalized === item.sharedPlanId ||
479
+ normalized === item.whiteLabelPlanId,
480
+ );
481
+ if (!selected) {
482
+ throw new Error("Unknown top-up package. Choose 5, 10, 25, 40, 65, or 115.");
483
+ }
484
+ return selected;
485
+ }
486
+
487
+ if (!input.isTTY || !output.isTTY) {
488
+ throw new Error("Choose a package amount: codexclaude topup 5|10|25|40|65|115");
489
+ }
490
+ console.log("\nChoose an API Coding Credit package:");
491
+ TOPUP_PACKAGES.forEach((item, index) => {
492
+ console.log(` ${index + 1}. ${formatUsd(item.amount)} deposit -> ${formatUsd(item.credit)} API Coding Credit`);
493
+ });
494
+ const rl = readline.createInterface({ input, output });
495
+ try {
496
+ const answer = (await rl.question("Package [1]: ")).trim() || "1";
497
+ const selected = TOPUP_PACKAGES.find((item, index) => answer === String(index + 1) || answer === String(item.amount));
498
+ if (!selected) {
499
+ throw new Error("Unknown top-up package. Choose one of the numbered options.");
500
+ }
501
+ return selected;
502
+ } finally {
503
+ rl.close();
504
+ }
505
+ }
506
+
507
+ function topupPlanId(config, topupPackage) {
508
+ return ["myapi", "magnetapi"].includes(config.serviceId)
509
+ ? topupPackage.whiteLabelPlanId
510
+ : topupPackage.sharedPlanId;
511
+ }
512
+
513
+ async function waitForTopupConfirmation(config, sessionId) {
514
+ const startedAt = Date.now();
515
+ let lastDetail = "Payment is still pending.";
516
+ while (Date.now() - startedAt < TOPUP_TIMEOUT_MS) {
517
+ try {
518
+ const confirmation = await postJsonAuth(
519
+ "/api/v1/wallet/stripe/confirm",
520
+ { sessionId },
521
+ config,
522
+ { timeoutMs: 30000 },
523
+ );
524
+ const paymentStatus = String(
525
+ confirmation?.payment?.status ??
526
+ confirmation?.status ??
527
+ "",
528
+ ).trim().toLowerCase();
529
+ if (
530
+ confirmation?.credited === true ||
531
+ ["paid", "succeeded", "complete", "completed", "fulfilled"].includes(paymentStatus)
532
+ ) {
533
+ return {
534
+ ...confirmation,
535
+ alreadyFulfilled: confirmation?.credited !== true && paymentStatus === "paid",
536
+ };
537
+ }
538
+ lastDetail = confirmation?.detail || `Payment is ${paymentStatus || "pending"}.`;
539
+ } catch (error) {
540
+ if (![402, 409, 425].includes(Number(error.status))) {
541
+ throw error;
542
+ }
543
+ lastDetail = error.message || lastDetail;
544
+ }
545
+ await delay(TOPUP_POLL_INTERVAL_MS);
546
+ process.stdout.write(".");
547
+ }
548
+ throw new Error(
549
+ `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.`,
550
+ );
551
+ }
552
+
389
553
  async function ensureReady() {
390
554
  let config = readConfig();
391
555
  if (!config?.username) {
@@ -405,15 +569,28 @@ async function askModel(rl, current) {
405
569
  });
406
570
  const answer = (await rl.question(`Model [${currentLabel}]: `)).trim().toLowerCase();
407
571
  if (!answer) {
408
- return MODELS[current] ? current : DEFAULT_MODEL_ID;
572
+ const selected = MODELS[current] ? current : DEFAULT_MODEL_ID;
573
+ printModelSelectionWarning(selected);
574
+ return selected;
409
575
  }
410
576
  const match = Object.values(MODELS).find((model) => model.aliases.includes(answer));
411
577
  if (!match) {
412
578
  throw new Error("Unknown model choice. Run codexclaude model and choose one of the numbered options.");
413
579
  }
580
+ printModelSelectionWarning(match.id);
414
581
  return match.id;
415
582
  }
416
583
 
584
+ function printModelSelectionWarning(modelId) {
585
+ if (modelId !== "gpt-6-astra") {
586
+ return;
587
+ }
588
+ console.log(
589
+ "\nBilling notice: Native ChatGPT-6 Astra usage is charged at 2x the normal Codex rate. " +
590
+ "When the managed cross-model route serves the request, that route's normal billing applies.",
591
+ );
592
+ }
593
+
417
594
  async function postJson(pathname, body, origin = API_ORIGIN) {
418
595
  const response = await fetch(`${String(origin || API_ORIGIN).replace(/\/+$/, "")}${pathname}`, {
419
596
  method: "POST",
@@ -464,6 +641,7 @@ async function enforceLauncherVersion() {
464
641
  async function runMandatoryUpgrade(metadata) {
465
642
  const latest = metadata?.latestVersion || "latest";
466
643
  const minimum = metadata?.minimumVersion || latest;
644
+ const hostedTarballUrl = metadata?.hostedTarballUrl || HOSTED_TARBALL_URL;
467
645
  const changes = Array.isArray(metadata?.changes) ? metadata.changes.slice(0, 4) : [];
468
646
  console.error(`\n✨ Update now available · ${APP_DISPLAY_NAME} v${latest}`);
469
647
  console.error(`${APP_DISPLAY_NAME} v${latest} is required before your next coding session.`);
@@ -501,13 +679,13 @@ async function runMandatoryUpgrade(metadata) {
501
679
  console.log(`\nThe npm registry returned v${installedAfterRegistry || "unknown"}, below required v${minimum}.`);
502
680
  }
503
681
  console.log("\nThe npm registry install did not complete. Trying the hosted release automatically...");
504
- exitCode = await spawnAndWait(npmCommand, ["install", "-g", HOSTED_TARBALL_URL]);
682
+ exitCode = await spawnAndWait(npmCommand, ["install", "-g", hostedTarballUrl]);
505
683
  }
506
684
  const installedVersion = exitCode === 0 ? installedLauncherVersion() : null;
507
685
  if (exitCode !== 0 || isOlderVersion(installedVersion, minimum)) {
508
686
  throw new Error(
509
687
  `Automatic upgrade failed with exit code ${exitCode} and installed version ${installedVersion || "unknown"}. Run ${UPDATE_COMMAND}. ` +
510
- `If npm is unavailable, use: ${HOSTED_UPDATE_COMMAND}`,
688
+ `If npm is unavailable, use: npm install -g ${hostedTarballUrl}`,
511
689
  );
512
690
  }
513
691
  console.log(`\nUpgrade complete. Restarting ${APP_DISPLAY_NAME} now...`);
@@ -631,6 +809,42 @@ async function getJsonAuth(pathname, config, options = {}) {
631
809
  }
632
810
  }
633
811
 
812
+ async function postJsonAuth(pathname, body, config, options = {}) {
813
+ const controller = new AbortController();
814
+ const timeoutMs = Number(options.timeoutMs || 10000);
815
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
816
+ timer.unref?.();
817
+ try {
818
+ const response = await fetch(`${config.apiOrigin || API_ORIGIN}${pathname}`, {
819
+ method: "POST",
820
+ headers: {
821
+ "accept": "application/json",
822
+ "authorization": `Bearer ${config.username}`,
823
+ "content-type": "application/json",
824
+ "user-agent": `codexclaude/${APP_VERSION}`,
825
+ },
826
+ body: JSON.stringify(body),
827
+ signal: controller.signal,
828
+ });
829
+ const text = await response.text();
830
+ let payload = null;
831
+ try {
832
+ payload = text ? JSON.parse(text) : null;
833
+ } catch {
834
+ payload = { detail: text };
835
+ }
836
+ if (!response.ok) {
837
+ const error = new Error(payload?.detail || `Request failed with HTTP ${response.status}.`);
838
+ error.status = response.status;
839
+ error.payload = payload;
840
+ throw error;
841
+ }
842
+ return payload;
843
+ } finally {
844
+ clearTimeout(timer);
845
+ }
846
+ }
847
+
634
848
  async function tryGetJsonAuth(pathname, config, options = {}) {
635
849
  try {
636
850
  return await getJsonAuth(pathname, config, options);
@@ -800,8 +1014,9 @@ function modelCatalogEntry(model, index) {
800
1014
  supports_image_detail_original: true,
801
1015
  truncation_policy: { mode: "tokens", limit: 10000 },
802
1016
  supports_parallel_tool_calls: true,
803
- context_window: MODEL_CATALOG_CONTEXT_WINDOW,
804
- max_context_window: MODEL_CATALOG_CONTEXT_WINDOW,
1017
+ context_window: model.contextWindow || MODEL_CATALOG_CONTEXT_WINDOW,
1018
+ max_context_window: model.contextWindow || MODEL_CATALOG_CONTEXT_WINDOW,
1019
+ max_output_tokens: model.maxOutputTokens || null,
805
1020
  auto_compact_token_limit: null,
806
1021
  reasoning_summary_format: "experimental",
807
1022
  default_reasoning_summary: "none",
@@ -809,7 +1024,7 @@ function modelCatalogEntry(model, index) {
809
1024
  display_name: model.label,
810
1025
  description: modelCatalogDescription(model.id),
811
1026
  default_reasoning_level: reasoningEffortForModel(model.id),
812
- supported_reasoning_levels: SUPPORTED_REASONING_LEVELS,
1027
+ supported_reasoning_levels: model.supportedReasoningLevels || SUPPORTED_REASONING_LEVELS,
813
1028
  shell_type: "shell_command",
814
1029
  visibility: "list",
815
1030
  minimal_client_version: "0.124.0",
@@ -828,6 +1043,9 @@ function modelCatalogEntry(model, index) {
828
1043
  }
829
1044
 
830
1045
  function modelCatalogDescription(modelId) {
1046
+ if (modelId === "gpt-6-astra") {
1047
+ return "ChatGPT-6 Astra coding route with local coding tools, configurable reasoning, and wallet billing.";
1048
+ }
831
1049
  if (modelId === "gpt-5.6") {
832
1050
  return "GPT-5.6 coding route with local coding tools and wallet billing.";
833
1051
  }
@@ -1064,6 +1282,9 @@ function formatStatusLine(config, wallet, cwd) {
1064
1282
  }
1065
1283
 
1066
1284
  function modelStatusName(model) {
1285
+ if (model === "gpt-6-astra") {
1286
+ return "ChatGPT-6 Astra";
1287
+ }
1067
1288
  if (model === "gpt-5.6") {
1068
1289
  return "GPT-5.6";
1069
1290
  }
@@ -1259,6 +1480,15 @@ function formatUsd(value) {
1259
1480
  })}`;
1260
1481
  }
1261
1482
 
1483
+ function positiveInteger(value, fallback) {
1484
+ const parsed = Number(value);
1485
+ return Number.isInteger(parsed) && parsed > 0 ? parsed : fallback;
1486
+ }
1487
+
1488
+ function delay(milliseconds) {
1489
+ return new Promise((resolve) => setTimeout(resolve, milliseconds));
1490
+ }
1491
+
1262
1492
  function formatCwd(cwd) {
1263
1493
  const home = homedir();
1264
1494
  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.34`
8
+ - Launcher version: `2.0.37`
9
9
  - Customer-facing app name: `MagnetAPI.org Codex CLI`
10
- - Bundled runtime dependency: `@openai/codex@0.149.0`
10
+ - Bundled runtime dependency: `@openai/codex@0.153.4`
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.34.tgz`
13
- - Backend minimum version: `2.0.34`
12
+ - Hosted fallback: `npm install -g https://codexapi.pro/downloads/codexapi-codexclaude-2.0.37.tgz`
13
+ - Backend minimum version: `2.0.37`
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.34
28
+ MagnetAPI.org Codex CLI v2.0.37
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 · GPT-5.6 SOL Extra High · ~/project · Wallet balance $20.00
34
+ MagnetAPI.org Codex CLI v2.0.37 · 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
 
@@ -50,6 +50,9 @@ The launcher command `codexclaude model` must list these customer-visible models
50
50
  - `claude-sonnet-5` displayed as `Sonnet 5`
51
51
  - `claude-fable-5` displayed as `Fable 5`
52
52
  - `gpt-5.6-terra` displayed as `GPT-5.6 Terra`
53
+ - `gpt-6-astra` displayed as `ChatGPT-6 Astra`
54
+
55
+ ChatGPT-6 Astra supports `low`, `medium`, `high`, `xhigh`, and `max` reasoning in the managed catalog, with a 1,050,000-token context window and 128,000 maximum output tokens. The launcher displays a billing notice when Astra is selected. Native signed-in Astra usage is charged at 2x the normal Codex rate; when the dedicated Astra route follows Global Cross-Model Routing, normal billing for that route applies.
53
56
 
54
57
  GPT-5.6 SOL must be the default when a new config is created or a legacy config contains an unsupported model value. It is displayed as Extra High while the generated runtime config stores `xhigh`. A valid existing customer selection must remain unchanged across upgrades. The selected model slug must stay in `~/.codex/config.toml`; do not rewrite customer-facing model selections locally. `gpt-5.6-sol-max` and `gpt-5.6-sol-ultra` remain distinct for customer choice, usage display, and wallet billing.
55
58
 
@@ -60,7 +63,7 @@ GPT-5.6 SOL must be the default when a new config is created or a legacy config
60
63
  - `https://codexapi.pro/api/v1/codexclaude/version`
61
64
  - `https://registry.npmjs.org/@codexapi%2Fcodexclaude/latest`
62
65
 
63
- It must not check `@openai/codex` npm metadata, OpenAI GitHub releases, or any upstream OpenAI update endpoint. Version `2.0.34` 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.
66
+ It must not check `@openai/codex` npm metadata, OpenAI GitHub releases, or any upstream OpenAI update endpoint. Version `2.0.37` 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
67
 
65
68
  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
69
 
@@ -96,7 +99,7 @@ base_url = "<service Responses URL>"
96
99
  experimental_bearer_token = "<customer System Token/API username>"
97
100
  wire_api = "responses"
98
101
  supports_websockets = false
99
- http_headers = { "X-CodexAPI-Client" = "codexclaude", "X-CodexAPI-Client-Version" = "2.0.34", "X-CodexAPI-Selected-Model" = "<selected model>" }
102
+ http_headers = { "X-CodexAPI-Client" = "codexclaude", "X-CodexAPI-Client-Version" = "2.0.37", "X-CodexAPI-Selected-Model" = "<selected model>" }
100
103
 
101
104
  [tui]
102
105
  status_line = ["model-with-reasoning", "fast-mode", "current-dir"]
@@ -104,7 +107,7 @@ status_line_use_colors = true
104
107
  terminal_title = ["project-name", "model-with-reasoning", "run-state"]
105
108
  ```
106
109
 
107
- The generated model catalog must contain full metadata for every supported slug, including `gpt-daybreak-blue-latest`, `gpt-5.6`, `gpt-5.6-terra`, `gpt-5.6-sol-max`, and `gpt-5.6-sol-ultra`. This prevents fallback metadata warnings such as:
110
+ The generated model catalog must contain full metadata for every supported slug, including `gpt-6-astra`, `gpt-daybreak-blue-latest`, `gpt-5.6`, `gpt-5.6-terra`, `gpt-5.6-sol-max`, and `gpt-5.6-sol-ultra`. This prevents fallback metadata warnings such as:
108
111
 
109
112
  ```text
110
113
  Model metadata for `claude-opus-4-8` not found. Defaulting to fallback metadata; this can degrade performance and cause issues.
@@ -124,6 +127,21 @@ The launcher supports CodexAPI.pro, ChatPlus.chat, MyAPI.world, and MagnetAPI.or
124
127
 
125
128
  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
129
 
130
+ ## CLI Top-Up Contract
131
+
132
+ `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`.
133
+
134
+ The launcher must:
135
+
136
+ 1. Authenticate every wallet, checkout, and confirmation call with the saved System Token.
137
+ 2. Show the wallet before checkout.
138
+ 3. Call `POST /api/v1/wallet/stripe/checkout` with only the selected server plan id.
139
+ 4. Print the returned Stripe-hosted payment URL without launching a browser process.
140
+ 5. Poll `POST /api/v1/wallet/stripe/confirm` until the server has confirmed and idempotently fulfilled the payment.
141
+ 6. Refresh `/api/v1/wallet/status` and show the credit added plus the new wallet balance.
142
+
143
+ 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.
144
+
127
145
  ## Routing Expectations
128
146
 
129
147
  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 +186,7 @@ tmp_home="$(mktemp -d)"
168
186
  mkdir -p "$tmp_home/.codexclaude"
169
187
  cat > "$tmp_home/.codexclaude/config.json" <<'JSON'
170
188
  {
171
- "version": "2.0.34",
189
+ "version": "2.0.37",
172
190
  "serviceId": "codexapi",
173
191
  "serviceLabel": "CodexAPI.pro",
174
192
  "apiOrigin": "https://codexapi.pro",
@@ -207,10 +225,26 @@ After packaging, copy the tarball to the public downloads directories, restart t
207
225
 
208
226
  ```bash
209
227
  curl -fsS "https://codexapi.pro/api/v1/codexclaude/version?current=2.0.17"
210
- curl -fsSI "https://codexapi.pro/downloads/codexapi-codexclaude-2.0.34.tgz"
228
+ curl -fsSI "https://codexapi.pro/downloads/codexapi-codexclaude-2.0.37.tgz"
211
229
  ```
212
230
 
213
- The version endpoint must report `latestVersion = 2.0.34`, `minimumVersion = 2.0.34`, and `updateRequired = true` for every older client.
231
+ The version endpoint must report `latestVersion = 2.0.37`, `minimumVersion = 2.0.37`, and `updateRequired = true` for every older client.
232
+
233
+ ## Version 2.0.37 Changes
234
+
235
+ - Updated the bundled coding runtime to exact `@openai/codex@0.153.4`.
236
+ - Added ChatGPT-6 Astra with complete context, output, image, search, tool, and reasoning metadata.
237
+ - Added a model-selection warning for Astra's native signed-in 2x usage rate while keeping cross-model billing route-aware.
238
+ - Preserved all MagnetAPI account login, wallet, top-up, Full Access, safe-alias, update, and model-selection customizations.
239
+ - Made `2.0.37` mandatory after npm and the hosted fallback package become available.
240
+
241
+ ## Version 2.0.36 Changes
242
+
243
+ - Updated the bundled coding runtime to exact `@openai/codex@0.152.0-alpha.6`.
244
+ - Added authenticated `topup` and `/topup` commands for all four account services and all six fixed API Coding Credit packages.
245
+ - Added Stripe checkout confirmation polling and a refreshed wallet summary after successful payment.
246
+ - Kept card and issuer-authentication data outside the CLI on Stripe's secure payment surface.
247
+ - Made `2.0.36` mandatory while preserving projects, history, login state, model choice, Full Access, and native `codex`/`claude` commands.
214
248
 
215
249
  ## Version 2.0.34 Changes
216
250
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@codexapi/codexclaude",
3
- "version": "2.0.34",
4
- "description": "MagnetAPI.org Codex CLI for ChatGPT Daybreak Blue, GPT-5.6, Opus 5, Sonnet 5, and Fable 5.",
3
+ "version": "2.0.37",
4
+ "description": "MagnetAPI.org Codex CLI for ChatGPT-6 Astra, ChatGPT Daybreak Blue, GPT-5.6, Opus 5, Sonnet 5, and Fable 5.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "bin": {
@@ -22,7 +22,7 @@
22
22
  "node": ">=20"
23
23
  },
24
24
  "dependencies": {
25
- "@openai/codex": "0.149.0"
25
+ "@openai/codex": "0.153.4"
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public"