omnigateway 0.13.0 → 0.13.2
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/bin/omni.js +51 -28
- package/gateway.js +51 -28
- package/package.json +1 -1
package/bin/omni.js
CHANGED
|
@@ -24722,12 +24722,24 @@ var ANTHROPIC_MODELS = {
|
|
|
24722
24722
|
pricing: { input: 5, output: 25, cacheRead: 0.5, cacheWrite5m: 6.25, cacheWrite1h: 10 },
|
|
24723
24723
|
limits: { contextWindow: 1e6, maxOutputTokens: 128000 }
|
|
24724
24724
|
},
|
|
24725
|
+
{
|
|
24726
|
+
id: "claude-sonnet-5-5",
|
|
24727
|
+
label: "Claude Sonnet 5.5",
|
|
24728
|
+
pricing: { input: 2, output: 10, cacheRead: 0.1, cacheWrite5m: 2.5, cacheWrite1h: 4 },
|
|
24729
|
+
limits: { contextWindow: 1e6, maxOutputTokens: 128000 }
|
|
24730
|
+
},
|
|
24725
24731
|
{
|
|
24726
24732
|
id: "claude-sonnet-5",
|
|
24727
24733
|
label: "Claude Sonnet 5",
|
|
24728
24734
|
pricing: { input: 2, output: 10, cacheRead: 0.2, cacheWrite5m: 2.5, cacheWrite1h: 4 },
|
|
24729
24735
|
limits: { contextWindow: 1e6, maxOutputTokens: 128000 }
|
|
24730
24736
|
},
|
|
24737
|
+
{
|
|
24738
|
+
id: "claude-haiku-5-5",
|
|
24739
|
+
label: "Claude Haiku 5.5",
|
|
24740
|
+
pricing: { input: 0.1, output: 0.5, cacheRead: 0.01, cacheWrite5m: 0.125, cacheWrite1h: 0.2 },
|
|
24741
|
+
limits: { contextWindow: 1e6, maxOutputTokens: 128000 }
|
|
24742
|
+
},
|
|
24731
24743
|
{
|
|
24732
24744
|
id: "claude-haiku-4-5",
|
|
24733
24745
|
label: "Claude Haiku 4.5",
|
|
@@ -25299,7 +25311,7 @@ var museDescriptor = {
|
|
|
25299
25311
|
|
|
25300
25312
|
// packages/providers/src/openai/models.ts
|
|
25301
25313
|
var OPENAI_MODELS = {
|
|
25302
|
-
defaultModel: "gpt-6-sol",
|
|
25314
|
+
defaultModel: "gpt-6.1-sol",
|
|
25303
25315
|
authTypes: ["oauth", "apiKey"],
|
|
25304
25316
|
models: [
|
|
25305
25317
|
{
|
|
@@ -25309,6 +25321,13 @@ var OPENAI_MODELS = {
|
|
|
25309
25321
|
limits: { contextWindow: 922000, maxOutputTokens: 128000 },
|
|
25310
25322
|
oauthLimits: { contextWindow: 272000, maxOutputTokens: 128000 }
|
|
25311
25323
|
},
|
|
25324
|
+
{
|
|
25325
|
+
id: "gpt-6.1-sol",
|
|
25326
|
+
label: "GPT-6.1 Sol",
|
|
25327
|
+
pricing: { input: 2, output: 10, cacheRead: 0.1, cacheWrite5m: 2.5, cacheWrite1h: 0 },
|
|
25328
|
+
limits: { contextWindow: 922000, maxOutputTokens: 128000 },
|
|
25329
|
+
oauthLimits: { contextWindow: 272000, maxOutputTokens: 128000 }
|
|
25330
|
+
},
|
|
25312
25331
|
{
|
|
25313
25332
|
id: "gpt-6-sol",
|
|
25314
25333
|
label: "GPT-6 Sol",
|
|
@@ -26016,35 +26035,37 @@ var museBodyOrder = [
|
|
|
26016
26035
|
];
|
|
26017
26036
|
|
|
26018
26037
|
// packages/providers/src/openai/profile.ts
|
|
26019
|
-
var OPENAI_CLI_VERSION = env("OMNI_OPENAI_CLI_VERSION", "0.
|
|
26038
|
+
var OPENAI_CLI_VERSION = env("OMNI_OPENAI_CLI_VERSION", "0.159.2");
|
|
26020
26039
|
var OPENAI_UA_PLATFORM = env("OMNI_OPENAI_UA_PLATFORM", "Windows 10.0.26200");
|
|
26021
|
-
var OPENAI_UA_ARCH = env("OMNI_OPENAI_UA_ARCH", "
|
|
26040
|
+
var OPENAI_UA_ARCH = env("OMNI_OPENAI_UA_ARCH", "x86_64");
|
|
26041
|
+
var OPENAI_UA_TERMINAL = env("OMNI_OPENAI_UA_TERMINAL", "WindowsTerminal");
|
|
26042
|
+
var originator = env("OMNI_OPENAI_ORIGINATOR", "codex_cli_rs");
|
|
26022
26043
|
var openaiProfile = {
|
|
26023
26044
|
headers: [
|
|
26024
26045
|
[
|
|
26025
|
-
"
|
|
26026
|
-
env("OMNI_UA_OPENAI",
|
|
26046
|
+
"user-agent",
|
|
26047
|
+
env("OMNI_UA_OPENAI", `${originator}/${OPENAI_CLI_VERSION} (${OPENAI_UA_PLATFORM}; ${OPENAI_UA_ARCH}) ${OPENAI_UA_TERMINAL}`)
|
|
26027
26048
|
],
|
|
26028
|
-
["originator",
|
|
26029
|
-
["
|
|
26030
|
-
["
|
|
26031
|
-
["
|
|
26032
|
-
["Accept", "text/event-stream"]
|
|
26049
|
+
["originator", originator],
|
|
26050
|
+
["version", OPENAI_CLI_VERSION],
|
|
26051
|
+
["x-codex-beta-features", "remote_compaction_v2"],
|
|
26052
|
+
["accept", "text/event-stream"]
|
|
26033
26053
|
],
|
|
26034
26054
|
order: envOrder("OMNI_ORDER_OPENAI", [
|
|
26035
|
-
"
|
|
26036
|
-
"
|
|
26037
|
-
"
|
|
26038
|
-
"chatgpt-account-id",
|
|
26055
|
+
"host",
|
|
26056
|
+
"version",
|
|
26057
|
+
"x-codex-beta-features",
|
|
26039
26058
|
"originator",
|
|
26040
|
-
"
|
|
26041
|
-
"
|
|
26042
|
-
"
|
|
26043
|
-
"
|
|
26044
|
-
"
|
|
26045
|
-
"
|
|
26046
|
-
"
|
|
26047
|
-
"
|
|
26059
|
+
"x-client-request-id",
|
|
26060
|
+
"session-id",
|
|
26061
|
+
"thread-id",
|
|
26062
|
+
"accept",
|
|
26063
|
+
"content-type",
|
|
26064
|
+
"authorization",
|
|
26065
|
+
"chatgpt-account-id",
|
|
26066
|
+
"user-agent",
|
|
26067
|
+
"accept-encoding",
|
|
26068
|
+
"content-length"
|
|
26048
26069
|
])
|
|
26049
26070
|
};
|
|
26050
26071
|
var openaiBodyOrder = [
|
|
@@ -32502,11 +32523,13 @@ async function* decodeResponses(messages, options = {}) {
|
|
|
32502
32523
|
|
|
32503
32524
|
// packages/providers/src/openai/wire.ts
|
|
32504
32525
|
import { createHash as createHash6 } from "crypto";
|
|
32526
|
+
var MAX_CACHE_KEY_LENGTH = 1024;
|
|
32527
|
+
var HEADER_SAFE_KEY = /^[\x21-\x7e]+$/;
|
|
32505
32528
|
function suppliedKey2(req) {
|
|
32506
32529
|
const vendor = req.vendor?.openai;
|
|
32507
32530
|
for (const name of ["prompt_cache_key", "session_id"]) {
|
|
32508
32531
|
const value = vendor?.[name];
|
|
32509
|
-
if (typeof value === "string" && value.length
|
|
32532
|
+
if (typeof value === "string" && value.length <= MAX_CACHE_KEY_LENGTH && HEADER_SAFE_KEY.test(value))
|
|
32510
32533
|
return value;
|
|
32511
32534
|
}
|
|
32512
32535
|
return;
|
|
@@ -32689,18 +32712,18 @@ var openaiCodec = {
|
|
|
32689
32712
|
buildRequest(input2) {
|
|
32690
32713
|
const oauth = input2.credentials.accessToken !== null;
|
|
32691
32714
|
const { body, degradations, cacheKey: cacheKey3 } = toResponsesWire(input2.request, input2.model, { oauth });
|
|
32692
|
-
const protocol = [["
|
|
32715
|
+
const protocol = [["content-type", "application/json"]];
|
|
32693
32716
|
if (oauth) {
|
|
32694
|
-
protocol.push(["
|
|
32717
|
+
protocol.push(["authorization", `Bearer ${input2.credentials.accessToken}`]);
|
|
32695
32718
|
const accountId = input2.credentials.providerData.accountId;
|
|
32696
32719
|
if (typeof accountId === "string")
|
|
32697
32720
|
protocol.push(["chatgpt-account-id", accountId]);
|
|
32698
|
-
protocol.push(["session_id", cacheKey3]);
|
|
32699
32721
|
} else if (input2.credentials.apiKey !== null) {
|
|
32700
|
-
protocol.push(["
|
|
32722
|
+
protocol.push(["authorization", `Bearer ${input2.credentials.apiKey}`]);
|
|
32701
32723
|
} else {
|
|
32702
32724
|
throw input2.fail("AUTH", "openai credential has no token");
|
|
32703
32725
|
}
|
|
32726
|
+
protocol.push(["x-client-request-id", cacheKey3], ["session-id", cacheKey3], ["thread-id", cacheKey3]);
|
|
32704
32727
|
const headers = orderHeaders(mergeHeaders(openaiProfile.headers, protocol), openaiProfile.order);
|
|
32705
32728
|
const include = body.include;
|
|
32706
32729
|
const nativeReasoning = Array.isArray(include) && include.includes("reasoning.encrypted_content");
|
|
@@ -38542,7 +38565,7 @@ function createServiceDeps(input2) {
|
|
|
38542
38565
|
}
|
|
38543
38566
|
|
|
38544
38567
|
// apps/cli/src/version.ts
|
|
38545
|
-
var VERSION = "0.13.
|
|
38568
|
+
var VERSION = "0.13.2";
|
|
38546
38569
|
|
|
38547
38570
|
// apps/cli/src/commands/service.ts
|
|
38548
38571
|
function gatewayArgv(root) {
|
package/gateway.js
CHANGED
|
@@ -30160,12 +30160,24 @@ var ANTHROPIC_MODELS = {
|
|
|
30160
30160
|
pricing: { input: 5, output: 25, cacheRead: 0.5, cacheWrite5m: 6.25, cacheWrite1h: 10 },
|
|
30161
30161
|
limits: { contextWindow: 1e6, maxOutputTokens: 128000 }
|
|
30162
30162
|
},
|
|
30163
|
+
{
|
|
30164
|
+
id: "claude-sonnet-5-5",
|
|
30165
|
+
label: "Claude Sonnet 5.5",
|
|
30166
|
+
pricing: { input: 2, output: 10, cacheRead: 0.1, cacheWrite5m: 2.5, cacheWrite1h: 4 },
|
|
30167
|
+
limits: { contextWindow: 1e6, maxOutputTokens: 128000 }
|
|
30168
|
+
},
|
|
30163
30169
|
{
|
|
30164
30170
|
id: "claude-sonnet-5",
|
|
30165
30171
|
label: "Claude Sonnet 5",
|
|
30166
30172
|
pricing: { input: 2, output: 10, cacheRead: 0.2, cacheWrite5m: 2.5, cacheWrite1h: 4 },
|
|
30167
30173
|
limits: { contextWindow: 1e6, maxOutputTokens: 128000 }
|
|
30168
30174
|
},
|
|
30175
|
+
{
|
|
30176
|
+
id: "claude-haiku-5-5",
|
|
30177
|
+
label: "Claude Haiku 5.5",
|
|
30178
|
+
pricing: { input: 0.1, output: 0.5, cacheRead: 0.01, cacheWrite5m: 0.125, cacheWrite1h: 0.2 },
|
|
30179
|
+
limits: { contextWindow: 1e6, maxOutputTokens: 128000 }
|
|
30180
|
+
},
|
|
30169
30181
|
{
|
|
30170
30182
|
id: "claude-haiku-4-5",
|
|
30171
30183
|
label: "Claude Haiku 4.5",
|
|
@@ -30737,7 +30749,7 @@ var museDescriptor = {
|
|
|
30737
30749
|
|
|
30738
30750
|
// packages/providers/src/openai/models.ts
|
|
30739
30751
|
var OPENAI_MODELS = {
|
|
30740
|
-
defaultModel: "gpt-6-sol",
|
|
30752
|
+
defaultModel: "gpt-6.1-sol",
|
|
30741
30753
|
authTypes: ["oauth", "apiKey"],
|
|
30742
30754
|
models: [
|
|
30743
30755
|
{
|
|
@@ -30747,6 +30759,13 @@ var OPENAI_MODELS = {
|
|
|
30747
30759
|
limits: { contextWindow: 922000, maxOutputTokens: 128000 },
|
|
30748
30760
|
oauthLimits: { contextWindow: 272000, maxOutputTokens: 128000 }
|
|
30749
30761
|
},
|
|
30762
|
+
{
|
|
30763
|
+
id: "gpt-6.1-sol",
|
|
30764
|
+
label: "GPT-6.1 Sol",
|
|
30765
|
+
pricing: { input: 2, output: 10, cacheRead: 0.1, cacheWrite5m: 2.5, cacheWrite1h: 0 },
|
|
30766
|
+
limits: { contextWindow: 922000, maxOutputTokens: 128000 },
|
|
30767
|
+
oauthLimits: { contextWindow: 272000, maxOutputTokens: 128000 }
|
|
30768
|
+
},
|
|
30750
30769
|
{
|
|
30751
30770
|
id: "gpt-6-sol",
|
|
30752
30771
|
label: "GPT-6 Sol",
|
|
@@ -31562,35 +31581,37 @@ var museBodyOrder = [
|
|
|
31562
31581
|
];
|
|
31563
31582
|
|
|
31564
31583
|
// packages/providers/src/openai/profile.ts
|
|
31565
|
-
var OPENAI_CLI_VERSION = env("OMNI_OPENAI_CLI_VERSION", "0.
|
|
31584
|
+
var OPENAI_CLI_VERSION = env("OMNI_OPENAI_CLI_VERSION", "0.159.2");
|
|
31566
31585
|
var OPENAI_UA_PLATFORM = env("OMNI_OPENAI_UA_PLATFORM", "Windows 10.0.26200");
|
|
31567
|
-
var OPENAI_UA_ARCH = env("OMNI_OPENAI_UA_ARCH", "
|
|
31586
|
+
var OPENAI_UA_ARCH = env("OMNI_OPENAI_UA_ARCH", "x86_64");
|
|
31587
|
+
var OPENAI_UA_TERMINAL = env("OMNI_OPENAI_UA_TERMINAL", "WindowsTerminal");
|
|
31588
|
+
var originator = env("OMNI_OPENAI_ORIGINATOR", "codex_cli_rs");
|
|
31568
31589
|
var openaiProfile = {
|
|
31569
31590
|
headers: [
|
|
31570
31591
|
[
|
|
31571
|
-
"
|
|
31572
|
-
env("OMNI_UA_OPENAI",
|
|
31592
|
+
"user-agent",
|
|
31593
|
+
env("OMNI_UA_OPENAI", `${originator}/${OPENAI_CLI_VERSION} (${OPENAI_UA_PLATFORM}; ${OPENAI_UA_ARCH}) ${OPENAI_UA_TERMINAL}`)
|
|
31573
31594
|
],
|
|
31574
|
-
["originator",
|
|
31575
|
-
["
|
|
31576
|
-
["
|
|
31577
|
-
["
|
|
31578
|
-
["Accept", "text/event-stream"]
|
|
31595
|
+
["originator", originator],
|
|
31596
|
+
["version", OPENAI_CLI_VERSION],
|
|
31597
|
+
["x-codex-beta-features", "remote_compaction_v2"],
|
|
31598
|
+
["accept", "text/event-stream"]
|
|
31579
31599
|
],
|
|
31580
31600
|
order: envOrder("OMNI_ORDER_OPENAI", [
|
|
31581
|
-
"
|
|
31582
|
-
"
|
|
31583
|
-
"
|
|
31584
|
-
"chatgpt-account-id",
|
|
31601
|
+
"host",
|
|
31602
|
+
"version",
|
|
31603
|
+
"x-codex-beta-features",
|
|
31585
31604
|
"originator",
|
|
31586
|
-
"
|
|
31587
|
-
"
|
|
31588
|
-
"
|
|
31589
|
-
"
|
|
31590
|
-
"
|
|
31591
|
-
"
|
|
31592
|
-
"
|
|
31593
|
-
"
|
|
31605
|
+
"x-client-request-id",
|
|
31606
|
+
"session-id",
|
|
31607
|
+
"thread-id",
|
|
31608
|
+
"accept",
|
|
31609
|
+
"content-type",
|
|
31610
|
+
"authorization",
|
|
31611
|
+
"chatgpt-account-id",
|
|
31612
|
+
"user-agent",
|
|
31613
|
+
"accept-encoding",
|
|
31614
|
+
"content-length"
|
|
31594
31615
|
])
|
|
31595
31616
|
};
|
|
31596
31617
|
var openaiBodyOrder = [
|
|
@@ -38064,11 +38085,13 @@ async function* decodeResponses(messages, options = {}) {
|
|
|
38064
38085
|
|
|
38065
38086
|
// packages/providers/src/openai/wire.ts
|
|
38066
38087
|
import { createHash as createHash6 } from "crypto";
|
|
38088
|
+
var MAX_CACHE_KEY_LENGTH = 1024;
|
|
38089
|
+
var HEADER_SAFE_KEY = /^[\x21-\x7e]+$/;
|
|
38067
38090
|
function suppliedKey2(req) {
|
|
38068
38091
|
const vendor = req.vendor?.openai;
|
|
38069
38092
|
for (const name of ["prompt_cache_key", "session_id"]) {
|
|
38070
38093
|
const value = vendor?.[name];
|
|
38071
|
-
if (typeof value === "string" && value.length
|
|
38094
|
+
if (typeof value === "string" && value.length <= MAX_CACHE_KEY_LENGTH && HEADER_SAFE_KEY.test(value))
|
|
38072
38095
|
return value;
|
|
38073
38096
|
}
|
|
38074
38097
|
return;
|
|
@@ -38251,18 +38274,18 @@ var openaiCodec = {
|
|
|
38251
38274
|
buildRequest(input2) {
|
|
38252
38275
|
const oauth = input2.credentials.accessToken !== null;
|
|
38253
38276
|
const { body, degradations, cacheKey: cacheKey3 } = toResponsesWire(input2.request, input2.model, { oauth });
|
|
38254
|
-
const protocol = [["
|
|
38277
|
+
const protocol = [["content-type", "application/json"]];
|
|
38255
38278
|
if (oauth) {
|
|
38256
|
-
protocol.push(["
|
|
38279
|
+
protocol.push(["authorization", `Bearer ${input2.credentials.accessToken}`]);
|
|
38257
38280
|
const accountId = input2.credentials.providerData.accountId;
|
|
38258
38281
|
if (typeof accountId === "string")
|
|
38259
38282
|
protocol.push(["chatgpt-account-id", accountId]);
|
|
38260
|
-
protocol.push(["session_id", cacheKey3]);
|
|
38261
38283
|
} else if (input2.credentials.apiKey !== null) {
|
|
38262
|
-
protocol.push(["
|
|
38284
|
+
protocol.push(["authorization", `Bearer ${input2.credentials.apiKey}`]);
|
|
38263
38285
|
} else {
|
|
38264
38286
|
throw input2.fail("AUTH", "openai credential has no token");
|
|
38265
38287
|
}
|
|
38288
|
+
protocol.push(["x-client-request-id", cacheKey3], ["session-id", cacheKey3], ["thread-id", cacheKey3]);
|
|
38266
38289
|
const headers = orderHeaders(mergeHeaders(openaiProfile.headers, protocol), openaiProfile.order);
|
|
38267
38290
|
const include = body.include;
|
|
38268
38291
|
const nativeReasoning = Array.isArray(include) && include.includes("reasoning.encrypted_content");
|
|
@@ -63488,7 +63511,7 @@ function createRing(limits = DEFAULT_RING_LIMITS) {
|
|
|
63488
63511
|
}
|
|
63489
63512
|
|
|
63490
63513
|
// apps/gateway/src/version.ts
|
|
63491
|
-
var VERSION = "0.13.
|
|
63514
|
+
var VERSION = "0.13.2";
|
|
63492
63515
|
|
|
63493
63516
|
// apps/gateway/src/app.ts
|
|
63494
63517
|
var ADMIN_SESSION_TTL_MS = 12 * 60 * 60 * 1000;
|
package/package.json
CHANGED