@gajae-code/ai 0.1.1 → 0.1.3

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,6 +2,18 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.1.3] - 2026-05-28
6
+
7
+ ### Changed
8
+
9
+ - Released the current dev branch fixes with refreshed 0.1.3 package metadata.
10
+
11
+ ## [0.1.2] - 2026-05-28
12
+
13
+ ### Changed
14
+
15
+ - Updated package metadata for the Gajae Code npm publication.
16
+
5
17
  ## [0.1.1] - 2026-05-28
6
18
  ### Breaking Changes
7
19
 
@@ -390,6 +390,8 @@ export declare class AuthStorage {
390
390
  * Reload credentials from storage.
391
391
  */
392
392
  reload(): Promise<void>;
393
+ /** Returns the credential type selected for a provider/session, if one has been recorded. */
394
+ getSessionCredentialType(provider: string, sessionId?: string): AuthCredential["type"] | undefined;
393
395
  /**
394
396
  * Get credential for a provider (first entry if multiple).
395
397
  */
@@ -233,6 +233,11 @@ export interface StreamOptions {
233
233
  * channel) silently ignore the override.
234
234
  */
235
235
  fetch?: FetchImpl;
236
+ /**
237
+ * Authentication credential type selected for this request.
238
+ * Providers use this only when endpoint routing differs between API-key and OAuth credentials.
239
+ */
240
+ authCredentialType?: "api_key" | "oauth";
236
241
  /** Cursor exec/MCP tool handlers (cursor-agent only). */
237
242
  execHandlers?: CursorExecHandlers;
238
243
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@gajae-code/ai",
4
- "version": "0.1.1",
4
+ "version": "0.1.3",
5
5
  "description": "Unified LLM API with automatic model discovery and provider configuration",
6
- "homepage": "https://gajae-code.dev",
7
- "author": "Can Boluk",
6
+ "homepage": "https://gaebal-gajae.dev",
7
+ "author": "Yeachan-Heo",
8
8
  "contributors": [
9
9
  "Mario Zechner"
10
10
  ],
@@ -43,7 +43,7 @@
43
43
  "dependencies": {
44
44
  "@anthropic-ai/sdk": "^0.94.0",
45
45
  "@bufbuild/protobuf": "^2.12.0",
46
- "@gajae-code/utils": "0.1.1",
46
+ "@gajae-code/utils": "0.1.3",
47
47
  "openai": "^6.36.0",
48
48
  "partial-json": "^0.1.7",
49
49
  "zod": "4.4.3"
@@ -1046,6 +1046,11 @@ export class AuthStorage {
1046
1046
  return this.#sessionLastCredential.get(provider)?.get(sessionId);
1047
1047
  }
1048
1048
 
1049
+ /** Returns the credential type selected for a provider/session, if one has been recorded. */
1050
+ getSessionCredentialType(provider: string, sessionId?: string): AuthCredential["type"] | undefined {
1051
+ return this.#getSessionCredential(provider, sessionId)?.type;
1052
+ }
1053
+
1049
1054
  /** Clears the last credential used by a session for a provider. */
1050
1055
  #clearSessionCredential(provider: string, sessionId: string | undefined): void {
1051
1056
  if (!sessionId) return;
package/src/models.json CHANGED
@@ -8452,7 +8452,7 @@
8452
8452
  "cost": {
8453
8453
  "input": 1,
8454
8454
  "output": 3,
8455
- "cacheRead": 0,
8455
+ "cacheRead": 0.5,
8456
8456
  "cacheWrite": 0
8457
8457
  },
8458
8458
  "contextWindow": 262144,
@@ -8471,7 +8471,7 @@
8471
8471
  "cost": {
8472
8472
  "input": 0.15,
8473
8473
  "output": 0.6,
8474
- "cacheRead": 0,
8474
+ "cacheRead": 0.075,
8475
8475
  "cacheWrite": 0
8476
8476
  },
8477
8477
  "contextWindow": 131072,
@@ -8495,7 +8495,7 @@
8495
8495
  "cost": {
8496
8496
  "input": 0.075,
8497
8497
  "output": 0.3,
8498
- "cacheRead": 0,
8498
+ "cacheRead": 0.0375,
8499
8499
  "cacheWrite": 0
8500
8500
  },
8501
8501
  "contextWindow": 131072,
@@ -12861,6 +12861,25 @@
12861
12861
  "maxLevel": "xhigh"
12862
12862
  }
12863
12863
  },
