@ccusage/codex 18.0.5 → 18.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.
Files changed (2) hide show
  1. package/dist/index.js +78 -37
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -895,7 +895,7 @@ async function executeCommand(cmd, ctx, name$1) {
895
895
  await resolved.run(ctx);
896
896
  }
897
897
  var name = "@ccusage/codex";
898
- var version = "18.0.5";
898
+ var version = "18.0.7";
899
899
  var description = "Usage analysis tool for OpenAI Codex sessions";
900
900
  var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
901
901
  let messages = [];
@@ -6958,7 +6958,10 @@ const CODEX_PROVIDER_PREFIXES = [
6958
6958
  "azure/",
6959
6959
  "openrouter/openai/"
6960
6960
  ];
6961
- const CODEX_MODEL_ALIASES_MAP = new Map([["gpt-5-codex", "gpt-5"]]);
6961
+ const CODEX_MODEL_ALIASES_MAP = new Map([["gpt-5-codex", "gpt-5"], ["gpt-5.3-codex", "gpt-5.2-codex"]]);
6962
+ function hasNonZeroTokenPricing(pricing) {
6963
+ return (pricing.input_cost_per_token ?? 0) > 0 || (pricing.output_cost_per_token ?? 0) > 0 || (pricing.cache_read_input_token_cost ?? 0) > 0;
6964
+ }
6962
6965
  function toPerMillion(value, fallback) {
6963
6966
  return (value ?? fallback ?? 0) * MILLION;
6964
6967
  }
@@ -7015,9 +7018,9 @@ const PREFETCHED_CODEX_PRICING = {
7015
7018
  "input_cost_per_token": 125e-8,
7016
7019
  "output_cost_per_token": 1e-5,
7017
7020
  "cache_read_input_token_cost": 125e-9,
7018
- "max_tokens": 128e3,
7019
- "max_input_tokens": 272e3,
7020
- "max_output_tokens": 128e3
7021
+ "max_tokens": 16384,
7022
+ "max_input_tokens": 128e3,
7023
+ "max_output_tokens": 16384
7021
7024
  },
