@gajae-code/ai 0.9.4 → 0.9.6

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/CHANGELOG.md CHANGED
@@ -2,10 +2,25 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.6] - 2026-07-10
6
+ ### Fixed
7
+
8
+ - Normalized the GPT-5.6 Sol/Terra/Luna context window to the 373K usable prompt budget on both OpenAI and OpenAI code transports (was 1,050K / 272K), matching the live openai-codex catalog.
9
+
10
+ ## [0.9.5] - 2026-07-09
11
+ ### Added
12
+
13
+ - Added GPT-5.6 Sol, Terra, and Luna catalog/parser support for OpenAI and OpenAI code transports, including `low` through canonical `max` reasoning efforts, verified pricing/limits, and GPT-5.6 cache-write pricing (#1925; OmX #3103).
14
+
15
+ ### Fixed
16
+
17
+ - Stopped requesting `strict: true` tool use on Anthropic OAuth requests: the Claude Code OAuth surface mishandles strict tools, returning tool calls with empty/undefined arguments and occasionally corrupted tool names. API-key requests keep strict tool use; `PI_NO_STRICT=1` is no longer needed as a workaround.
18
+
5
19
  ## [0.9.4] - 2026-07-09
6
20
  ### Fixed
7
21
 
8
22
  - Preserved Anthropic OAuth tool-call names and streamed arguments across interleaved tool-use blocks, preventing prefixed tool names and partial JSON deltas from being dropped or misattributed.
23
+ - Embedded `models.json` via a `with { type: "file" }` import so compiled release binaries load the bundled model catalog from bunfs instead of crashing at startup with `Cannot find module './packages/ai/src/models.json'` (v0.9.3 regression, #1914).
9
24
 
10
25
  ## [0.9.2] - 2026-07-09
11
26
  ### Added
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@gajae-code/ai",
4
- "version": "0.9.4",
4
+ "version": "0.9.6",
5
5
  "description": "Unified LLM API with automatic model discovery and provider configuration",
6
6
  "homepage": "https://gajae-code.com",
7
7
  "author": "Yeachan-Heo and Gajae Code Contributors",
@@ -40,7 +40,7 @@
40
40
  "dependencies": {
41
41
  "@anthropic-ai/sdk": "^0.94.0",
42
42
  "@bufbuild/protobuf": "^2.12.0",
43
- "@gajae-code/utils": "0.9.4",
43
+ "@gajae-code/utils": "0.9.6",
44
44
  "openai": "^6.36.0",
45
45
  "partial-json": "^0.1.7",
46
46
  "zod": "4.4.3"
@@ -47,6 +47,7 @@ const DEFAULT_REASONING_EFFORTS_WITH_XHIGH_AND_MAX: readonly Effort[] = [
47
47
  const GEMINI_3_PRO_EFFORTS: readonly Effort[] = [Effort.Low, Effort.High];
48
48
  const GEMINI_3_FLASH_EFFORTS: readonly Effort[] = [Effort.Minimal, Effort.Low, Effort.Medium, Effort.High];
49
49
  const GPT_5_2_PLUS_EFFORTS: readonly Effort[] = [Effort.Low, Effort.Medium, Effort.High, Effort.XHigh];
50
+ const GPT_5_6_PLUS_EFFORTS: readonly Effort[] = [Effort.Low, Effort.Medium, Effort.High, Effort.XHigh, Effort.Max];
50
51
  const GPT_5_5_DEFAULT_EFFORT = Effort.XHigh;
51
52
 
52
53
  const GPT_5_1_CODEX_MINI_EFFORTS: readonly Effort[] = [Effort.Medium, Effort.High];
@@ -60,7 +61,18 @@ type SemVer = {
60
61
 
61
62
  type GeminiKind = "pro" | "flash";
62
63
  type AnthropicKind = "opus" | "sonnet";
63
- type OpenAIVariant = "base" | "codex" | "codex-max" | "codex-mini" | "codex-spark" | "mini" | "max" | "nano";
64
+ type OpenAIVariant =
65
+ | "base"
66
+ | "codex"
67
+ | "codex-max"
68
+ | "codex-mini"
69
+ | "codex-spark"
70
+ | "luna"
71
+ | "mini"
72
+ | "max"
73
+ | "nano"
74
+ | "sol"
75
+ | "terra";
64
76
 
65
77
  const CODEX_GPT_5_4_PRIORITY_BY_VARIANT: Partial<Record<OpenAIVariant, number>> = {
66
78
  base: 0,
@@ -465,11 +477,25 @@ function applyGpt55ContextWindow(model: ApiModel<Api>, parsedModel: OpenAIModel)
465
477
  }
466
478
  return false;
467
479
  }
480
+ const GPT_5_6_TIER_VARIANTS: ReadonlySet<OpenAIVariant> = new Set(["base", "sol", "terra", "luna"]);
481
+
482
+ function applyGpt56ContextWindow(model: ApiModel<Api>, parsedModel: OpenAIModel): boolean {
483
+ if (!semverGte(parsedModel.version, "5.6") || !GPT_5_6_TIER_VARIANTS.has(parsedModel.variant)) {
484
+ return false;
485
+ }
486
+ // GPT-5.6 tiers enforce a ~373K usable prompt budget on both transports
487
+ // (matches the openai-codex live catalog), despite the 1M+ marketing window.
488
+ model.contextWindow = 373_000;
489
+ return true;
490
+ }
468
491
 
469
492
  function applyOpenAICatalogPolicy(model: ApiModel<Api>, parsedModel: OpenAIModel): void {
470
493
  if (applyGpt55ContextWindow(model, parsedModel)) {
471
494
  return;
472
495
  }
496
+ if (applyGpt56ContextWindow(model, parsedModel)) {
497
+ return;
498
+ }
473
499
  // OpenAI code backend models: 400K figure includes output budget; input window is 272K.
474
500
  if (parsedModel.variant.startsWith("codex") && parsedModel.variant !== "codex-spark") {
475
501
  model.contextWindow = 272000;
@@ -582,6 +608,9 @@ function inferOpenAISupportedEfforts(model: OpenAIModel): readonly Effort[] {
582
608
  if (model.variant === "codex-mini" && semverEqual(model.version, "5.1")) {
583
609
  return GPT_5_1_CODEX_MINI_EFFORTS;
584
610
  }
611
+ if (semverGte(model.version, "5.6")) {
612
+ return GPT_5_6_PLUS_EFFORTS;
613
+ }
585
614
  if (semverGte(model.version, "5.2")) {
586
615
  return GPT_5_2_PLUS_EFFORTS;
587
616
  }
@@ -714,7 +743,10 @@ function parseAnthropicModel(modelId: string): AnthropicModel | null {
714
743
  }
715
744
 
716
745
  function parseOpenAIModel(modelId: string): OpenAIModel | null {
717
- const match = /gpt-(\d+(?:\.\d+){0,2})(?:-(codex-spark|codex-mini|codex-max|codex|mini|max|nano))?$/.exec(modelId);
746
+ const match =
747
+ /gpt-(\d+(?:\.\d+){0,2})(?:-(codex-spark|codex-mini|codex-max|codex|luna|mini|max|nano|sol|terra))?$/.exec(
748
+ modelId,
749
+ );
718
750
  if (!match) {
719
751
  return null;
720
752
  }
package/src/models.json CHANGED
@@ -56291,6 +56291,84 @@
56291
56291
  "maxLevel": "xhigh"
56292
56292
  }
56293
56293
  },
56294
+ "gpt-5.6-luna": {
56295
+ "id": "gpt-5.6-luna",
56296
+ "name": "GPT-5.6 Luna",
56297
+ "api": "openai-responses",
56298
+ "provider": "openai",
56299
+ "baseUrl": "",
56300
+ "reasoning": true,
56301
+ "input": [
56302
+ "text",
56303
+ "image"
56304
+ ],
56305
+ "cost": {
56306
+ "input": 1,
56307
+ "output": 6,
56308
+ "cacheRead": 0.1,
56309
+ "cacheWrite": 1.25
56310
+ },
56311
+ "contextWindow": 1050000,
56312
+ "maxTokens": 128000,
56313
+ "thinking": {
56314
+ "mode": "effort",
56315
+ "minLevel": "low",
56316
+ "maxLevel": "max"
56317
+ },
56318
+ "applyPatchToolType": "freeform"
56319
+ },
56320
+ "gpt-5.6-sol": {
56321
+ "id": "gpt-5.6-sol",
56322
+ "name": "GPT-5.6 Sol",
56323
+ "api": "openai-responses",
56324
+ "provider": "openai",
56325
+ "baseUrl": "",
56326
+ "reasoning": true,
56327
+ "input": [
56328
+ "text",
56329
+ "image"
56330
+ ],
56331
+ "cost": {
56332
+ "input": 5,
56333
+ "output": 30,
56334
+ "cacheRead": 0.5,
56335
+ "cacheWrite": 6.25
56336
+ },
56337
+ "contextWindow": 1050000,
56338
+ "maxTokens": 128000,
56339
+ "thinking": {
56340
+ "mode": "effort",
56341
+ "minLevel": "low",
56342
+ "maxLevel": "max"
56343
+ },
56344
+ "applyPatchToolType": "freeform"
56345
+ },
56346
+ "gpt-5.6-terra": {
56347
+ "id": "gpt-5.6-terra",
56348
+ "name": "GPT-5.6 Terra",
56349
+ "api": "openai-responses",
56350
+ "provider": "openai",
56351
+ "baseUrl": "",
56352
+ "reasoning": true,
56353
+ "input": [
56354
+ "text",
56355
+ "image"
56356
+ ],
56357
+ "cost": {
56358
+ "input": 2.5,
56359
+ "output": 15,
56360
+ "cacheRead": 0.25,
56361
+ "cacheWrite": 3.125
56362
+ },
56363
+ "contextWindow": 1050000,
56364
+ "maxTokens": 128000,
56365
+ "thinking": {
56366
+ "mode": "effort",
56367
+ "minLevel": "low",
56368
+ "maxLevel": "max"
56369
+ },
56370
+ "applyPatchToolType": "freeform"
56371
+ },
56294
56372
  "o1": {
56295
56373
  "id": "o1",
56296
56374
  "name": "o1",
@@ -56938,6 +57016,87 @@
56938
57016
  "defaultLevel": "xhigh"
56939
57017
  },
56940
57018
  "applyPatchToolType": "freeform"
57019
+ },
57020
+ "gpt-5.6-luna": {
57021
+ "id": "gpt-5.6-luna",
57022
+ "name": "GPT-5.6 Luna",
57023
+ "api": "openai-codex-responses",
57024
+ "provider": "openai-codex",
57025
+ "baseUrl": "https://chatgpt.com/backend-api",
57026
+ "reasoning": true,
57027
+ "input": [
57028
+ "text",
57029
+ "image"
57030
+ ],
57031
+ "cost": {
57032
+ "input": 1,
57033
+ "output": 6,
57034
+ "cacheRead": 0.1,
57035
+ "cacheWrite": 1.25
57036
+ },
57037
+ "contextWindow": 272000,
57038
+ "maxTokens": 128000,
57039
+ "preferWebsockets": true,
57040
+ "thinking": {
57041
+ "mode": "effort",
57042
+ "minLevel": "low",
57043
+ "maxLevel": "max"
57044
+ },
57045
+ "applyPatchToolType": "freeform"
57046
+ },
57047
+ "gpt-5.6-sol": {
57048
+ "id": "gpt-5.6-sol",
57049
+ "name": "GPT-5.6 Sol",
57050
+ "api": "openai-codex-responses",
57051
+ "provider": "openai-codex",
57052
+ "baseUrl": "https://chatgpt.com/backend-api",
57053
+ "reasoning": true,
57054
+ "input": [
57055
+ "text",
57056
+ "image"
57057
+ ],
57058
+ "cost": {
57059
+ "input": 5,
57060
+ "output": 30,
57061
+ "cacheRead": 0.5,
57062
+ "cacheWrite": 6.25
57063
+ },
57064
+ "contextWindow": 272000,
57065
+ "maxTokens": 128000,
57066
+ "preferWebsockets": true,
57067
+ "thinking": {
57068
+ "mode": "effort",
57069
+ "minLevel": "low",
57070
+ "maxLevel": "max"
57071
+ },
57072
+ "applyPatchToolType": "freeform"
57073
+ },
57074
+ "gpt-5.6-terra": {
57075
+ "id": "gpt-5.6-terra",
57076
+ "name": "GPT-5.6 Terra",
57077
+ "api": "openai-codex-responses",
57078
+ "provider": "openai-codex",
57079
+ "baseUrl": "https://chatgpt.com/backend-api",
57080
+ "reasoning": true,
57081
+ "input": [
57082
+ "text",
57083
+ "image"
57084
+ ],
57085
+ "cost": {
57086
+ "input": 2.5,
57087
+ "output": 15,
57088
+ "cacheRead": 0.25,
57089
+ "cacheWrite": 3.125
57090
+ },
57091
+ "contextWindow": 272000,
57092
+ "maxTokens": 128000,
57093
+ "preferWebsockets": true,
57094
+ "thinking": {
57095
+ "mode": "effort",
57096
+ "minLevel": "low",
57097
+ "maxLevel": "max"
57098
+ },
57099
+ "applyPatchToolType": "freeform"
56941
57100
  }
56942
57101
  },
56943
57102
  "opencode": {
@@ -2263,7 +2263,11 @@ function buildParams(
2263
2263
  params.tools = convertTools(
2264
2264
  context.tools,
2265
2265
  isOAuthToken,
2266
- disableStrictTools || model.provider === "github-copilot",
2266
+ // The Claude Code OAuth surface mishandles `strict: true` tools:
2267
+ // streamed tool_use blocks arrive with empty/undefined arguments and
2268
+ // occasionally corrupted names (works with PI_NO_STRICT=1). Never
2269
+ // request strict tool use on OAuth requests.
2270
+ disableStrictTools || isOAuthToken || model.provider === "github-copilot",
2267
2271
  getAnthropicCompat(model).supportsEagerToolInputStreaming,
2268
2272
  );
2269
2273
  }