12864
+ "moonshotai/kimi-k2.6:free": {
12865
+ "id": "moonshotai/kimi-k2.6:free",
12866
+ "name": "MoonshotAI: Kimi K2.6 (free)",
12867
+ "api": "openai-completions",
12868
+ "provider": "kilo",
12869
+ "baseUrl": "https://api.kilo.ai/api/gateway",
12870
+ "reasoning": false,
12871
+ "input": [
12872
+ "text"
12873
+ ],
12874
+ "cost": {
12875
+ "input": 0,
12876
+ "output": 0,
12877
+ "cacheRead": 0,
12878
+ "cacheWrite": 0
12879
+ },
12880
+ "contextWindow": 222222,
12881
+ "maxTokens": 8888
12882
+ },
12864
12883
  "morph-warp-grep-v2": {
12865
12884
  "id": "morph-warp-grep-v2",
12866
12885
  "name": "Morph: WarpGrep V2",
@@ -51146,7 +51165,7 @@
51146
51165
  "name": "OpenAI code Mini",
51147
51166
  "api": "openai-responses",
51148
51167
  "provider": "openai",
51149
- "baseUrl": "https://api.openai.com/v1",
51168
+ "baseUrl": "",
51150
51169
  "reasoning": true,
51151
51170
  "input": [
51152
51171
  "text"
@@ -51170,7 +51189,7 @@
51170
51189
  "name": "GPT-4",
51171
51190
  "api": "openai-responses",
51172
51191
  "provider": "openai",
51173
- "baseUrl": "https://api.openai.com/v1",
51192
+ "baseUrl": "",
51174
51193
  "reasoning": false,
51175
51194
  "input": [
51176
51195
  "text"
@@ -51189,7 +51208,7 @@
51189
51208
  "name": "GPT-4 Turbo",
51190
51209
  "api": "openai-responses",
51191
51210
  "provider": "openai",
51192
- "baseUrl": "https://api.openai.com/v1",
51211
+ "baseUrl": "",
51193
51212
  "reasoning": false,
51194
51213
  "input": [
51195
51214
  "text",
@@ -51209,7 +51228,7 @@
51209
51228
  "name": "GPT-4.1",
51210
51229
  "api": "openai-responses",
51211
51230
  "provider": "openai",
51212
- "baseUrl": "https://api.openai.com/v1",
51231
+ "baseUrl": "",
51213
51232
  "reasoning": false,
51214
51233
  "input": [
51215
51234
  "text",
@@ -51229,7 +51248,7 @@
51229
51248
  "name": "GPT-4.1 mini",
51230
51249
  "api": "openai-responses",
51231
51250
  "provider": "openai",
51232
- "baseUrl": "https://api.openai.com/v1",
51251
+ "baseUrl": "",
51233
51252
  "reasoning": false,
51234
51253
  "input": [
51235
51254
  "text",
@@ -51249,7 +51268,7 @@
51249
51268
  "name": "GPT-4.1 nano",
51250
51269
  "api": "openai-responses",
51251
51270
  "provider": "openai",
51252
- "baseUrl": "https://api.openai.com/v1",
51271
+ "baseUrl": "",
51253
51272
  "reasoning": false,
51254
51273
  "input": [
51255
51274
  "text",
@@ -51269,7 +51288,7 @@
51269
51288
  "name": "GPT-4o",
51270
51289
  "api": "openai-responses",
51271
51290
  "provider": "openai",
51272
- "baseUrl": "https://api.openai.com/v1",
51291
+ "baseUrl": "",
51273
51292
  "reasoning": false,
51274
51293
  "input": [
51275
51294
  "text",
@@ -51289,7 +51308,7 @@
51289
51308
  "name": "GPT-4o (2024-05-13)",
51290
51309
  "api": "openai-responses",
51291
51310
  "provider": "openai",
51292
- "baseUrl": "https://api.openai.com/v1",
51311
+ "baseUrl": "",
51293
51312
  "reasoning": false,
51294
51313
  "input": [
51295
51314
  "text",
@@ -51309,7 +51328,7 @@
51309
51328
  "name": "GPT-4o (2024-08-06)",
51310
51329
  "api": "openai-responses",
51311
51330
  "provider": "openai",
51312
- "baseUrl": "https://api.openai.com/v1",
51331
+ "baseUrl": "",
51313
51332
  "reasoning": false,
51314
51333
  "input": [
51315
51334
  "text",
@@ -51329,7 +51348,7 @@
51329
51348
  "name": "GPT-4o (2024-11-20)",
51330
51349
  "api": "openai-responses",
51331
51350
  "provider": "openai",
51332
- "baseUrl": "https://api.openai.com/v1",
51351
+ "baseUrl": "",
51333
51352
  "reasoning": false,
51334
51353
  "input": [
51335
51354
  "text",
@@ -51349,7 +51368,7 @@
51349
51368
  "name": "GPT-4o mini",
51350
51369
  "api": "openai-responses",
51351
51370
  "provider": "openai",
51352
- "baseUrl": "https://api.openai.com/v1",
51371
+ "baseUrl": "",
51353
51372
  "reasoning": false,
51354
51373
  "input": [
51355
51374
  "text",
@@ -51369,7 +51388,7 @@
51369
51388
  "name": "GPT-5",
51370
51389
  "api": "openai-responses",
51371
51390
  "provider": "openai",
51372
- "baseUrl": "https://api.openai.com/v1",
51391
+ "baseUrl": "",
51373
51392
  "reasoning": true,
51374
51393
  "input": [
51375
51394
  "text",
@@ -51394,7 +51413,7 @@
51394
51413
  "id": "gpt-5-chat-latest",
51395
51414
  "name": "GPT-5 Chat Latest",
51396
51415
  "api": "openai-responses",
51397
- "baseUrl": "https://api.openai.com/v1",
51416
+ "baseUrl": "",
51398
51417
  "provider": "openai",
51399
51418
  "reasoning": false,
51400
51419
  "input": [
@@ -51416,7 +51435,7 @@
51416
51435
  "name": "GPT-5-OpenAI code",
51417
51436
  "api": "openai-responses",
51418
51437
  "provider": "openai",
51419
- "baseUrl": "https://api.openai.com/v1",
51438
+ "baseUrl": "",
51420
51439
  "reasoning": true,
51421
51440
  "input": [
51422
51441
  "text",
@@ -51442,7 +51461,7 @@
51442
51461
  "name": "GPT-5 Mini",
51443
51462
  "api": "openai-responses",
51444
51463
  "provider": "openai",
51445
- "baseUrl": "https://api.openai.com/v1",
51464
+ "baseUrl": "",
51446
51465
  "reasoning": true,
51447
51466
  "input": [
51448
51467
  "text",
@@ -51468,7 +51487,7 @@
51468
51487
  "name": "GPT-5 Nano",
51469
51488
  "api": "openai-responses",
51470
51489
  "provider": "openai",
51471
- "baseUrl": "https://api.openai.com/v1",
51490
+ "baseUrl": "",
51472
51491
  "reasoning": true,
51473
51492
  "input": [
51474
51493
  "text",
@@ -51494,7 +51513,7 @@
51494
51513
  "name": "GPT-5 Pro",
51495
51514
  "api": "openai-responses",
51496
51515
  "provider": "openai",
51497
- "baseUrl": "https://api.openai.com/v1",
51516
+ "baseUrl": "",
51498
51517
  "reasoning": true,
51499
51518
  "input": [
51500
51519
  "text",
@@ -51520,7 +51539,7 @@
51520
51539
  "name": "GPT-5.1",
51521
51540
  "api": "openai-responses",
51522
51541
  "provider": "openai",
51523
- "baseUrl": "https://api.openai.com/v1",
51542
+ "baseUrl": "",
51524
51543
  "reasoning": true,
51525
51544
  "input": [
51526
51545
  "text",
@@ -51546,7 +51565,7 @@
51546
51565
  "name": "GPT-5.1 Chat",
51547
51566
  "api": "openai-responses",
51548
51567
  "provider": "openai",
51549
- "baseUrl": "https://api.openai.com/v1",
51568
+ "baseUrl": "",
51550
51569
  "reasoning": true,
51551
51570
  "input": [
51552
51571
  "text",
@@ -51572,7 +51591,7 @@
51572
51591
  "name": "GPT-5.1 OpenAI code",
51573
51592
  "api": "openai-responses",
51574
51593
  "provider": "openai",
51575
- "baseUrl": "https://api.openai.com/v1",
51594
+ "baseUrl": "",
51576
51595
  "reasoning": true,
51577
51596
  "input": [
51578
51597
  "text",
@@ -51598,7 +51617,7 @@
51598
51617
  "name": "GPT-5.1 OpenAI code Max",
51599
51618
  "api": "openai-responses",
51600
51619
  "provider": "openai",
51601
- "baseUrl": "https://api.openai.com/v1",
51620
+ "baseUrl": "",
51602
51621
  "reasoning": true,
51603
51622
  "input": [
51604
51623
  "text",
@@ -51624,7 +51643,7 @@
51624
51643
  "name": "GPT-5.1 OpenAI code mini",
51625
51644
  "api": "openai-responses",
51626
51645
  "provider": "openai",
51627
- "baseUrl": "https://api.openai.com/v1",
51646
+ "baseUrl": "",
51628
51647
  "reasoning": true,
51629
51648
  "input": [
51630
51649
  "text",
@@ -51650,7 +51669,7 @@
51650
51669
  "name": "GPT-5.2",
51651
51670
  "api": "openai-responses",
51652
51671
  "provider": "openai",
51653
- "baseUrl": "https://api.openai.com/v1",
51672
+ "baseUrl": "",
51654
51673
  "reasoning": true,
51655
51674
  "input": [
51656
51675
  "text",
@@ -51676,7 +51695,7 @@
51676
51695
  "name": "GPT-5.2 Chat",
51677
51696
  "api": "openai-responses",
51678
51697
  "provider": "openai",
51679
- "baseUrl": "https://api.openai.com/v1",
51698
+ "baseUrl": "",
51680
51699
  "reasoning": true,
51681
51700
  "input": [
51682
51701
  "text",
@@ -51702,7 +51721,7 @@
51702
51721
  "name": "GPT-5.2 OpenAI code",
51703
51722
  "api": "openai-responses",
51704
51723
  "provider": "openai",
51705
- "baseUrl": "https://api.openai.com/v1",
51724
+ "baseUrl": "",
51706
51725
  "reasoning": true,
51707
51726
  "input": [
51708
51727
  "text",
@@ -51728,7 +51747,7 @@
51728
51747
  "name": "GPT-5.2 Pro",
51729
51748
  "api": "openai-responses",
51730
51749
  "provider": "openai",
51731
- "baseUrl": "https://api.openai.com/v1",
51750
+ "baseUrl": "",
51732
51751
  "reasoning": true,
51733
51752
  "input": [
51734
51753
  "text",
@@ -51754,7 +51773,7 @@
51754
51773
  "name": "GPT-5.3 Chat (latest)",
51755
51774
  "api": "openai-responses",
51756
51775
  "provider": "openai",
51757
- "baseUrl": "https://api.openai.com/v1",
51776
+ "baseUrl": "",
51758
51777
  "reasoning": false,
51759
51778
  "input": [
51760
51779
  "text",
@@ -51775,7 +51794,7 @@
51775
51794
  "name": "GPT-5.3 OpenAI code",
51776
51795
  "api": "openai-responses",
51777
51796
  "provider": "openai",
51778
- "baseUrl": "https://api.openai.com/v1",
51797
+ "baseUrl": "",
51779
51798
  "reasoning": true,
51780
51799
  "input": [
51781
51800
  "text",
@@ -51801,7 +51820,7 @@
51801
51820
  "name": "GPT-5.3 OpenAI code Spark",
51802
51821
  "api": "openai-responses",
51803
51822
  "provider": "openai",
51804
- "baseUrl": "https://api.openai.com/v1",
51823
+ "baseUrl": "",
51805
51824
  "reasoning": true,
51806
51825
  "input": [
51807
51826
  "text",
@@ -51828,7 +51847,7 @@
51828
51847
  "name": "GPT-5.4",
51829
51848
  "api": "openai-responses",
51830
51849
  "provider": "openai",
51831
- "baseUrl": "https://api.openai.com/v1",
51850
+ "baseUrl": "",
51832
51851
  "reasoning": true,
51833
51852
  "input": [
51834
51853
  "text",
@@ -51854,7 +51873,7 @@
51854
51873
  "name": "GPT-5.4 mini",
51855
51874
  "api": "openai-responses",
51856
51875
  "provider": "openai",
51857
- "baseUrl": "https://api.openai.com/v1",
51876
+ "baseUrl": "",
51858
51877
  "reasoning": true,
51859
51878
  "input": [
51860
51879
  "text",
@@ -51880,7 +51899,7 @@
51880
51899
  "name": "GPT-5.4 nano",
51881
51900
  "api": "openai-responses",
51882
51901
  "provider": "openai",
51883
- "baseUrl": "https://api.openai.com/v1",
51902
+ "baseUrl": "",
51884
51903
  "reasoning": true,
51885
51904
  "input": [
51886
51905
  "text",
@@ -51906,7 +51925,7 @@
51906
51925
  "name": "GPT-5.4 Pro",
51907
51926
  "api": "openai-responses",
51908
51927
  "provider": "openai",
51909
- "baseUrl": "https://api.openai.com/v1",
51928
+ "baseUrl": "",
51910
51929
  "reasoning": true,
51911
51930
  "input": [
51912
51931
  "text",
@@ -51932,7 +51951,7 @@
51932
51951
  "name": "GPT-5.5",
51933
51952
  "api": "openai-responses",
51934
51953
  "provider": "openai",
51935
- "baseUrl": "https://api.openai.com/v1",
51954
+ "baseUrl": "",
51936
51955
  "reasoning": true,
51937
51956
  "input": [
51938
51957
  "text",
@@ -51959,7 +51978,7 @@
51959
51978
  "name": "GPT-5.5 Pro",
51960
51979
  "api": "openai-responses",
51961
51980
  "provider": "openai",
51962
- "baseUrl": "https://api.openai.com/v1",
51981
+ "baseUrl": "",
51963
51982
  "reasoning": true,
51964
51983
  "input": [
51965
51984
  "text",
@@ -51986,7 +52005,7 @@
51986
52005
  "name": "o1",
51987
52006
  "api": "openai-responses",
51988
52007
  "provider": "openai",
51989
- "baseUrl": "https://api.openai.com/v1",
52008
+ "baseUrl": "",
51990
52009
  "reasoning": true,
51991
52010
  "input": [
51992
52011
  "text",
@@ -52011,7 +52030,7 @@
52011
52030
  "name": "o1-pro",
52012
52031
  "api": "openai-responses",
52013
52032
  "provider": "openai",
52014
- "baseUrl": "https://api.openai.com/v1",
52033
+ "baseUrl": "",
52015
52034
  "reasoning": true,
52016
52035
  "input": [
52017
52036
  "text",
@@ -52036,7 +52055,7 @@
52036
52055
  "name": "o3",
52037
52056
  "api": "openai-responses",
52038
52057
  "provider": "openai",
52039
- "baseUrl": "https://api.openai.com/v1",
52058
+ "baseUrl": "",
52040
52059
  "reasoning": true,
52041
52060
  "input": [
52042
52061
  "text",
@@ -52061,7 +52080,7 @@
52061
52080
  "name": "o3-deep-research",
52062
52081
  "api": "openai-responses",
52063
52082
  "provider": "openai",
52064
- "baseUrl": "https://api.openai.com/v1",
52083
+ "baseUrl": "",
52065
52084
  "reasoning": true,
52066
52085
  "input": [
52067
52086
  "text",
@@ -52086,7 +52105,7 @@
52086
52105
  "name": "o3-mini",
52087
52106
  "api": "openai-responses",
52088
52107
  "provider": "openai",
52089
- "baseUrl": "https://api.openai.com/v1",
52108
+ "baseUrl": "",
52090
52109
  "reasoning": true,
52091
52110
  "input": [
52092
52111
  "text"
@@ -52110,7 +52129,7 @@
52110
52129
  "name": "o3-pro",
52111
52130
  "api": "openai-responses",
52112
52131
  "provider": "openai",
52113
- "baseUrl": "https://api.openai.com/v1",
52132
+ "baseUrl": "",
52114
52133
  "reasoning": true,
52115
52134
  "input": [
52116
52135
  "text",
@@ -52135,7 +52154,7 @@
52135
52154
  "name": "o4-mini",
52136
52155
  "api": "openai-responses",
52137
52156
  "provider": "openai",
52138
- "baseUrl": "https://api.openai.com/v1",
52157
+ "baseUrl": "",
52139
52158
  "reasoning": true,
52140
52159
  "input": [
52141
52160
  "text",
@@ -52160,7 +52179,7 @@
52160
52179
  "name": "o4-mini-deep-research",
52161
52180
  "api": "openai-responses",
52162
52181
  "provider": "openai",
52163
- "baseUrl": "https://api.openai.com/v1",
52182
+ "baseUrl": "",
52164
52183
  "reasoning": true,
52165
52184
  "input": [
52166
52185
  "text",
@@ -52973,9 +52992,9 @@
52973
52992
  "image"
52974
52993
  ],
52975
52994
  "cost": {
52976
- "input": 0.4,
52977
- "output": 2,
52978
- "cacheRead": 0.08,
52995
+ "input": 0.14,
52996
+ "output": 0.28,
52997
+ "cacheRead": 0.0028,
52979
52998
  "cacheWrite": 0
52980
52999
  },
52981
53000
  "contextWindow": 1000000,
@@ -52997,9 +53016,9 @@
52997
53016
  "text"
52998
53017
  ],
52999
53018
  "cost": {
53000
- "input": 1,
53001
- "output": 3,
53002
- "cacheRead": 0.2,
53019
+ "input": 1.74,
53020
+ "output": 3.48,
53021
+ "cacheRead": 0.0145,
53003
53022
  "cacheWrite": 0
53004
53023
  },
53005
53024
  "contextWindow": 1048576,
@@ -54267,6 +54286,31 @@
54267
54286
  "maxLevel": "xhigh"
54268
54287
  }
54269
54288
  },
54289
+ "mimo-v2.5-free": {
54290
+ "id": "mimo-v2.5-free",
54291
+ "name": "MiMo V2.5 Free",
54292
+ "api": "openai-completions",
54293
+ "provider": "opencode-zen",
54294
+ "baseUrl": "https://opencode.ai/zen/v1",
54295
+ "reasoning": true,
54296
+ "input": [
54297
+ "text",
54298
+ "image"
54299
+ ],
54300
+ "cost": {
54301
+ "input": 0,
54302
+ "output": 0,
54303
+ "cacheRead": 0,
54304
+ "cacheWrite": 0
54305
+ },
54306
+ "contextWindow": 1000000,
54307
+ "maxTokens": 128000,
54308
+ "thinking": {
54309
+ "mode": "effort",
54310
+ "minLevel": "minimal",
54311
+ "maxLevel": "xhigh"
54312
+ }
54313
+ },
54270
54314
  "minimax-m2.1": {
54271
54315
  "id": "minimax-m2.1",
54272
54316
  "name": "MiniMax M2.1",
@@ -57044,7 +57088,7 @@
57044
57088
  "cacheRead": 0,
57045
57089
  "cacheWrite": 0
57046
57090
  },
57047
- "contextWindow": 204800,
57091
+ "contextWindow": 262144,
57048
57092
  "maxTokens": 8192,
57049
57093
  "compat": {
57050
57094
  "supportsToolChoice": false
@@ -57726,6 +57770,31 @@
57726
57770
  "maxLevel": "high"
57727
57771
  }
57728
57772
  },
57773
+ "moonshotai/kimi-k2.6:free": {
57774
+ "id": "moonshotai/kimi-k2.6:free",
57775
+ "name": "MoonshotAI: Kimi K2.6 (free)",
57776
+ "api": "openai-completions",
57777
+ "provider": "openrouter",
57778
+ "baseUrl": "https://openrouter.ai/api/v1",
57779
+ "reasoning": true,
57780
+ "input": [
57781
+ "text",
57782
+ "image"
57783
+ ],
57784
+ "cost": {
57785
+ "input": 0,
57786
+ "output": 0,
57787
+ "cacheRead": 0,
57788
+ "cacheWrite": 0
57789
+ },
57790
+ "contextWindow": 262144,
57791
+ "maxTokens": 8888,
57792
+ "thinking": {
57793
+ "mode": "effort",
57794
+ "minLevel": "minimal",
57795
+ "maxLevel": "high"
57796
+ }
57797
+ },
57729
57798
  "nex-agi/deepseek-v3.1-nex-n1": {
57730
57799
  "id": "nex-agi/deepseek-v3.1-nex-n1",
57731
57800
  "name": "Nex AGI: DeepSeek V3.1 Nex N1",
@@ -58616,11 +58685,11 @@
58616
58685
  "cost": {
58617
58686
  "input": 1.25,
58618
58687
  "output": 10,
58619
- "cacheRead": 0.125,
58688
+ "cacheRead": 0.13,
58620
58689
  "cacheWrite": 0
58621
58690
  },
58622
58691
  "contextWindow": 128000,
58623
- "maxTokens": 16384
58692
+ "maxTokens": 32000
58624
58693
  },
58625
58694
  "openai/gpt-5.1-codex": {
58626
58695
  "id": "openai/gpt-5.1-codex",
@@ -58636,7 +58705,7 @@
58636
58705
  "cost": {
58637
58706
  "input": 1.25,
58638
58707
  "output": 10,
58639
- "cacheRead": 0.125,
58708
+ "cacheRead": 0.13,
58640
58709
  "cacheWrite": 0
58641
58710
  },
58642
58711
  "contextWindow": 272000,
@@ -58686,11 +58755,11 @@
58686
58755
  "cost": {
58687
58756
  "input": 0.25,
58688
58757
  "output": 2,
58689
- "cacheRead": 0.03,
58758
+ "cacheRead": 0.024999999999999998,
58690
58759
  "cacheWrite": 0
58691
58760
  },
58692
58761
  "contextWindow": 272000,
58693
- "maxTokens": 128000,
58762
+ "maxTokens": 100000,
58694
58763
  "thinking": {
58695
58764
  "mode": "effort",
58696
58765
  "minLevel": "medium",
@@ -58740,7 +58809,7 @@
58740
58809
  "cacheWrite": 0
58741
58810
  },
58742
58811
  "contextWindow": 128000,
58743
- "maxTokens": 32000
58812
+ "maxTokens": 16384
58744
58813
  },
58745
58814
  "openai/gpt-5.2-codex": {
58746
58815
  "id": "openai/gpt-5.2-codex",
@@ -61027,13 +61096,13 @@
61027
61096
  "text"
61028
61097
  ],
61029
61098
  "cost": {
61030
- "input": 0.06599999999999999,
61031
- "output": 0.26,
61032
- "cacheRead": 0.029,
61099
+ "input": 0.063,
61100
+ "output": 0.21,
61101
+ "cacheRead": 0.020999999999999998,
61033
61102
  "cacheWrite": 0
61034
61103
  },
61035
61104
  "contextWindow": 262144,
61036
- "maxTokens": 262144,
61105
+ "maxTokens": 64000,
61037
61106
  "thinking": {
61038
61107
  "mode": "effort",
61039
61108
  "minLevel": "minimal",
@@ -1,3 +1,4 @@
1
+ import { $env } from "@gajae-code/utils";
1
2
  import type { ModelManagerOptions } from "../model-manager";
2
3
  import { Effort } from "../model-thinking";
3
4
  import { getBundledModels } from "../models";
@@ -14,6 +15,7 @@ import { createBundledReferenceMap, createReferenceResolver } from "./bundled-re
14
15
 
15
16
  const MODELS_DEV_URL = "https://models.dev/api.json";
16
17
  const ANTHROPIC_BASE_URL = "https://api.anthropic.com/v1";
18
+ const OPENAI_DEFAULT_BASE_URL = "https://api.openai.com/v1";
17
19
  const ANTHROPIC_OAUTH_BETA =
18
20
  "claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05";
19
21
 
@@ -494,7 +496,7 @@ export interface OpenAIModelManagerConfig {
494
496
 
495
497
  export function openaiModelManagerOptions(config?: OpenAIModelManagerConfig): ModelManagerOptions<"openai-responses"> {
496
498
  const apiKey = config?.apiKey;
497
- const baseUrl = config?.baseUrl ?? "https://api.openai.com/v1";
499
+ const baseUrl = config?.baseUrl?.trim() || $env.OPENAI_BASE_URL?.trim() || OPENAI_DEFAULT_BASE_URL;
498
500
  const references = createBundledReferenceMap<"openai-responses">("openai");
499
501
  return {
500
502
  providerId: "openai",
@@ -2105,7 +2107,7 @@ const MODELS_DEV_PROVIDER_DESCRIPTORS_CORE: readonly ModelsDevProviderDescriptor
2105
2107
  "https://generativelanguage.googleapis.com/v1beta",
2106
2108
  ),
2107
2109
  // --- OpenAI ---
2108
- simpleModelsDevDescriptor("openai", "openai", "openai-responses", "https://api.openai.com/v1"),
2110
+ simpleModelsDevDescriptor("openai", "openai", "openai-responses", ""),
2109
2111
  // --- Groq ---
2110
2112
  openAiCompletionsDescriptor("groq", "groq", "https://api.groq.com/openai/v1"),
2111
2113
  // --- Cerebras ---
@@ -70,6 +70,21 @@ import { createInitialResponsesAssistantMessage } from "./openai-responses-share
70
70
  import { transformMessages } from "./transform-messages";
71
71
  import { joinTextWithImagePlaceholder, NON_VISION_IMAGE_PLACEHOLDER } from "./vision-guard";
72
72
 
73
+ const OPENAI_DEFAULT_BASE_URL = "https://api.openai.com/v1";
74
+
75
+ function resolveOpenAIProviderBaseUrl(
76
+ baseUrl: string | undefined,
77
+ authCredentialType: "api_key" | "oauth" | undefined,
78
+ ): string {
79
+ if (authCredentialType === "oauth") return OPENAI_DEFAULT_BASE_URL;
80
+ const envBaseUrl = $env.OPENAI_BASE_URL?.trim();
81
+ const configuredBaseUrl = baseUrl?.trim();
82
+ if (envBaseUrl && (!configuredBaseUrl || configuredBaseUrl.toLowerCase().includes("api.openai.com"))) {
83
+ return envBaseUrl;
84
+ }
85
+ return configuredBaseUrl || envBaseUrl || OPENAI_DEFAULT_BASE_URL;
86
+ }
87
+
73
88
  /**
74
89
  * Normalize tool call ID for Mistral.
75
90
  * Mistral requires tool IDs to be exactly 9 alphanumeric characters (a-z, A-Z, 0-9).
@@ -413,6 +428,7 @@ export const streamOpenAICompletions: StreamFunction<"openai-completions"> = (
413
428
  options?.onSseEvent,
414
429
  options?.fetch,
415
430
  options?.streamFirstEventTimeoutMs,
431
+ options?.authCredentialType,
416
432
  );
417
433
  const premiumRequestsTotal = copilotPremiumRequests;
418
434
  getCapturedErrorResponse = captureErrorResponse;
@@ -888,6 +904,7 @@ async function createClient(
888
904
  onSseEvent?: OpenAICompletionsOptions["onSseEvent"],
889
905
  fetchOverride?: FetchImpl,
890
906
  streamFirstEventTimeoutOverride?: number,
907
+ authCredentialType?: OpenAICompletionsOptions["authCredentialType"],
891
908
  ): Promise<{
892
909
  client: OpenAI;
893
910
  copilotPremiumRequests: number | undefined;
@@ -916,7 +933,7 @@ async function createClient(
916
933
  // SDK UA so traffic is identifiable in upstream provider logs.
917
934
  // https://openrouter.ai/docs/app-attribution
918
935
  headers["User-Agent"] = `Gajae-Code/${packageJson.version}`;
919
- headers["HTTP-Referer"] = "https://gajae-code.dev/";
936
+ headers["HTTP-Referer"] = "https://gaebal-gajae.dev/";
920
937
  headers["X-OpenRouter-Title"] = "Gajae-Code";
921
938
  headers["X-OpenRouter-Categories"] = "cli-agent";
922
939
  // Always-on response caching: identical requests return cached responses for free.
@@ -931,7 +948,8 @@ async function createClient(
931
948
  }
932
949
  let copilotPremiumRequests: number | undefined;
933
950
 
934
- let baseUrl = model.baseUrl;
951
+ let baseUrl =
952
+ model.provider === "openai" ? resolveOpenAIProviderBaseUrl(model.baseUrl, authCredentialType) : model.baseUrl;
935
953
  if (model.provider === "github-copilot") {
936
954
  apiKey = parseGitHubCopilotApiKey(rawApiKey).accessToken;
937
955
  const hasImages = hasCopilotVisionInput(context.messages);
@@ -102,6 +102,20 @@ export interface OpenAIResponsesOptions extends StreamOptions {
102
102
  const OPENAI_RESPONSES_PROVIDER_SESSION_STATE_PREFIX = "openai-responses:";
103
103
  const OPENAI_RESPONSES_FIRST_EVENT_TIMEOUT_MESSAGE =
104
104
  "OpenAI responses stream timed out while waiting for the first event";
105
+ const OPENAI_DEFAULT_BASE_URL = "https://api.openai.com/v1";
106
+
107
+ function resolveOpenAIProviderBaseUrl(
108
+ baseUrl: string | undefined,
109
+ authCredentialType: "api_key" | "oauth" | undefined,
110
+ ): string {
111
+ if (authCredentialType === "oauth") return OPENAI_DEFAULT_BASE_URL;
112
+ const envBaseUrl = $env.OPENAI_BASE_URL?.trim();
113
+ const configuredBaseUrl = baseUrl?.trim();
114
+ if (envBaseUrl && (!configuredBaseUrl || configuredBaseUrl.toLowerCase().includes("api.openai.com"))) {
115
+ return envBaseUrl;
116
+ }
117
+ return configuredBaseUrl || envBaseUrl || OPENAI_DEFAULT_BASE_URL;
118
+ }
105
119
 
106
120
  const OPENAI_RESPONSES_PROGRESS_EVENT_TYPES = new Set([
107
121
  "response.created",
@@ -213,6 +227,7 @@ export const streamOpenAIResponses: StreamFunction<"openai-responses"> = (
213
227
  cacheSessionId,
214
228
  options?.onSseEvent,
215
229
  options?.fetch,
230
+ options?.authCredentialType,
216
231
  );
217
232
  const premiumRequestsTotal = copilotPremiumRequests;
218
233
  const providerSessionState = getOpenAIResponsesProviderSessionState(model, options?.providerSessionState);
@@ -224,7 +239,7 @@ export const streamOpenAIResponses: StreamFunction<"openai-responses"> = (
224
239
  api: output.api,
225
240
  model: model.id,
226
241
  method: "POST",
227
- url: `${baseUrl ?? "https://api.openai.com/v1"}/responses`,
242
+ url: `${baseUrl}/responses`,
228
243
  body: params,
229
244
  };
230
245
  const openaiStream = await callWithCopilotModelRetry(
@@ -313,6 +328,7 @@ function createClient(
313
328
  sessionId?: string,
314
329
  onSseEvent?: OpenAIResponsesOptions["onSseEvent"],
315
330
  fetchOverride?: FetchImpl,
331
+ authCredentialType?: OpenAIResponsesOptions["authCredentialType"],
316
332
  ): {
317
333
  client: OpenAI;
318
334
  copilotPremiumRequests: number | undefined;
@@ -331,7 +347,8 @@ function createClient(
331
347
  const headers = { ...(model.headers ?? {}), ...(extraHeaders ?? {}) };
332
348
  let copilotPremiumRequests: number | undefined;
333
349
 
334
- let baseUrl = model.baseUrl;
350
+ let baseUrl =
351
+ model.provider === "openai" ? resolveOpenAIProviderBaseUrl(model.baseUrl, authCredentialType) : model.baseUrl;
335
352
  if (model.provider === "github-copilot") {
336
353
  apiKey = parseGitHubCopilotApiKey(rawApiKey).accessToken;
337
354
  const hasImages = hasCopilotVisionInput(context.messages);
package/src/types.ts CHANGED
@@ -364,6 +364,11 @@ export interface StreamOptions {
364
364
  * channel) silently ignore the override.
365
365
  */
366
366
  fetch?: FetchImpl;
367
+ /**
368
+ * Authentication credential type selected for this request.
369
+ * Providers use this only when endpoint routing differs between API-key and OAuth credentials.
370
+ */
371
+ authCredentialType?: "api_key" | "oauth";
367
372
  /** Cursor exec/MCP tool handlers (cursor-agent only). */
368
373
  execHandlers?: CursorExecHandlers;
369
374
  }