7022
7025
  "azure/gpt-5-chat-latest": {
7023
7026
  "input_cost_per_token": 125e-8,
@@ -7070,7 +7073,7 @@ const PREFETCHED_CODEX_PRICING = {
7070
7073
  "azure/gpt-5-pro": {
7071
7074
  "input_cost_per_token": 15e-6,
7072
7075
  "output_cost_per_token": 12e-5,
7073
- "max_tokens": 4e5,
7076
+ "max_tokens": 128e3,
7074
7077
  "max_input_tokens": 272e3,
7075
7078
  "max_output_tokens": 128e3
7076
7079
  },
@@ -7087,7 +7090,7 @@ const PREFETCHED_CODEX_PRICING = {
7087
7090
  "output_cost_per_token": 1e-5,
7088
7091
  "cache_read_input_token_cost": 125e-9,
7089
7092
  "max_tokens": 128e3,
7090
- "max_input_tokens": 272e3,
7093
+ "max_input_tokens": 128e3,
7091
7094
  "max_output_tokens": 128e3
7092
7095
  },
7093
7096
  "azure/gpt-5.1-codex": {
@@ -7103,7 +7106,7 @@ const PREFETCHED_CODEX_PRICING = {
7103
7106
  "output_cost_per_token": 1e-5,
7104
7107
  "cache_read_input_token_cost": 125e-9,
7105
7108
  "max_tokens": 128e3,
7106
- "max_input_tokens": 4e5,
7109
+ "max_input_tokens": 272e3,
7107
7110
  "max_output_tokens": 128e3
7108
7111
  },
7109
7112
  "azure/gpt-5.1-codex-mini": {
@@ -7119,7 +7122,7 @@ const PREFETCHED_CODEX_PRICING = {
7119
7122
  "output_cost_per_token": 14e-6,
7120
7123
  "cache_read_input_token_cost": 175e-9,
7121
7124
  "max_tokens": 128e3,
7122
- "max_input_tokens": 4e5,
7125
+ "max_input_tokens": 272e3,
7123
7126
  "max_output_tokens": 128e3
7124
7127
  },
7125
7128
  "azure/gpt-5.2-2025-12-11": {
@@ -7127,7 +7130,7 @@ const PREFETCHED_CODEX_PRICING = {
7127
7130
  "output_cost_per_token": 14e-6,
7128
7131
  "cache_read_input_token_cost": 175e-9,
7129
7132
  "max_tokens": 128e3,
7130
- "max_input_tokens": 4e5,
7133
+ "max_input_tokens": 272e3,
7131
7134
  "max_output_tokens": 128e3
7132
7135
  },
7133
7136
  "azure/gpt-5.2-chat": {
@@ -7146,18 +7149,26 @@ const PREFETCHED_CODEX_PRICING = {
7146
7149
  "max_input_tokens": 128e3,
7147
7150
  "max_output_tokens": 16384
7148
7151
  },
7152
+ "azure/gpt-5.2-codex": {
7153
+ "input_cost_per_token": 175e-8,
7154
+ "output_cost_per_token": 14e-6,
7155
+ "cache_read_input_token_cost": 175e-9,
7156
+ "max_tokens": 128e3,
7157
+ "max_input_tokens": 272e3,
7158
+ "max_output_tokens": 128e3
7159
+ },
7149
7160
  "azure/gpt-5.2-pro": {
7150
7161
  "input_cost_per_token": 21e-6,
7151
7162
  "output_cost_per_token": 168e-6,
7152
7163
  "max_tokens": 128e3,
7153
- "max_input_tokens": 4e5,
7164
+ "max_input_tokens": 272e3,
7154
7165
  "max_output_tokens": 128e3
7155
7166
  },
7156
7167
  "azure/gpt-5.2-pro-2025-12-11": {
7157
7168
  "input_cost_per_token": 21e-6,
7158
7169
  "output_cost_per_token": 168e-6,
7159
7170
  "max_tokens": 128e3,
7160
- "max_input_tokens": 4e5,
7171
+ "max_input_tokens": 272e3,
7161
7172
  "max_output_tokens": 128e3
7162
7173
  },
7163
7174
  "gpt-5": {
@@ -7197,7 +7208,7 @@ const PREFETCHED_CODEX_PRICING = {
7197
7208
  "output_cost_per_token": 14e-6,
7198
7209
  "cache_read_input_token_cost": 175e-9,
7199
7210
  "max_tokens": 128e3,
7200
- "max_input_tokens": 4e5,
7211
+ "max_input_tokens": 272e3,
7201
7212
  "max_output_tokens": 128e3
7202
7213
  },
7203
7214
  "gpt-5.2-2025-12-11": {
@@ -7205,7 +7216,7 @@ const PREFETCHED_CODEX_PRICING = {
7205
7216
  "output_cost_per_token": 14e-6,
7206
7217
  "cache_read_input_token_cost": 175e-9,
7207
7218
  "max_tokens": 128e3,
7208
- "max_input_tokens": 4e5,
7219
+ "max_input_tokens": 272e3,
7209
7220
  "max_output_tokens": 128e3
7210
7221
  },
7211
7222
  "gpt-5.2-chat-latest": {
@@ -7220,28 +7231,28 @@ const PREFETCHED_CODEX_PRICING = {
7220
7231
  "input_cost_per_token": 21e-6,
7221
7232
  "output_cost_per_token": 168e-6,
7222
7233
  "max_tokens": 128e3,
7223
- "max_input_tokens": 4e5,
7234
+ "max_input_tokens": 272e3,
7224
7235
  "max_output_tokens": 128e3
7225
7236
  },
7226
7237
  "gpt-5.2-pro-2025-12-11": {
7227
7238
  "input_cost_per_token": 21e-6,
7228
7239
  "output_cost_per_token": 168e-6,
7229
7240
  "max_tokens": 128e3,
7230
- "max_input_tokens": 4e5,
7241
+ "max_input_tokens": 272e3,
7231
7242
  "max_output_tokens": 128e3
7232
7243
  },
7233
7244
  "gpt-5-pro": {
7234
7245
  "input_cost_per_token": 15e-6,
7235
7246
  "output_cost_per_token": 12e-5,
7236
7247
  "max_tokens": 272e3,
7237
- "max_input_tokens": 4e5,
7248
+ "max_input_tokens": 128e3,
7238
7249
  "max_output_tokens": 272e3
7239
7250
  },
7240
7251
  "gpt-5-pro-2025-10-06": {
7241
7252
  "input_cost_per_token": 15e-6,
7242
7253
  "output_cost_per_token": 12e-5,
7243
7254
  "max_tokens": 272e3,
7244
- "max_input_tokens": 4e5,
7255
+ "max_input_tokens": 128e3,
7245
7256
  "max_output_tokens": 272e3
7246
7257
  },
7247
7258
  "gpt-5-2025-08-07": {
@@ -7256,9 +7267,9 @@ const PREFETCHED_CODEX_PRICING = {
7256
7267
  "input_cost_per_token": 125e-8,
7257
7268
  "output_cost_per_token": 1e-5,
7258
7269
  "cache_read_input_token_cost": 125e-9,
7259
- "max_tokens": 128e3,
7260
- "max_input_tokens": 272e3,
7261
- "max_output_tokens": 128e3
7270
+ "max_tokens": 16384,
7271
+ "max_input_tokens": 128e3,
7272
+ "max_output_tokens": 16384
7262
7273
  },
7263
7274
  "gpt-5-chat-latest": {
7264
7275
  "input_cost_per_token": 125e-8,
@@ -7289,7 +7300,7 @@ const PREFETCHED_CODEX_PRICING = {
7289
7300
  "output_cost_per_token": 1e-5,
7290
7301
  "cache_read_input_token_cost": 125e-9,
7291
7302
  "max_tokens": 128e3,
7292
- "max_input_tokens": 4e5,
7303
+ "max_input_tokens": 272e3,
7293
7304
  "max_output_tokens": 128e3
7294
7305
  },
7295
7306
  "gpt-5.1-codex-mini": {
@@ -7300,6 +7311,14 @@ const PREFETCHED_CODEX_PRICING = {
7300
7311
  "max_input_tokens": 272e3,
7301
7312
  "max_output_tokens": 128e3
7302
7313
  },
7314
+ "gpt-5.2-codex": {
7315
+ "input_cost_per_token": 175e-8,
7316
+ "output_cost_per_token": 14e-6,
7317
+ "cache_read_input_token_cost": 175e-9,
7318
+ "max_tokens": 128e3,
7319
+ "max_input_tokens": 272e3,
7320
+ "max_output_tokens": 128e3
7321
+ },
7303
7322
  "gpt-5-mini": {
7304
7323
  "input_cost_per_token": 25e-8,
7305
7324
  "output_cost_per_token": 2e-6,
@@ -7336,9 +7355,9 @@ const PREFETCHED_CODEX_PRICING = {
7336
7355
  "input_cost_per_token": 125e-8,
7337
7356
  "output_cost_per_token": 1e-5,
7338
7357
  "cache_read_input_token_cost": 125e-9,
7339
- "max_tokens": 128e3,
7340
- "max_input_tokens": 272e3,
7341
- "max_output_tokens": 128e3
7358
+ "max_tokens": 16384,
7359
+ "max_input_tokens": 128e3,
7360
+ "max_output_tokens": 16384
7342
7361
  },
7343
7362
  "openrouter/openai/gpt-5-codex": {
7344
7363
  "input_cost_per_token": 125e-8,
@@ -7348,6 +7367,14 @@ const PREFETCHED_CODEX_PRICING = {
7348
7367
  "max_input_tokens": 272e3,
7349
7368
  "max_output_tokens": 128e3
7350
7369
  },
7370
+ "openrouter/openai/gpt-5.2-codex": {
7371
+ "input_cost_per_token": 175e-8,
7372
+ "output_cost_per_token": 14e-6,
7373
+ "cache_read_input_token_cost": 175e-9,
7374
+ "max_tokens": 128e3,
7375
+ "max_input_tokens": 272e3,
7376
+ "max_output_tokens": 128e3
7377
+ },
7351
7378
  "openrouter/openai/gpt-5": {
7352
7379
  "input_cost_per_token": 125e-8,
7353
7380
  "output_cost_per_token": 1e-5,
@@ -7376,23 +7403,39 @@ const PREFETCHED_CODEX_PRICING = {
7376
7403
  "input_cost_per_token": 175e-8,
7377
7404
  "output_cost_per_token": 14e-6,
7378
7405
  "cache_read_input_token_cost": 175e-9,
7379
- "max_tokens": 4e5,
7380
- "max_input_tokens": 4e5,
7406
+ "max_tokens": 128e3,
7407
+ "max_input_tokens": 272e3,
7381
7408
  "max_output_tokens": 128e3
7382
7409
  },
7383
7410
  "openrouter/openai/gpt-5.2-chat": {
7384
7411
  "input_cost_per_token": 175e-8,
7385
7412
  "output_cost_per_token": 14e-6,
7386
7413
  "cache_read_input_token_cost": 175e-9,
7387
- "max_tokens": 128e3,
7414
+ "max_tokens": 16384,
7388
7415
  "max_input_tokens": 128e3,
7389
7416
  "max_output_tokens": 16384
7390
7417
  },
7391
7418
  "openrouter/openai/gpt-5.2-pro": {
7392
7419
  "input_cost_per_token": 21e-6,
7393
7420
  "output_cost_per_token": 168e-6,
7394
- "max_tokens": 4e5,
7395
- "max_input_tokens": 4e5,
7421
+ "max_tokens": 128e3,
7422
+ "max_input_tokens": 272e3,
7423
+ "max_output_tokens": 128e3
7424
+ },
7425
+ "gpt-5-search-api": {
7426
+ "input_cost_per_token": 125e-8,
7427
+ "output_cost_per_token": 1e-5,
7428
+ "cache_read_input_token_cost": 125e-9,
7429
+ "max_tokens": 128e3,
7430
+ "max_input_tokens": 272e3,
7431
+ "max_output_tokens": 128e3
7432
+ },
7433
+ "gpt-5-search-api-2025-10-14": {
7434
+ "input_cost_per_token": 125e-8,
7435
+ "output_cost_per_token": 1e-5,
7436
+ "cache_read_input_token_cost": 125e-9,
7437
+ "max_tokens": 128e3,
7438
+ "max_input_tokens": 272e3,
7396
7439
  "max_output_tokens": 128e3
7397
7440
  }
7398
7441
  };
@@ -7413,13 +7456,11 @@ var CodexPricingSource = class {
7413
7456
  const directLookup = await this.fetcher.getModelPricing(model);
7414
7457
  if (isFailure(directLookup)) throw directLookup.error;
7415
7458
  let pricing = directLookup.value;
7416
- if (pricing == null) {
7417
- const alias = CODEX_MODEL_ALIASES_MAP.get(model);
7418
- if (alias != null) {
7419
- const aliasLookup = await this.fetcher.getModelPricing(alias);
7420
- if (isFailure(aliasLookup)) throw aliasLookup.error;
7421
- pricing = aliasLookup.value;
7422
- }
7459
+ const alias = CODEX_MODEL_ALIASES_MAP.get(model);
7460
+ if (alias != null && (pricing == null || !hasNonZeroTokenPricing(pricing))) {
7461
+ const aliasLookup = await this.fetcher.getModelPricing(alias);
7462
+ if (isFailure(aliasLookup)) throw aliasLookup.error;
7463
+ if (aliasLookup.value != null && hasNonZeroTokenPricing(aliasLookup.value)) pricing = aliasLookup.value;
7423
7464
  }
7424
7465
  if (pricing == null) throw new Error(`Pricing not found for model ${model}`);
7425
7466
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ccusage/codex",
3
3
  "type": "module",
4
- "version": "18.0.5",
4
+ "version": "18.0.7",
5
5
  "description": "Usage analysis tool for OpenAI Codex sessions",
6
6
  "author": "ryoppippi",
7
7
  "license": "MIT",
@@ -9,7 +9,8 @@
9
9
  "homepage": "https://github.com/ryoppippi/ccusage#readme",
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "git+https://github.com/ryoppippi/ccusage.git"
12
+ "url": "git+https://github.com/ryoppippi/ccusage.git",
13
+ "directory": "apps/codex"
13
14
  },
14
15
  "bugs": {
15
16
  "url": "https://github.com/ryoppippi/ccusage/issues"