@nyte-ai/ai 0.0.0-stage → 0.0.19
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/LICENSE +21 -0
- package/README.md +170 -2
- package/THIRD-PARTY-NOTICES.md +866 -0
- package/dist/chunks/account-limits-cache-031vfpt3.js +37 -0
- package/dist/chunks/account-limits-cache-09vs98g6.js +41 -0
- package/dist/chunks/account-limits-cache-0af5gqeg.js +15 -0
- package/dist/chunks/account-limits-cache-0yd6bde8.js +103 -0
- package/dist/chunks/account-limits-cache-1jv43fhh.js +22 -0
- package/dist/chunks/account-limits-cache-3ykqmnj5.js +88 -0
- package/dist/chunks/account-limits-cache-4b8ckwqw.js +293 -0
- package/dist/chunks/account-limits-cache-4fn5w63p.js +295 -0
- package/dist/chunks/account-limits-cache-4hptgd2h.js +49 -0
- package/dist/chunks/account-limits-cache-53e64mhx.js +417 -0
- package/dist/chunks/account-limits-cache-5jdhn0e1.js +562 -0
- package/dist/chunks/account-limits-cache-5rx2pfm5.js +8 -0
- package/dist/chunks/account-limits-cache-5ygxyyss.js +19 -0
- package/dist/chunks/account-limits-cache-6250ykn6.js +21 -0
- package/dist/chunks/account-limits-cache-6x05n06z.js +49 -0
- package/dist/chunks/account-limits-cache-736tdyme.js +6 -0
- package/dist/chunks/account-limits-cache-75smws02.js +213 -0
- package/dist/chunks/account-limits-cache-7z9s8j16.js +139 -0
- package/dist/chunks/account-limits-cache-8137j3zp.js +37 -0
- package/dist/chunks/account-limits-cache-8qzk56vj.js +160 -0
- package/dist/chunks/account-limits-cache-8s8bz4dr.js +36 -0
- package/dist/chunks/account-limits-cache-8vzx8k6r.js +166 -0
- package/dist/chunks/account-limits-cache-8wfqg73s.js +135 -0
- package/dist/chunks/account-limits-cache-90c9c2eb.js +50 -0
- package/dist/chunks/account-limits-cache-9wqk28n5.js +25 -0
- package/dist/chunks/account-limits-cache-a1jyaq00.js +56 -0
- package/dist/chunks/account-limits-cache-a558rjbg.js +138 -0
- package/dist/chunks/account-limits-cache-a55e14fr.js +70 -0
- package/dist/chunks/account-limits-cache-a6cgeagz.js +77 -0
- package/dist/chunks/account-limits-cache-ag5b8dja.js +38 -0
- package/dist/chunks/account-limits-cache-b0x2sfya.js +45 -0
- package/dist/chunks/account-limits-cache-b23sbrke.js +26 -0
- package/dist/chunks/account-limits-cache-b4edaybk.js +8 -0
- package/dist/chunks/account-limits-cache-bsknrh6t.js +74 -0
- package/dist/chunks/account-limits-cache-csbxvam7.js +12 -0
- package/dist/chunks/account-limits-cache-cw7q7vfy.js +293 -0
- package/dist/chunks/account-limits-cache-d1ypzqzp.js +27 -0
- package/dist/chunks/account-limits-cache-d2a51dka.js +17 -0
- package/dist/chunks/account-limits-cache-dejeygdt.js +114 -0
- package/dist/chunks/account-limits-cache-eejm0vth.js +11 -0
- package/dist/chunks/account-limits-cache-ehy0ze2b.js +33 -0
- package/dist/chunks/account-limits-cache-emg5b4hj.js +53 -0
- package/dist/chunks/account-limits-cache-eqwweapz.js +6 -0
- package/dist/chunks/account-limits-cache-eyx1jcxc.js +8 -0
- package/dist/chunks/account-limits-cache-f9z00x8c.js +36 -0
- package/dist/chunks/account-limits-cache-fbkaq46e.js +113 -0
- package/dist/chunks/account-limits-cache-fdwad56n.js +399 -0
- package/dist/chunks/account-limits-cache-fht68jp2.js +22 -0
- package/dist/chunks/account-limits-cache-fp03ztsw.js +17 -0
- package/dist/chunks/account-limits-cache-fsktnetm.js +69 -0
- package/dist/chunks/account-limits-cache-fvadc36m.js +110 -0
- package/dist/chunks/account-limits-cache-gknnm1kv.js +13 -0
- package/dist/chunks/account-limits-cache-gqsrbky9.js +40 -0
- package/dist/chunks/account-limits-cache-gr671dr2.js +0 -0
- package/dist/chunks/account-limits-cache-gs8a3fhw.js +32 -0
- package/dist/chunks/account-limits-cache-gsa5tzck.js +37 -0
- package/dist/chunks/account-limits-cache-h92bzz1j.js +235 -0
- package/dist/chunks/account-limits-cache-hemxtapd.js +142 -0
- package/dist/chunks/account-limits-cache-hj1h48sc.js +92 -0
- package/dist/chunks/account-limits-cache-hj3ek3ty.js +128 -0
- package/dist/chunks/account-limits-cache-hwehc67r.js +509 -0
- package/dist/chunks/account-limits-cache-hyzn1jmk.js +46 -0
- package/dist/chunks/account-limits-cache-j2bt392s.js +63 -0
- package/dist/chunks/account-limits-cache-k0pkzhbx.js +74 -0
- package/dist/chunks/account-limits-cache-kjx405q0.js +277 -0
- package/dist/chunks/account-limits-cache-ks1sjym9.js +37 -0
- package/dist/chunks/account-limits-cache-me1x57bs.js +89 -0
- package/dist/chunks/account-limits-cache-n3yk6g5c.js +314 -0
- package/dist/chunks/account-limits-cache-nbhht7xz.js +72 -0
- package/dist/chunks/account-limits-cache-nbkyhs6v.js +42 -0
- package/dist/chunks/account-limits-cache-nn9jebsj.js +26 -0
- package/dist/chunks/account-limits-cache-nxkprk3g.js +13 -0
- package/dist/chunks/account-limits-cache-nyy770yd.js +38 -0
- package/dist/chunks/account-limits-cache-pfa86y8e.js +45 -0
- package/dist/chunks/account-limits-cache-pfr14mcn.js +59 -0
- package/dist/chunks/account-limits-cache-q1ebtvet.js +8 -0
- package/dist/chunks/account-limits-cache-q63mc41j.js +51 -0
- package/dist/chunks/account-limits-cache-re8hpzwn.js +104 -0
- package/dist/chunks/account-limits-cache-rz8p1g5y.js +9 -0
- package/dist/chunks/account-limits-cache-skbfmzqe.js +7 -0
- package/dist/chunks/account-limits-cache-tc38g0ca.js +20 -0
- package/dist/chunks/account-limits-cache-v4n30az2.js +24 -0
- package/dist/chunks/account-limits-cache-vwgfz727.js +281 -0
- package/dist/chunks/account-limits-cache-wtg64ez7.js +69 -0
- package/dist/chunks/account-limits-cache-x9fvb3s5.js +8 -0
- package/dist/chunks/account-limits-cache-xds88kxd.js +209 -0
- package/dist/chunks/account-limits-cache-xz65wyd1.js +428 -0
- package/dist/chunks/account-limits-cache-ydq8p8qp.js +39 -0
- package/dist/chunks/account-limits-cache-ykbqsvv6.js +134 -0
- package/dist/chunks/account-limits-cache-yzyp0c2h.js +251 -0
- package/dist/chunks/account-limits-cache-za42x8a3.js +25 -0
- package/dist/chunks/account-limits-cache-zcbkmrvy.js +79 -0
- package/dist/chunks/account-limits-cache-zgzptd0z.js +62 -0
- package/dist/chunks/account-limits-cache-zn01kscn.js +252 -0
- package/dist/chunks/account-limits-cache-zpjmeyt0.js +113 -0
- package/dist/chunks/account-limits-cache-zqdb4yh4.js +8 -0
- package/dist/src/account-limits-cache.d.ts +16 -0
- package/dist/src/account-limits-cache.js +7 -0
- package/dist/src/api/anthropic-client.d.ts +25 -0
- package/dist/src/api/anthropic-client.js +30 -0
- package/dist/src/api/anthropic-convert.d.ts +17 -0
- package/dist/src/api/anthropic-convert.js +14 -0
- package/dist/src/api/anthropic-events.d.ts +101 -0
- package/dist/src/api/anthropic-events.js +11 -0
- package/dist/src/api/anthropic-messages.d.ts +88 -0
- package/dist/src/api/anthropic-messages.js +578 -0
- package/dist/src/api/anthropic-messages.lazy.d.ts +2 -0
- package/dist/src/api/anthropic-messages.lazy.js +11 -0
- package/dist/src/api/assistant-stream.d.ts +23 -0
- package/dist/src/api/assistant-stream.js +15 -0
- package/dist/src/api/claude-code.d.ts +12 -0
- package/dist/src/api/claude-code.js +12 -0
- package/dist/src/api/cloudflare.d.ts +8 -0
- package/dist/src/api/cloudflare.js +11 -0
- package/dist/src/api/constrained-sampling.d.ts +24 -0
- package/dist/src/api/constrained-sampling.js +16 -0
- package/dist/src/api/deferred.d.ts +7 -0
- package/dist/src/api/deferred.js +10 -0
- package/dist/src/api/github-copilot-headers.d.ts +15 -0
- package/dist/src/api/github-copilot-headers.js +12 -0
- package/dist/src/api/google-generative-ai.d.ts +22 -0
- package/dist/src/api/google-generative-ai.js +583 -0
- package/dist/src/api/google-generative-ai.lazy.d.ts +2 -0
- package/dist/src/api/google-generative-ai.lazy.js +11 -0
- package/dist/src/api/lazy.d.ts +18 -0
- package/dist/src/api/lazy.js +12 -0
- package/dist/src/api/openai-codex-compact.d.ts +14 -0
- package/dist/src/api/openai-codex-compact.js +389 -0
- package/dist/src/api/openai-codex-compaction-error.d.ts +7 -0
- package/dist/src/api/openai-codex-compaction-error.js +6 -0
- package/dist/src/api/openai-codex-protocol.d.ts +125 -0
- package/dist/src/api/openai-codex-protocol.js +48 -0
- package/dist/src/api/openai-codex-responses.d.ts +4 -0
- package/dist/src/api/openai-codex-responses.js +175 -0
- package/dist/src/api/openai-codex-responses.lazy.d.ts +2 -0
- package/dist/src/api/openai-codex-responses.lazy.js +11 -0
- package/dist/src/api/openai-codex-websocket.d.ts +13 -0
- package/dist/src/api/openai-codex-websocket.js +37 -0
- package/dist/src/api/openai-codex-wire.d.ts +44 -0
- package/dist/src/api/openai-codex-wire.js +34 -0
- package/dist/src/api/openai-compact.d.ts +9 -0
- package/dist/src/api/openai-compact.js +12 -0
- package/dist/src/api/openai-completions-convert.d.ts +58 -0
- package/dist/src/api/openai-completions-convert.js +21 -0
- package/dist/src/api/openai-completions-params.d.ts +29 -0
- package/dist/src/api/openai-completions-params.js +20 -0
- package/dist/src/api/openai-completions-reasoning.d.ts +54 -0
- package/dist/src/api/openai-completions-reasoning.js +22 -0
- package/dist/src/api/openai-completions.d.ts +22 -0
- package/dist/src/api/openai-completions.js +484 -0
- package/dist/src/api/openai-completions.lazy.d.ts +5 -0
- package/dist/src/api/openai-completions.lazy.js +11 -0
- package/dist/src/api/openai-prompt-cache.d.ts +1 -0
- package/dist/src/api/openai-prompt-cache.js +6 -0
- package/dist/src/api/openai-responses-convert.d.ts +58 -0
- package/dist/src/api/openai-responses-convert.js +16 -0
- package/dist/src/api/openai-responses-events.d.ts +379 -0
- package/dist/src/api/openai-responses-events.js +12 -0
- package/dist/src/api/openai-responses-stream.d.ts +36 -0
- package/dist/src/api/openai-responses-stream.js +25 -0
- package/dist/src/api/openai-responses.d.ts +18 -0
- package/dist/src/api/openai-responses.js +276 -0
- package/dist/src/api/openai-responses.lazy.d.ts +2 -0
- package/dist/src/api/openai-responses.lazy.js +11 -0
- package/dist/src/api/simple-options.d.ts +17 -0
- package/dist/src/api/simple-options.js +18 -0
- package/dist/src/api/token-count.d.ts +5 -0
- package/dist/src/api/token-count.js +8 -0
- package/dist/src/api/transform-messages.d.ts +9 -0
- package/dist/src/api/transform-messages.js +6 -0
- package/dist/src/api-options.d.ts +27 -0
- package/dist/src/api-options.js +0 -0
- package/dist/src/auth/context.d.ts +11 -0
- package/dist/src/auth/context.js +6 -0
- package/dist/src/auth/credential-store.d.ts +17 -0
- package/dist/src/auth/credential-store.js +7 -0
- package/dist/src/auth/helpers.d.ts +24 -0
- package/dist/src/auth/helpers.js +8 -0
- package/dist/src/auth/oauth/anthropic.d.ts +7 -0
- package/dist/src/auth/oauth/anthropic.js +12 -0
- package/dist/src/auth/oauth/authorization-input.d.ts +14 -0
- package/dist/src/auth/oauth/authorization-input.js +6 -0
- package/dist/src/auth/oauth/device-code.d.ts +29 -0
- package/dist/src/auth/oauth/device-code.js +9 -0
- package/dist/src/auth/oauth/github-copilot.d.ts +23 -0
- package/dist/src/auth/oauth/github-copilot.js +12 -0
- package/dist/src/auth/oauth/load.d.ts +14 -0
- package/dist/src/auth/oauth/load.js +10 -0
- package/dist/src/auth/oauth/oauth-page.d.ts +13 -0
- package/dist/src/auth/oauth/oauth-page.js +8 -0
- package/dist/src/auth/oauth/openai-codex.d.ts +10 -0
- package/dist/src/auth/oauth/openai-codex.js +18 -0
- package/dist/src/auth/oauth/pkce.d.ts +12 -0
- package/dist/src/auth/oauth/pkce.js +6 -0
- package/dist/src/auth/resolve.d.ts +38 -0
- package/dist/src/auth/resolve.js +12 -0
- package/dist/src/auth/store.d.ts +29 -0
- package/dist/src/auth/store.js +10 -0
- package/dist/src/auth/types.d.ts +291 -0
- package/dist/src/auth/types.js +8 -0
- package/dist/src/auth/verify.d.ts +13 -0
- package/dist/src/auth/verify.js +7 -0
- package/dist/src/bun-oauth.d.ts +2 -0
- package/dist/src/bun-oauth.js +25 -0
- package/dist/src/env-api-keys.d.ts +32 -0
- package/dist/src/env-api-keys.js +27 -0
- package/dist/src/file-models-store.d.ts +18 -0
- package/dist/src/file-models-store.js +9 -0
- package/dist/src/index.d.ts +62 -0
- package/dist/src/index.js +372 -0
- package/dist/src/model-capabilities.d.ts +21 -0
- package/dist/src/model-capabilities.js +14 -0
- package/dist/src/model-pricing.d.ts +6 -0
- package/dist/src/model-pricing.js +10 -0
- package/dist/src/model-variants.d.ts +21 -0
- package/dist/src/model-variants.js +19 -0
- package/dist/src/models-refresh.d.ts +27 -0
- package/dist/src/models-refresh.js +9 -0
- package/dist/src/models-store.d.ts +31 -0
- package/dist/src/models-store.js +6 -0
- package/dist/src/models-types.d.ts +206 -0
- package/dist/src/models-types.js +0 -0
- package/dist/src/models.d.ts +7 -0
- package/dist/src/models.js +44 -0
- package/dist/src/prompt-cache.d.ts +5 -0
- package/dist/src/prompt-cache.js +9 -0
- package/dist/src/provider.d.ts +23 -0
- package/dist/src/provider.js +14 -0
- package/dist/src/providers/account-limits.d.ts +13 -0
- package/dist/src/providers/account-limits.js +8 -0
- package/dist/src/providers/anthropic-limits.d.ts +9 -0
- package/dist/src/providers/anthropic-limits.js +10 -0
- package/dist/src/providers/anthropic.d.ts +2 -0
- package/dist/src/providers/anthropic.js +25 -0
- package/dist/src/providers/github-copilot-catalog.d.ts +5 -0
- package/dist/src/providers/github-copilot-catalog.js +7 -0
- package/dist/src/providers/github-copilot.d.ts +2 -0
- package/dist/src/providers/github-copilot.js +23 -0
- package/dist/src/providers/nyte-catalog.d.ts +15 -0
- package/dist/src/providers/nyte-catalog.js +63 -0
- package/dist/src/providers/openai-codex-limits.d.ts +8 -0
- package/dist/src/providers/openai-codex-limits.js +14 -0
- package/dist/src/providers/openai-codex.d.ts +2 -0
- package/dist/src/providers/openai-codex.js +23 -0
- package/dist/src/providers/openai.d.ts +2 -0
- package/dist/src/providers/openai.js +19 -0
- package/dist/src/providers/opencode-go.d.ts +5 -0
- package/dist/src/providers/opencode-go.js +22 -0
- package/dist/src/providers/opencode-headers.d.ts +5 -0
- package/dist/src/providers/opencode-headers.js +6 -0
- package/dist/src/providers/opencode.d.ts +14 -0
- package/dist/src/providers/opencode.js +23 -0
- package/dist/src/providers/openrouter.d.ts +2 -0
- package/dist/src/providers/openrouter.js +19 -0
- package/dist/src/providers/vercel-ai-gateway.d.ts +3 -0
- package/dist/src/providers/vercel-ai-gateway.js +19 -0
- package/dist/src/session-resources.d.ts +9 -0
- package/dist/src/session-resources.js +10 -0
- package/dist/src/types.d.ts +210 -0
- package/dist/src/types.js +1 -0
- package/dist/src/utils/abort.d.ts +12 -0
- package/dist/src/utils/abort.js +10 -0
- package/dist/src/utils/deferred-tools.d.ts +11 -0
- package/dist/src/utils/deferred-tools.js +6 -0
- package/dist/src/utils/diagnostics.d.ts +11 -0
- package/dist/src/utils/diagnostics.js +12 -0
- package/dist/src/utils/error-body.d.ts +26 -0
- package/dist/src/utils/error-body.js +10 -0
- package/dist/src/utils/estimate.d.ts +20 -0
- package/dist/src/utils/estimate.js +14 -0
- package/dist/src/utils/event-stream.d.ts +22 -0
- package/dist/src/utils/event-stream.js +11 -0
- package/dist/src/utils/failure.d.ts +49 -0
- package/dist/src/utils/failure.js +10 -0
- package/dist/src/utils/fifo-queue.d.ts +11 -0
- package/dist/src/utils/fifo-queue.js +6 -0
- package/dist/src/utils/hash.d.ts +5 -0
- package/dist/src/utils/hash.js +6 -0
- package/dist/src/utils/headers.d.ts +12 -0
- package/dist/src/utils/headers.js +14 -0
- package/dist/src/utils/json-parse.d.ts +33 -0
- package/dist/src/utils/json-parse.js +12 -0
- package/dist/src/utils/node-http-proxy.d.ts +6 -0
- package/dist/src/utils/node-http-proxy.js +9 -0
- package/dist/src/utils/nyte-home.d.ts +2 -0
- package/dist/src/utils/nyte-home.js +6 -0
- package/dist/src/utils/nyte-user-agent.d.ts +1 -0
- package/dist/src/utils/nyte-user-agent.js +6 -0
- package/dist/src/utils/overflow.d.ts +18 -0
- package/dist/src/utils/overflow.js +9 -0
- package/dist/src/utils/provider-env.d.ts +9 -0
- package/dist/src/utils/provider-env.js +6 -0
- package/dist/src/utils/provider-retry.d.ts +22 -0
- package/dist/src/utils/provider-retry.js +9 -0
- package/dist/src/utils/retry.d.ts +66 -0
- package/dist/src/utils/retry.js +18 -0
- package/dist/src/utils/sanitize-unicode.d.ts +24 -0
- package/dist/src/utils/sanitize-unicode.js +6 -0
- package/dist/src/utils/sse.d.ts +21 -0
- package/dist/src/utils/sse.js +6 -0
- package/dist/src/utils/text.d.ts +5 -0
- package/dist/src/utils/text.js +10 -0
- package/dist/src/utils/transcript.d.ts +5 -0
- package/dist/src/utils/transcript.js +36 -0
- package/dist/src/utils/typebox-helpers.d.ts +19 -0
- package/dist/src/utils/typebox-helpers.js +6 -0
- package/dist/src/utils/uuid.d.ts +2 -0
- package/dist/src/utils/uuid.js +6 -0
- package/dist/src/utils/validation.d.ts +13 -0
- package/dist/src/utils/validation.js +8 -0
- package/package.json +152 -3
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {
|
|
2
|
+
claudeCodeVersion2,
|
|
3
|
+
usesClaudeSubscription2
|
|
4
|
+
} from "./account-limits-cache-ks1sjym9.js";
|
|
5
|
+
import {
|
|
6
|
+
limitWindow2,
|
|
7
|
+
fetchAccountUsage2
|
|
8
|
+
} from "./account-limits-cache-ehy0ze2b.js";
|
|
9
|
+
|
|
10
|
+
// src/providers/anthropic-limits.ts
|
|
11
|
+
import { Type } from "typebox";
|
|
12
|
+
import { Value } from "typebox/value";
|
|
13
|
+
var AccountResetSchema = Type.Optional(Type.Union([Type.Number(), Type.String(), Type.Null()]));
|
|
14
|
+
var ClaudeUsageResponseSchema = Type.Record(Type.String(), Type.Unknown());
|
|
15
|
+
var ClaudeUsageWindowSchema = Type.Object({
|
|
16
|
+
utilization: Type.Number(),
|
|
17
|
+
resets_at: AccountResetSchema
|
|
18
|
+
});
|
|
19
|
+
var ClaudeScopedUsageWindowSchema = Type.Object({
|
|
20
|
+
kind: Type.Literal("weekly_scoped"),
|
|
21
|
+
scope: Type.Object({ model: Type.Object({ display_name: Type.String() }) }),
|
|
22
|
+
percent: Type.Number(),
|
|
23
|
+
resets_at: AccountResetSchema
|
|
24
|
+
});
|
|
25
|
+
function resetAtMs(value) {
|
|
26
|
+
if (value === null || value === undefined)
|
|
27
|
+
return;
|
|
28
|
+
if (typeof value === "number") {
|
|
29
|
+
return value < 1000000000000 ? value * 1000 : value;
|
|
30
|
+
}
|
|
31
|
+
const timestamp = Date.parse(value);
|
|
32
|
+
return Number.isFinite(timestamp) ? timestamp : undefined;
|
|
33
|
+
}
|
|
34
|
+
function accountLimitWindow(id, label, percent, reset, windowMinutes) {
|
|
35
|
+
return limitWindow2(id, label, percent, resetAtMs(reset), windowMinutes);
|
|
36
|
+
}
|
|
37
|
+
var CLAUDE_USAGE_WINDOWS = [
|
|
38
|
+
{ id: "five_hour", label: "5-hour", windowMinutes: 5 * 60 },
|
|
39
|
+
{ id: "seven_day", label: "Weekly", windowMinutes: 7 * 24 * 60 },
|
|
40
|
+
{ id: "seven_day_sonnet", label: "Sonnet weekly", windowMinutes: 7 * 24 * 60 },
|
|
41
|
+
{ id: "seven_day_opus", label: "Opus weekly", windowMinutes: 7 * 24 * 60 }
|
|
42
|
+
];
|
|
43
|
+
function claudeHeaderLimits2(headers, providerId) {
|
|
44
|
+
const windows = [];
|
|
45
|
+
for (const [id, label, suffix, windowMinutes] of [
|
|
46
|
+
["five_hour", "5-hour", "5h", 5 * 60],
|
|
47
|
+
["seven_day", "Weekly", "7d", 7 * 24 * 60]
|
|
48
|
+
]) {
|
|
49
|
+
const utilization = Number(headers[`anthropic-ratelimit-unified-${suffix}-utilization`]);
|
|
50
|
+
if (!Number.isFinite(utilization))
|
|
51
|
+
continue;
|
|
52
|
+
const reset = Number(headers[`anthropic-ratelimit-unified-${suffix}-reset`]);
|
|
53
|
+
windows.push(accountLimitWindow(id, label, utilization * 100, Number.isFinite(reset) ? reset : undefined, windowMinutes));
|
|
54
|
+
}
|
|
55
|
+
return windows.length === 0 ? undefined : { providerId, windows, observedAt: Date.now() };
|
|
56
|
+
}
|
|
57
|
+
function claudeUsageWindows(usage) {
|
|
58
|
+
const windows = [];
|
|
59
|
+
for (const definition of CLAUDE_USAGE_WINDOWS) {
|
|
60
|
+
const window = usage[definition.id];
|
|
61
|
+
if (!Value.Check(ClaudeUsageWindowSchema, window))
|
|
62
|
+
continue;
|
|
63
|
+
windows.push(accountLimitWindow(definition.id, definition.label, window.utilization, window.resets_at, definition.windowMinutes));
|
|
64
|
+
}
|
|
65
|
+
const scoped = usage["limits"];
|
|
66
|
+
for (const window of Array.isArray(scoped) ? scoped : []) {
|
|
67
|
+
if (!Value.Check(ClaudeScopedUsageWindowSchema, window))
|
|
68
|
+
continue;
|
|
69
|
+
const name = window.scope.model.display_name;
|
|
70
|
+
if (name.trim() === "")
|
|
71
|
+
continue;
|
|
72
|
+
windows.push(accountLimitWindow(`seven_day_${name}`, `${name} weekly`, window.percent, window.resets_at, 7 * 24 * 60));
|
|
73
|
+
}
|
|
74
|
+
return windows;
|
|
75
|
+
}
|
|
76
|
+
async function fetchAnthropicAccountLimits2(model, options) {
|
|
77
|
+
const apiKey = options?.apiKey;
|
|
78
|
+
if (!apiKey || !usesClaudeSubscription2(apiKey)) {
|
|
79
|
+
throw new Error("Claude usage requires Anthropic OAuth");
|
|
80
|
+
}
|
|
81
|
+
const headers = new Headers({
|
|
82
|
+
Authorization: `Bearer ${apiKey}`,
|
|
83
|
+
"Content-Type": "application/json",
|
|
84
|
+
"User-Agent": `claude-cli/${claudeCodeVersion2}`,
|
|
85
|
+
"anthropic-beta": "oauth-2025-04-20"
|
|
86
|
+
});
|
|
87
|
+
for (const source of [model.headers, options?.headers]) {
|
|
88
|
+
for (const [name, value] of Object.entries(source ?? {})) {
|
|
89
|
+
if (value === null)
|
|
90
|
+
headers.delete(name);
|
|
91
|
+
else
|
|
92
|
+
headers.set(name, value);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const baseUrl = (model.baseUrl?.trim() || "https://api.anthropic.com").replace(/\/+$/, "").replace(/\/v1$/, "");
|
|
96
|
+
const decoded = await fetchAccountUsage2(`${baseUrl}/api/oauth/usage`, headers, options, ClaudeUsageResponseSchema, "Claude");
|
|
97
|
+
return {
|
|
98
|
+
providerId: model.provider,
|
|
99
|
+
windows: claudeUsageWindows(decoded),
|
|
100
|
+
observedAt: Date.now()
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { claudeHeaderLimits2, fetchAnthropicAccountLimits2 };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// src/utils/nyte-home.ts
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
function defaultNyteHome2() {
|
|
6
|
+
return process.env["NYTE_HOME"] ?? join(homedir(), ".nyte");
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { defaultNyteHome2 };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/auth/oauth/pkce.ts
|
|
2
|
+
function base64urlEncode(bytes) {
|
|
3
|
+
let binary = "";
|
|
4
|
+
for (const byte of bytes) {
|
|
5
|
+
binary += String.fromCharCode(byte);
|
|
6
|
+
}
|
|
7
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
8
|
+
}
|
|
9
|
+
async function generatePKCE2() {
|
|
10
|
+
const verifierBytes = new Uint8Array(32);
|
|
11
|
+
crypto.getRandomValues(verifierBytes);
|
|
12
|
+
const verifier = base64urlEncode(verifierBytes);
|
|
13
|
+
const encoder = new TextEncoder;
|
|
14
|
+
const data = encoder.encode(verifier);
|
|
15
|
+
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
|
16
|
+
const challenge = base64urlEncode(new Uint8Array(hashBuffer));
|
|
17
|
+
return { verifier, challenge };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { generatePKCE2 };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/auth/oauth/load.ts
|
|
2
|
+
var registeredFlows = new Map;
|
|
3
|
+
function registerOAuthFlow2(id, flow) {
|
|
4
|
+
registeredFlows.set(id, flow);
|
|
5
|
+
}
|
|
6
|
+
async function importOAuthModule(specifier) {
|
|
7
|
+
try {
|
|
8
|
+
await import(specifier);
|
|
9
|
+
} catch (error) {
|
|
10
|
+
throw new Error(`OAuth flow module ${specifier} is not loadable at runtime. Bundled hosts must register flows up front with registerBunOAuthFlows.`, { cause: error });
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
async function loadOAuthFlow(id, specifier) {
|
|
14
|
+
if (!registeredFlows.has(id))
|
|
15
|
+
await importOAuthModule(specifier);
|
|
16
|
+
const flow = registeredFlows.get(id);
|
|
17
|
+
if (flow === undefined)
|
|
18
|
+
throw new Error(`OAuth flow module ${specifier} did not register its flow`);
|
|
19
|
+
return flow;
|
|
20
|
+
}
|
|
21
|
+
var loadAnthropicOAuth2 = () => loadOAuthFlow("anthropic", "@nyte-ai/ai/auth/oauth/anthropic");
|
|
22
|
+
var loadOpenAICodexOAuth2 = () => loadOAuthFlow("openaiCodex", "@nyte-ai/ai/auth/oauth/openai-codex");
|
|
23
|
+
|
|
24
|
+
export { registerOAuthFlow2, loadAnthropicOAuth2, loadOpenAICodexOAuth2 };
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyServiceTierPricing2
|
|
3
|
+
} from "./account-limits-cache-f9z00x8c.js";
|
|
4
|
+
import {
|
|
5
|
+
CodexFrameJson2,
|
|
6
|
+
readText2,
|
|
7
|
+
readBoolean2,
|
|
8
|
+
readNumber2,
|
|
9
|
+
readRecord2,
|
|
10
|
+
TERMINAL_RESPONSE_TYPES2
|
|
11
|
+
} from "./account-limits-cache-fvadc36m.js";
|
|
12
|
+
import {
|
|
13
|
+
codexFrameLimits2
|
|
14
|
+
} from "./account-limits-cache-hj3ek3ty.js";
|
|
15
|
+
import {
|
|
16
|
+
splitDeferredTools2
|
|
17
|
+
} from "./account-limits-cache-8s8bz4dr.js";
|
|
18
|
+
import {
|
|
19
|
+
formatThrownValue2
|
|
20
|
+
} from "./account-limits-cache-9wqk28n5.js";
|
|
21
|
+
import {
|
|
22
|
+
iterateServerSentEvents2
|
|
23
|
+
} from "./account-limits-cache-me1x57bs.js";
|
|
24
|
+
import {
|
|
25
|
+
getSystemMessageText2
|
|
26
|
+
} from "./account-limits-cache-b4edaybk.js";
|
|
27
|
+
import {
|
|
28
|
+
getDeclaredTools2,
|
|
29
|
+
getInitialSystemMessage2,
|
|
30
|
+
resolveTranscriptTools2
|
|
31
|
+
} from "./account-limits-cache-6250ykn6.js";
|
|
32
|
+
import {
|
|
33
|
+
createGrammarToolInputProperties2
|
|
34
|
+
} from "./account-limits-cache-h92bzz1j.js";
|
|
35
|
+
import {
|
|
36
|
+
convertResponsesMessages2,
|
|
37
|
+
convertResponsesTools2
|
|
38
|
+
} from "./account-limits-cache-n3yk6g5c.js";
|
|
39
|
+
|
|
40
|
+
// src/api/openai-codex-protocol.ts
|
|
41
|
+
import { Type } from "typebox";
|
|
42
|
+
import { Value } from "typebox/value";
|
|
43
|
+
var CodexResponseStatusSchema = Type.Union([
|
|
44
|
+
Type.Literal("completed"),
|
|
45
|
+
Type.Literal("incomplete"),
|
|
46
|
+
Type.Literal("failed"),
|
|
47
|
+
Type.Literal("cancelled"),
|
|
48
|
+
Type.Literal("queued"),
|
|
49
|
+
Type.Literal("in_progress")
|
|
50
|
+
]);
|
|
51
|
+
var DEFAULT_MAX_RETRIES2 = 0;
|
|
52
|
+
var REQUEST_COMPRESSION_ZSTD_LEVEL = 3;
|
|
53
|
+
var CODEX_TOOL_CALL_PROVIDERS2 = new Set([
|
|
54
|
+
"openai",
|
|
55
|
+
"openai-codex",
|
|
56
|
+
"opencode"
|
|
57
|
+
]);
|
|
58
|
+
function compressRequestBodyZstd2(bodyJson) {
|
|
59
|
+
if (typeof process === "undefined" || !(process.versions?.node || process.versions?.bun)) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
const zlib = process.getBuiltinModule("node:zlib");
|
|
64
|
+
const compressed = zlib.zstdCompressSync(bodyJson, {
|
|
65
|
+
params: { [zlib.constants.ZSTD_c_compressionLevel]: REQUEST_COMPRESSION_ZSTD_LEVEL }
|
|
66
|
+
});
|
|
67
|
+
return new Uint8Array(compressed);
|
|
68
|
+
} catch {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function buildRequestBody2(model, context, options, cacheSessionId, grammarToolInputProperties = createGrammarToolInputProperties2(getDeclaredTools2(context.messages), model.compat?.supportsOpenAIGrammarTools ?? false)) {
|
|
73
|
+
const supportsStrictMode = model.compat?.supportsStrictMode ?? true;
|
|
74
|
+
const supportsOpenAIGrammarTools = model.compat?.supportsOpenAIGrammarTools ?? false;
|
|
75
|
+
const deferredToolsMode = model.compat?.supportsAdditionalTools ? "additional-tools" : model.compat?.supportsToolSearch ? "tool-search" : undefined;
|
|
76
|
+
const transcriptTools = resolveTranscriptTools2(context.messages, deferredToolsMode !== undefined);
|
|
77
|
+
const toolPlacement = splitDeferredTools2({ messages: context.messages, tools: transcriptTools.requestTools }, deferredToolsMode !== undefined);
|
|
78
|
+
const messages = convertResponsesMessages2(model, context, CODEX_TOOL_CALL_PROVIDERS2, {
|
|
79
|
+
includeSystemPrompt: false,
|
|
80
|
+
grammarToolInputProperties,
|
|
81
|
+
supportsMidConvoSystemMessages: model.compat?.supportsMidConvoSystemMessages ?? false,
|
|
82
|
+
deferredTools: toolPlacement.deferred,
|
|
83
|
+
deferredToolsMode,
|
|
84
|
+
toolOptions: {
|
|
85
|
+
strict: null,
|
|
86
|
+
supportsStrictMode,
|
|
87
|
+
supportsOpenAIGrammarTools
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
const initialSystemMessage = getInitialSystemMessage2(context.messages);
|
|
91
|
+
const instructions = initialSystemMessage ? getSystemMessageText2(initialSystemMessage) : "";
|
|
92
|
+
const body = {
|
|
93
|
+
model: model.id,
|
|
94
|
+
store: false,
|
|
95
|
+
stream: true,
|
|
96
|
+
instructions: instructions || "You are a helpful assistant.",
|
|
97
|
+
input: messages,
|
|
98
|
+
text: { verbosity: options?.textVerbosity || "low" },
|
|
99
|
+
include: ["reasoning.encrypted_content"],
|
|
100
|
+
prompt_cache_key: cacheSessionId,
|
|
101
|
+
tool_choice: options?.toolChoice ?? "auto",
|
|
102
|
+
parallel_tool_calls: true
|
|
103
|
+
};
|
|
104
|
+
if (options?.temperature !== undefined) {
|
|
105
|
+
body.temperature = options.temperature;
|
|
106
|
+
}
|
|
107
|
+
if (options?.serviceTier !== undefined) {
|
|
108
|
+
body.service_tier = options.serviceTier;
|
|
109
|
+
}
|
|
110
|
+
if (toolPlacement.immediate.length > 0) {
|
|
111
|
+
body.tools = convertResponsesTools2(toolPlacement.immediate, {
|
|
112
|
+
strict: null,
|
|
113
|
+
supportsStrictMode,
|
|
114
|
+
supportsOpenAIGrammarTools
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
if (options?.reasoningEffort !== undefined) {
|
|
118
|
+
const effort = options.reasoningEffort === "none" ? model.thinkingLevelMap?.off === undefined ? "none" : model.thinkingLevelMap.off : model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort;
|
|
119
|
+
if (effort !== null) {
|
|
120
|
+
body.reasoning = {
|
|
121
|
+
effort,
|
|
122
|
+
summary: options.reasoningSummary ?? "auto"
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
} else if (model.reasoning && model.thinkingLevelMap?.off !== null) {
|
|
126
|
+
body.reasoning = { effort: model.thinkingLevelMap?.off ?? "none" };
|
|
127
|
+
}
|
|
128
|
+
return body;
|
|
129
|
+
}
|
|
130
|
+
function resolveCodexServiceTier2(responseServiceTier, requestServiceTier) {
|
|
131
|
+
if (responseServiceTier === "default" && (requestServiceTier === "flex" || requestServiceTier === "priority")) {
|
|
132
|
+
return requestServiceTier;
|
|
133
|
+
}
|
|
134
|
+
return responseServiceTier ?? requestServiceTier;
|
|
135
|
+
}
|
|
136
|
+
function codexStreamOptions2(request) {
|
|
137
|
+
return {
|
|
138
|
+
serviceTier: request.options?.serviceTier,
|
|
139
|
+
grammarToolInputProperties: request.grammarToolInputProperties,
|
|
140
|
+
resolveServiceTier: resolveCodexServiceTier2,
|
|
141
|
+
applyServiceTierPricing: (usage, serviceTier) => applyServiceTierPricing2(usage, serviceTier, request.model)
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
class CodexRequestError2 extends Error {
|
|
146
|
+
status;
|
|
147
|
+
headers;
|
|
148
|
+
retryable;
|
|
149
|
+
constructor(message, status, headers, retryable, options) {
|
|
150
|
+
super(message, options);
|
|
151
|
+
this.name = "CodexRequestError";
|
|
152
|
+
this.status = status;
|
|
153
|
+
this.headers = headers;
|
|
154
|
+
this.retryable = retryable;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function retryableCodexRequest2(error) {
|
|
158
|
+
return error instanceof CodexRequestError2 && error.retryable;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
class CodexApiError2 extends Error {
|
|
162
|
+
code;
|
|
163
|
+
payload;
|
|
164
|
+
constructor(message, options) {
|
|
165
|
+
super(message, { cause: options?.cause });
|
|
166
|
+
this.name = "CodexApiError";
|
|
167
|
+
this.code = options?.code;
|
|
168
|
+
this.payload = options?.payload;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
class CodexProtocolError2 extends Error {
|
|
173
|
+
payload;
|
|
174
|
+
constructor(message, options) {
|
|
175
|
+
super(message, { cause: options?.cause });
|
|
176
|
+
this.name = "CodexProtocolError";
|
|
177
|
+
this.payload = options?.payload;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function extractCodexEventError2(event) {
|
|
181
|
+
const nested = readRecord2(event.error);
|
|
182
|
+
return {
|
|
183
|
+
code: readText2(event.code) ?? readText2(nested?.code),
|
|
184
|
+
message: readText2(event.message) ?? readText2(nested?.message)
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
async function reportFrameLimits(frame, providerId, onAccountLimits) {
|
|
188
|
+
const limits = codexFrameLimits2(frame, providerId);
|
|
189
|
+
if (limits !== undefined)
|
|
190
|
+
await onAccountLimits(limits);
|
|
191
|
+
}
|
|
192
|
+
async function* mapCodexEvents2(events, output, onAccountLimits) {
|
|
193
|
+
for await (const event of events) {
|
|
194
|
+
const { type } = event;
|
|
195
|
+
if (type === "codex.rate_limits") {
|
|
196
|
+
if (onAccountLimits !== undefined) {
|
|
197
|
+
await reportFrameLimits(event, output.provider, onAccountLimits).catch(() => {
|
|
198
|
+
return;
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
if (type === "error") {
|
|
204
|
+
const { code, message } = extractCodexEventError2(event);
|
|
205
|
+
throw new CodexApiError2(`Codex error: ${message || code || JSON.stringify(event)}`, {
|
|
206
|
+
code,
|
|
207
|
+
payload: event
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
if (TERMINAL_RESPONSE_TYPES2.has(type)) {
|
|
211
|
+
const response = readRecord2(event.response);
|
|
212
|
+
const endTurn = readBoolean2(response?.end_turn);
|
|
213
|
+
const status = response?.status;
|
|
214
|
+
if (endTurn !== undefined) {
|
|
215
|
+
output.endTurn = endTurn;
|
|
216
|
+
}
|
|
217
|
+
yield {
|
|
218
|
+
...event,
|
|
219
|
+
type: "response.completed",
|
|
220
|
+
response: {
|
|
221
|
+
...response,
|
|
222
|
+
status: type === "response.failed" ? "failed" : Value.Check(CodexResponseStatusSchema, status) ? status : undefined
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
if (type === "response.failed") {
|
|
226
|
+
const failure = readRecord2(response?.error);
|
|
227
|
+
throw new CodexApiError2(readText2(failure?.message) || "Codex response failed", {
|
|
228
|
+
code: readText2(failure?.code),
|
|
229
|
+
payload: event
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
yield event;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
async function* parseSSE2(response, signal, idleTimeoutMs) {
|
|
238
|
+
if (!response.body)
|
|
239
|
+
return;
|
|
240
|
+
for await (const { data } of iterateServerSentEvents2(response.body, signal, idleTimeoutMs)) {
|
|
241
|
+
if (data.trim() === "" || data === "[DONE]")
|
|
242
|
+
continue;
|
|
243
|
+
let frame;
|
|
244
|
+
try {
|
|
245
|
+
frame = JSON.parse(data);
|
|
246
|
+
} catch (cause) {
|
|
247
|
+
throw new CodexProtocolError2(`Invalid Codex SSE JSON: ${formatThrownValue2(cause)}`, {
|
|
248
|
+
cause,
|
|
249
|
+
payload: data
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
if (Value.Check(CodexFrameJson2, frame))
|
|
253
|
+
yield frame;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
function parseJsonObject(raw) {
|
|
257
|
+
try {
|
|
258
|
+
return readRecord2(JSON.parse(raw));
|
|
259
|
+
} catch {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
function parseErrorResponse2(raw, response) {
|
|
264
|
+
const fallback = raw || response.statusText || "Request failed";
|
|
265
|
+
const err = readRecord2(parseJsonObject(raw)?.error);
|
|
266
|
+
if (!err)
|
|
267
|
+
return { message: fallback };
|
|
268
|
+
const code = readText2(err.code) ?? readText2(err.type) ?? "";
|
|
269
|
+
let friendlyMessage;
|
|
270
|
+
if (/usage_limit_reached|usage_not_included|rate_limit_exceeded/i.test(code) || response.status === 429) {
|
|
271
|
+
const planType = readText2(err.plan_type);
|
|
272
|
+
const plan = planType ? ` (${planType.toLowerCase()} plan)` : "";
|
|
273
|
+
const resetsAt = readNumber2(err.resets_at);
|
|
274
|
+
const mins = resetsAt ? Math.max(0, Math.round((resetsAt * 1000 - Date.now()) / 60000)) : undefined;
|
|
275
|
+
const when = mins !== undefined ? ` Try again in ~${mins} min.` : "";
|
|
276
|
+
friendlyMessage = `You have hit your ChatGPT usage limit${plan}.${when}`.trim();
|
|
277
|
+
}
|
|
278
|
+
return { message: readText2(err.message) || friendlyMessage || fallback, friendlyMessage };
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export { DEFAULT_MAX_RETRIES2, CODEX_TOOL_CALL_PROVIDERS2, compressRequestBodyZstd2, buildRequestBody2, resolveCodexServiceTier2, codexStreamOptions2, CodexRequestError2, retryableCodexRequest2, CodexApiError2, CodexProtocolError2, extractCodexEventError2, mapCodexEvents2, parseSSE2, parseErrorResponse2 };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defaultProviderAuthContext2
|
|
3
|
+
} from "./account-limits-cache-1jv43fhh.js";
|
|
4
|
+
import {
|
|
5
|
+
FileCredentialStore2
|
|
6
|
+
} from "./account-limits-cache-yzyp0c2h.js";
|
|
7
|
+
import {
|
|
8
|
+
FileModelsStore2
|
|
9
|
+
} from "./account-limits-cache-a55e14fr.js";
|
|
10
|
+
import {
|
|
11
|
+
createModels2
|
|
12
|
+
} from "./account-limits-cache-5jdhn0e1.js";
|
|
13
|
+
import {
|
|
14
|
+
anthropicProvider2
|
|
15
|
+
} from "./account-limits-cache-8wfqg73s.js";
|
|
16
|
+
import {
|
|
17
|
+
githubCopilotProvider2
|
|
18
|
+
} from "./account-limits-cache-a1jyaq00.js";
|
|
19
|
+
import {
|
|
20
|
+
openaiCodexProvider2
|
|
21
|
+
} from "./account-limits-cache-09vs98g6.js";
|
|
22
|
+
import {
|
|
23
|
+
openaiProvider2
|
|
24
|
+
} from "./account-limits-cache-gsa5tzck.js";
|
|
25
|
+
import {
|
|
26
|
+
opencodeProvider2
|
|
27
|
+
} from "./account-limits-cache-nbkyhs6v.js";
|
|
28
|
+
import {
|
|
29
|
+
opencodeGoProvider2
|
|
30
|
+
} from "./account-limits-cache-nyy770yd.js";
|
|
31
|
+
import {
|
|
32
|
+
openrouterProvider2
|
|
33
|
+
} from "./account-limits-cache-pfa86y8e.js";
|
|
34
|
+
import {
|
|
35
|
+
vercelAiGatewayProvider2
|
|
36
|
+
} from "./account-limits-cache-q63mc41j.js";
|
|
37
|
+
|
|
38
|
+
// src/providers/nyte-catalog.ts
|
|
39
|
+
var NYTE_PROVIDERS = [
|
|
40
|
+
openaiCodexProvider2,
|
|
41
|
+
openaiProvider2,
|
|
42
|
+
anthropicProvider2,
|
|
43
|
+
opencodeProvider2,
|
|
44
|
+
opencodeGoProvider2,
|
|
45
|
+
githubCopilotProvider2,
|
|
46
|
+
vercelAiGatewayProvider2,
|
|
47
|
+
openrouterProvider2
|
|
48
|
+
];
|
|
49
|
+
var defaultModelPerProvider2 = {
|
|
50
|
+
"openai-codex": "gpt-5.6-luna",
|
|
51
|
+
openai: "gpt-5.6-luna",
|
|
52
|
+
anthropic: "claude-opus-5"
|
|
53
|
+
};
|
|
54
|
+
function createNyteModels2() {
|
|
55
|
+
const models = createModels2({
|
|
56
|
+
credentials: new FileCredentialStore2,
|
|
57
|
+
authContext: defaultProviderAuthContext2(),
|
|
58
|
+
modelsStore: new FileModelsStore2,
|
|
59
|
+
catalog: { url: process.env.NYTE_MODELS_URL }
|
|
60
|
+
});
|
|
61
|
+
for (const provider of nyteProviders2())
|
|
62
|
+
models.setProvider(provider);
|
|
63
|
+
return models;
|
|
64
|
+
}
|
|
65
|
+
function nyteProviders2() {
|
|
66
|
+
return NYTE_PROVIDERS.map((provider) => provider());
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { defaultModelPerProvider2, createNyteModels2, nyteProviders2 };
|