@amir83nasr/10router 0.1.8 → 0.1.9
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +6 -6
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +23 -23
- package/.next/react-loadable-manifest.json +9 -0
- package/.next/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +2 -2
- package/.next/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/combos/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/media-providers/systemone/[id]/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/media-providers/systemone/[id]/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/media-providers/systemone/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/media-providers/systemone/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/media-providers/systemone/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/media-providers/systemone/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/profile/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js +2 -2
- package/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/quota/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/usage/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +5 -5
- package/.next/server/app/_not-found.segments/_full.segment.rsc +5 -5
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -5
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/cli-tools/all-statuses/route.js +1 -1
- package/.next/server/app/api/cli-tools/claude-settings/route.js +1 -1
- package/.next/server/app/api/cli-tools/codex-settings/route.js +1 -1
- package/.next/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
- package/.next/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
- package/.next/server/app/api/cli-tools/cowork-settings/route.js +1 -1
- package/.next/server/app/api/cli-tools/dsh-settings/route.js +1 -1
- package/.next/server/app/api/cli-tools/opencode-settings/route.js +1 -1
- package/.next/server/app/api/combos/[id]/route.js +1 -1
- package/.next/server/app/api/combos/route.js +1 -1
- package/.next/server/app/api/oauth/[provider]/[action]/route.js +1 -1
- package/.next/server/app/api/oauth/codex/bulk-import/route.js +1 -1
- package/.next/server/app/api/oauth/codex/import-token/route.js +1 -1
- package/.next/server/app/api/providers/[id]/models/route.js +1 -1
- package/.next/server/app/api/providers/client/route.js +1 -1
- package/.next/server/app/api/providers/route.js +1 -1
- package/.next/server/app/api/translator/send/route.js +1 -1
- package/.next/server/app/api/translator/translate/route.js +1 -1
- package/.next/server/app/api/tunnel/tailscale-install/route.js +2 -2
- package/.next/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
- package/.next/server/app/api/usage/[connectionId]/route.js +1 -1
- package/.next/server/app/api/usage/stream/route.js +2 -6
- package/.next/server/app/api/v1/audio/speech/route.js +1 -1
- package/.next/server/app/api/v1/audio/transcriptions/route.js +1 -1
- package/.next/server/app/api/v1/embeddings/route.js +1 -1
- package/.next/server/app/api/v1/images/generations/route.js +1 -1
- package/.next/server/app/api/v1/systemone/route.js +1 -1
- package/.next/server/app/api/version/route.js +1 -1
- package/.next/server/app/callback/page_client-reference-manifest.js +1 -1
- package/.next/server/app/callback.html +1 -1
- package/.next/server/app/callback.rsc +6 -6
- package/.next/server/app/callback.segments/_full.segment.rsc +6 -6
- package/.next/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +6 -6
- package/.next/server/app/dashboard/basic-chat.html +1 -1
- package/.next/server/app/dashboard/basic-chat.rsc +7 -7
- package/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/basic-chat.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/cli-tools.html +1 -1
- package/.next/server/app/dashboard/cli-tools.rsc +7 -7
- package/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/combos.html +1 -1
- package/.next/server/app/dashboard/combos.rsc +7 -7
- package/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/combos.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/endpoint.html +1 -1
- package/.next/server/app/dashboard/endpoint.rsc +7 -7
- package/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/media-providers/systemone.html +1 -1
- package/.next/server/app/dashboard/media-providers/systemone.rsc +7 -7
- package/.next/server/app/dashboard/media-providers/systemone.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/systemone/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/media-providers/systemone.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/media-providers/systemone.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/profile.html +1 -1
- package/.next/server/app/dashboard/profile.rsc +7 -7
- package/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/profile.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/providers/new.html +1 -1
- package/.next/server/app/dashboard/providers/new.rsc +7 -7
- package/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/providers.html +1 -1
- package/.next/server/app/dashboard/providers.rsc +7 -7
- package/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/providers.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/proxy-pools.html +1 -1
- package/.next/server/app/dashboard/proxy-pools.rsc +7 -7
- package/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/pxpipe.html +1 -1
- package/.next/server/app/dashboard/pxpipe.rsc +7 -7
- package/.next/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/pxpipe.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/quota.html +2 -2
- package/.next/server/app/dashboard/quota.rsc +8 -8
- package/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +8 -8
- package/.next/server/app/dashboard/quota.segments/_full.segment.rsc +8 -8
- package/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/.next/server/app/dashboard/settings/pricing.html +1 -1
- package/.next/server/app/dashboard/settings/pricing.rsc +6 -6
- package/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +6 -6
- package/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +6 -6
- package/.next/server/app/dashboard/token-saver.html +1 -1
- package/.next/server/app/dashboard/token-saver.rsc +6 -6
- package/.next/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +6 -6
- package/.next/server/app/dashboard/token-saver.segments/_full.segment.rsc +6 -6
- package/.next/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/usage.html +2 -2
- package/.next/server/app/dashboard/usage.rsc +7 -7
- package/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/usage.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard.html +1 -1
- package/.next/server/app/dashboard.rsc +7 -7
- package/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +5 -5
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +5 -5
- package/.next/server/app/index.segments/_full.segment.rsc +5 -5
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/landing/page_client-reference-manifest.js +1 -1
- package/.next/server/app/landing.html +1 -1
- package/.next/server/app/landing.rsc +6 -6
- package/.next/server/app/landing.segments/_full.segment.rsc +6 -6
- package/.next/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +6 -6
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +5 -5
- package/.next/server/app/login.segments/_full.segment.rsc +5 -5
- package/.next/server/app/login.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +5 -5
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +6 -6
- package/.next/server/chunks/1003.js +1 -1
- package/.next/server/chunks/1011.js +1 -1
- package/.next/server/chunks/1194.js +1 -1
- package/.next/server/chunks/1289.js +1 -1
- package/.next/server/chunks/1412.js +1 -1
- package/.next/server/chunks/1633.js +1 -1
- package/.next/server/chunks/1985.js +1 -1
- package/.next/server/chunks/2282.js +8 -4
- package/.next/server/chunks/2339.js +1 -1
- package/.next/server/chunks/2801.js +1 -1
- package/.next/server/chunks/3425.js +1 -1
- package/.next/server/chunks/4364.js +1 -1
- package/.next/server/chunks/460.js +1 -1
- package/.next/server/chunks/5761.js +1 -1
- package/.next/server/chunks/6056.js +1 -1
- package/.next/server/chunks/6343.js +3 -3
- package/.next/server/chunks/6823.js +1 -1
- package/.next/server/chunks/7019.js +2 -2
- package/.next/server/chunks/7348.js +1 -1
- package/.next/server/chunks/7504.js +1 -1
- package/.next/server/chunks/7535.js +2 -2
- package/.next/server/chunks/8923.js +1 -1
- package/.next/server/chunks/9018.js +1 -1
- package/.next/server/chunks/9250.js +1 -1
- package/.next/server/chunks/9429.js +1 -1
- package/.next/server/chunks/9646.js +1 -1
- package/.next/server/chunks/9817.js +67 -0
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/middleware.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{1278-605cc36f762c2ea7.js → 1278-efb46cc82262aa4e.js} +1 -1
- package/.next/static/chunks/{1471-69a7c30abf98c656.js → 1471-10f225f62f7469cc.js} +1 -1
- package/.next/static/chunks/{1699-49be310981e2759e.js → 1699-13ee6864a8a31a96.js} +2 -2
- package/.next/static/chunks/{1830-901fe48c3c62604f.js → 1830-d26d77c95932d7ce.js} +1 -1
- package/.next/static/chunks/1940.1f30124180f22498.js +1 -0
- package/.next/static/chunks/{2836-8e7f4c382297ac97.js → 2836-d97f0aa2718945d5.js} +1 -1
- package/.next/static/chunks/3445-99e12528f235cedb.js +1 -0
- package/.next/static/chunks/{3577-1f02993330d7fba7.js → 3577-cd98d40e3099e1b0.js} +1 -1
- package/.next/static/chunks/{5862-6f3a3a6d4c00100d.js → 5862-f98c2f3d480b80d2.js} +1 -1
- package/.next/static/chunks/6770-e2921b2ce695ed57.js +1 -0
- package/.next/static/chunks/7276-a15e4d56ec28aba8.js +1 -0
- package/.next/static/chunks/{9369-7ef21480b9132957.js → 9369-0d43b295968c2168.js} +1 -1
- package/.next/static/chunks/{9ce8c186-6cd204e9c27ecee1.js → 9ce8c186-3c7d7dbc5d428052.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-9efe55fed2f7c81f.js → page-e8bceccb95695755.js} +2 -2
- package/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-9dcb29085167b384.js → page-adee408d9de02423.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/combos/{page-f5db9f681c6bface.js → page-d4c1e29e8d038f09.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/console-log/{page-d134cc313c9fa0b8.js → page-139200833f7a4ecc.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/endpoint/{page-f2d1a733e7f841cb.js → page-67516b120adbc4d7.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/media-providers/systemone/[id]/{page-0d6e623de6134598.js → page-b751d9603cb82e62.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/{page-e8f1d8be5e294fb0.js → page-315c9f52c472a700.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-c96cbcc4f5736e36.js → page-d5d480e209fdc55a.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/providers/new/{page-cc51346e464158b1.js → page-61b87a31ba21a055.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/providers/{page-1ee147fbe0693dc1.js → page-2396571281d02804.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/proxy-pools/{page-2287b1915fa887fc.js → page-cfd6bcb7e55d7d18.js} +2 -2
- package/.next/static/chunks/app/(dashboard)/dashboard/pxpipe/{page-696cb5c2703ca1ec.js → page-4d758f53c8cfc308.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/quota/{page-54a329d725734a1f.js → page-fef6edb7aafd8bd0.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/usage/{page-a81f78bb43042c30.js → page-697f46461825d7fc.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/{layout-c199eb2ad56ae96a.js → layout-5039502fc12707c9.js} +1 -1
- package/.next/static/chunks/app/{layout-9bd5877ae6198856.js → layout-8810d4df3081b5df.js} +1 -1
- package/.next/static/chunks/webpack-cb89101193742e2b.js +1 -0
- package/CHANGELOG.md +19 -0
- package/open-sse/executors/zed.js +98 -5
- package/open-sse/handlers/chatCore/sseToJsonHandler.js +11 -4
- package/open-sse/providers/pricing.js +24 -10
- package/open-sse/services/usage/antigravity-weekly.js +10 -0
- package/open-sse/services/usage/claude.js +15 -0
- package/open-sse/shared/zedAuth.js +43 -2
- package/open-sse/translator/concerns/prefetch.js +12 -4
- package/open-sse/translator/response/claude-to-openai.js +2 -2
- package/open-sse/utils/streamHandler.js +1 -5
- package/package.json +1 -1
- package/src/app/(dashboard)/dashboard/providers/[id]/BulkImportGrokCliModal.tsx +1 -1
- package/src/app/(dashboard)/dashboard/providers/[id]/page.tsx +1 -1
- package/src/app/(dashboard)/dashboard/usage/components/ProviderTopology.tsx +5 -2
- package/src/app/api/combos/[id]/route.js +38 -1
- package/src/app/api/combos/route.js +27 -2
- package/src/app/api/providers/[id]/models/route.js +12 -1
- package/src/app/api/providers/route.js +4 -1
- package/src/app/api/usage/stream/route.js +74 -68
- package/src/app/api/v1/models/route.js +20 -6
- package/src/lib/db/index.js +3 -0
- package/src/lib/db/repos/settingsRepo.js +22 -1
- package/src/lib/oauth/services/xai.js +4 -4
- package/src/lib/validateComboModels.ts +48 -0
- package/src/shared/components/UsageStats.tsx +7 -1
- package/src/shared/hooks/useShutdown.ts +2 -4
- package/src/sse/handlers/chat.js +5 -1
- package/src/sse/services/antigravityQuota.ts +7 -3
- package/src/sse/services/model.ts +9 -20
- package/.next/server/chunks/5351.js +0 -67
- package/.next/static/chunks/3973-424848b943e2ecab.js +0 -1
- package/.next/static/chunks/7276-16ef14f7b2cd478d.js +0 -1
- package/.next/static/chunks/webpack-452a2f4aec1a53ee.js +0 -1
- /package/.next/static/{iz7psrsEuHZGPvj7rbSWc → awjDWqWCZbU3VVSuN7-oA}/_buildManifest.js +0 -0
- /package/.next/static/{iz7psrsEuHZGPvj7rbSWc → awjDWqWCZbU3VVSuN7-oA}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.id=6823,exports.ids=[6823],exports.modules={6719:(a,b,c)=>{c.d(b,{RO:()=>l.RO,Yt:()=>l.Yt,my:()=>aj});var d=c(35841),e=c(87156),f=c(51215);let g={apiVersion:e.sr.github?.apiVersion,userAgent:e.sr.github?.userAgent};async function h(a,b,c=null){try{if(!a)throw Error("No GitHub access token available. Please re-authorize the connection.");let b=await (0,d.proxyAwareFetch)((0,f.U)("github").url,{headers:{Authorization:`token ${a}`,Accept:"application/json","X-GitHub-Api-Version":g.apiVersion,"User-Agent":g.userAgent,"Editor-Version":"vscode/1.100.0","Editor-Plugin-Version":"copilot-chat/0.26.7"}},c);if(!b.ok){let a=await b.text();throw Error(`GitHub API error: ${a}`)}let e=await b.json();if(e.quota_snapshots){let a=e.quota_snapshots,b=(0,f.eZ)(e.quota_reset_date);return{plan:e.copilot_plan,resetDate:e.quota_reset_date,quotas:{chat:{...i(a.chat),resetAt:b},completions:{...i(a.completions),resetAt:b},premium_interactions:{...i(a.premium_interactions),resetAt:b}}}}if(e.monthly_quotas||e.limited_user_quotas){let a=e.monthly_quotas||{},b=e.limited_user_quotas||{},c=(0,f.eZ)(e.limited_user_reset_date);return{plan:e.copilot_plan||e.access_type_sku,resetDate:e.limited_user_reset_date,quotas:{chat:{used:b.chat||0,total:a.chat||0,unlimited:!1,resetAt:c},completions:{used:b.completions||0,total:a.completions||0,unlimited:!1,resetAt:c}}}}return{message:"GitHub Copilot connected. Unable to parse quota data."}}catch(a){throw Error(`Failed to fetch GitHub usage: ${a.message}`)}}function i(a){return a?{used:a.entitlement-a.remaining,total:a.entitlement,remaining:a.remaining,unlimited:a.unlimited||!1}:{used:0,total:0,unlimited:!0}}var j=c(79410),k=c(66852),l=c(81887);let m={minimax:(0,f.U)("minimax").urls,"minimax-cn":(0,f.U)("minimax-cn").urls};function n(a,b,c){return a&&"object"==typeof a?a[b]??a[c]??null:null}function o(a,b,c){if(!a||"object"!=typeof a)return null;let d=a[b]??a[c];if(null==d)return null;let e=Number(d);return Number.isFinite(e)?Math.max(0,Math.min(100,e)):null}function p(a){return Math.max(0,Number(n(a,"current_interval_total_count","currentIntervalTotalCount"))||0)}function q(a){return Math.max(0,Number(n(a,"current_weekly_total_count","currentWeeklyTotalCount"))||0)}function r(a){return!!(p(a)>0||q(a)>0)||null!==o(a,"current_interval_remaining_percent","currentIntervalRemainingPercent")||null!==o(a,"current_weekly_remaining_percent","currentWeeklyRemainingPercent")}function s(a,b,c,d,e,g,h,i,j,k){let l=d(c),m=o(c,h,i);if(l<=0&&null===m)return;let p=Math.max(0,Number(n(c,e,g))||0),q=l,r=p;l<=0&&(q=100,r=k?Math.round(m/100*q):Math.round(q*(1-m/100))),a[b]=function(a,b,c,d,e=null){var f,g,h;let i=Math.max(0,a),j=d?Math.max(i-b,0):Math.min(Math.max(0,b),i),k=Math.max(i-j,0),l=(f=e,g=k,h=i,null!=f&&Number.isFinite(f)?Math.max(0,Math.min(100,f)):h>0?Math.max(0,Math.min(100,g/h*100)):0);return{used:j,total:i,remaining:k,remainingPercentage:l,resetAt:c,unlimited:!1}}(q,r,function(a,b,c,d,e,g){let h=Number(n(a,c,d))||0;return h>0?new Date(b+h).toISOString():(0,f.eZ)(n(a,e,g))}(c,...j),k,m)}async function t(a,b,c=null){if(!a)return{message:"MiniMax API key not available."};let e=m[b]||[],f="";for(let b=0;b<e.length;b+=1){let g=e[b],h=b<e.length-1;try{let b=await (0,d.proxyAwareFetch)(g,{method:"GET",headers:{Authorization:`Bearer ${a}`,Accept:"application/json","Content-Type":"application/json"}},c),e=await b.text(),i={};if(e)try{i=JSON.parse(e)}catch{i={}}let j=(i?.base_resp??i?.baseResp)||{},k=Number(j.status_code??j.statusCode)||0,l=String(j.status_msg??j.statusMsg??"").trim(),m=`${l} ${e}`.trim(),o=/token plan|coding plan|invalid api key|invalid key|unauthorized|inactive/i;if(401===b.status||403===b.status||1004===k||o.test(m))return{message:"MiniMax API key invalid or inactive. Use an active Token/Coding Plan key."};if(!b.ok){if(f=`MiniMax usage endpoint error (${b.status})`,(404===b.status||405===b.status||b.status>=500)&&h)continue;return{message:`MiniMax connected. ${f}`}}if(0!==k)return{message:`MiniMax connected. ${l||"Upstream quota API error"}`};let t=i?.model_remains??i?.modelRemains,u=(Array.isArray(t)?t:[]).filter(r);if(0===u.length)return{message:"MiniMax connected. No quota data was returned."};let v=Date.now(),w=g.includes("/coding_plan/remains"),x={};for(let a of u){let b=function(a){let b=String(n(a,"model_name","modelName")||"").trim();return b?"MiniMax-M*"===b||"general"===b?"M-series":b.replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,a=>a.toUpperCase()).replace(/\bTo\b/g,"to").replace(/\bTts\b/g,"TTS").replace(/\bHd\b/g,"HD"):"MiniMax"}(a);s(x,`${b} (5h)`,a,p,"current_interval_usage_count","currentIntervalUsageCount","current_interval_remaining_percent","currentIntervalRemainingPercent",[v,"remains_time","remainsTime","end_time","endTime"],w),s(x,`${b} (7d)`,a,q,"current_weekly_usage_count","currentWeeklyUsageCount","current_weekly_remaining_percent","currentWeeklyRemainingPercent",[v,"weekly_remains_time","weeklyRemainsTime","weekly_end_time","weeklyEndTime"],w)}if(0===Object.keys(x).length)return{message:"MiniMax connected. Unable to extract quota usage."};return{quotas:x}}catch(a){if(f=a.message,!h)break}}return{message:f?`MiniMax connected. Unable to fetch usage: ${f}`:"MiniMax connected. Unable to fetch usage."}}function u(a,b){let c=Number(a??b);return Number.isFinite(c)?c:0}async function v(a,b,c,g,h=null){let i=b||c;if(!i)return{message:`CodeBuddy (${a}) credential not available.`};try{let b=await (0,d.proxyAwareFetch)((0,f.U)(a).url,{method:"POST",headers:{...e.xq[a]?.headers||{},Authorization:`Bearer ${i}`,"Content-Type":"application/json",Accept:"application/json"},body:"{}"},h);if(401===b.status||403===b.status)return{message:"CodeBuddy CN credential invalid or expired."};if(!b.ok)return{message:`CodeBuddy CN quota API error (${b.status}).`};let c=await b.json();if(c?.code!==0)return{message:`CodeBuddy CN quota error: ${c?.msg||"unknown"}`};let g=c?.data?.Response?.Data||{},j=Array.isArray(g.Accounts)?g.Accounts:[];if(0===j.length)return{message:"CodeBuddy CN connected. No credit package found."};let k=a=>{let b=(0,f.eZ)(a.CycleEndTime);return b?new Date(b).getTime():1/0},l=a=>{let b=k(a),c=Number(a.DeductionEndTime);return Number.isFinite(b)&&Number.isFinite(c)&&c-b>1728e5},m=(a,b)=>k(a)-k(b),n=j.filter(l).sort(m),o=j.filter(a=>!l(a)).sort(m),p={},q={};n.forEach(a=>{let b=function(a){let b=(0,f.eZ)(a.CycleStartTime),c=(0,f.eZ)(a.CycleEndTime);if(b&&c){let a=(new Date(c).getTime()-new Date(b).getTime())/864e5;if(a<=1.5)return"Daily";if(a<=10)return"Weekly"}return"Monthly"}(a);q[b]=(q[b]||0)+1,p[q[b]>1?`${b} ${q[b]}`:b]={used:u(a.CycleCapacityUsedPrecise,a.CycleCapacityUsed),total:u(a.CycleCapacitySizePrecise,a.CycleCapacitySize),resetAt:(0,f.eZ)(a.CycleEndTime),unlimited:!1,recurring:!0}}),o.forEach((a,b)=>{p[`Bonus Pack ${b+1}`]={used:u(a.CapacityUsedPrecise,a.CapacityUsed),total:u(a.CapacitySizePrecise,a.CapacitySize),resetAt:(0,f.eZ)(a.CycleEndTime),unlimited:!1,recurring:!1}});let r=n[0]||j[0]||{};return{plan:r.PackageName||r.SubProductName||"CodeBuddy",quotas:p}}catch(b){return{message:`CodeBuddy (${a}) error: ${b.message}`}}}async function w(a,b,c,d=null){return v("codebuddy-cn",a,b,c,d)}async function x(a,b,c,d=null){return v("codebuddy-intl",a,b,c,d)}var y=c(71305);function z(a,b=0){if(!Buffer.isBuffer(a)||b<0||a.length-b<5)return null;let c=a[b];if(0!==c&&1!==c&&128!==c&&129!==c)return null;let d=b+5,e=a.readUInt32BE(b+1);return e>a.length-d?null:{flag:c,payloadStart:d,payloadLength:e}}function A(a,b){let c=0n,d=0n,e=b;for(;;){if(e>=a.length)return null;let b=a[e];if(c|=BigInt(127&b)<<d,e+=1,(128&b)==0)break;if((d+=7n)>70n)return null}return{value:Number(c),next:e}}function B(a,b,c,d){return b+c>a.length?null:{field:{wireType:d,bytes:a.subarray(b,b+c)},next:b+c}}function C(a){let b=new Map,c=0;for(;c<a.length;){let d=function(a,b){let c=A(a,b);if(!c)return null;let d=c.value>>>3,e=7&c.value;if(0===d)return null;if(0===e){let b=A(a,c.next);return b?{fieldNumber:d,field:{wireType:0,value:b.value},next:b.next}:null}if(2===e){let b=function(a,b){let c=A(a,b);if(!c)return null;let{value:d,next:e}=c;return d<0||e+d>a.length?null:{field:{wireType:2,bytes:a.subarray(e,e+d)},next:e+d}}(a,c.next);return b?{fieldNumber:d,field:b.field,next:b.next}:null}if(1===e){let b=B(a,c.next,8,1);return b?{fieldNumber:d,field:b.field,next:b.next}:null}if(5===e){let b=B(a,c.next,4,5);return b?{fieldNumber:d,field:b.field,next:b.next}:null}return null}(a,c);if(!d)return null;b.set(d.fieldNumber,d.field),c=d.next}return b}let D=(0,f.U)("grok-cli"),E=D.url||"https://cli-chat-proxy.grok.com/v1/billing?format=credits",F=D.userUrl||"https://cli-chat-proxy.grok.com/v1/user?include=subscription",G=Buffer.from([0,0,0,0,0]);function H(a,b=0){return null==a?b:"object"==typeof a&&!Array.isArray(a)&&"val"in a?(0,f.IQ)(a.val,b):(0,f.IQ)(a,b)}function I(a,b){let c=a?.subscriptionTier??a?.subscription_tier??a?.subscription?.tier??b?.subscriptionTier??b?.subscription_tier;return"string"==typeof c?c.trim():""}function J({used:a,total:b,resetAt:c,unlimited:d=!1}){let e=Math.max(0,(0,f.IQ)(b,0)),g=Math.max(0,(0,f.IQ)(a,0));if(d||0===e)return{used:g,total:0,remainingPercentage:100*!!d,resetAt:c||null,unlimited:!0};let h=Math.max(0,e-g);return{used:g,total:e,remainingPercentage:h/e*100,resetAt:c||null,unlimited:!1}}async function K(a,b=null){if(!a)return null;try{let c=await (0,d.proxyAwareFetch)("https://grok.com/grok_api_v2.GrokBuildBilling/GetGrokCreditsConfig",{method:"POST",headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/grpc-web+proto","X-Grpc-Web":"1",Accept:"application/grpc-web+proto"},body:G},b);if(!c?.ok)return null;let e=await c.arrayBuffer().catch(()=>null);if(!e)return null;return function(a){if(!a||!Buffer.isBuffer(a)||0===a.length)return null;try{var b,c;let d=null!==z(a,0)?function(a){let b=0;for(;b<a.length;){let c=z(a,b);if(!c)break;let d=c.payloadStart+c.payloadLength;if((128&c.flag)==0)return a.subarray(c.payloadStart,d);b=d}return null}(a):a;if(!d)return null;let e=C(d);if(!e)return null;let f=(b=e.get(1))&&2===b.wireType?C(b.bytes):null;if(!f)return null;let g=(c=f.get(1))?5===c.wireType?c.bytes.readFloatLE(0):1===c.wireType?c.bytes.readDoubleLE(0):null:0;if(null===g||!Number.isFinite(g)||g<0)return null;return{percentUsed:Math.min(100,100*g),resetAt:function(a){if(!a||2!==a.wireType)return null;let b=C(a.bytes);if(!b)return null;let c=b.get(1),d=b.get(2),e=c?.wireType===0?c.value:0,f=new Date(1e3*e+Math.round((d?.wireType===0?d.value:0)/1e6));return Number.isNaN(f.getTime())?null:f.toISOString()}(f.get(5))}}catch{return null}}(Buffer.from(e))}catch{return null}}async function L(a,b=null,c=null){if(!a)return{message:"Grok CLI access token not available."};let e=function(a,b={}){let c=b||{},d={Authorization:`Bearer ${a}`,Accept:"application/json","User-Agent":y.fZ,"x-xai-token-auth":"xai-grok-cli","x-grok-client-identifier":y.rK,"x-grok-client-version":y.uG,"x-grok-client-mode":"headless"},e=c.email,f=c.userId||c.principalId;return e&&(d["x-email"]=e),f&&(d["x-userid"]=f),d}(a,b);try{let[b,h]=await Promise.all([(0,d.proxyAwareFetch)(E,{method:"GET",headers:e},c),(0,d.proxyAwareFetch)(F,{method:"GET",headers:e},c).catch(()=>null)]);if(401===b.status||403===b.status)return{message:"Grok CLI authentication expired. Please re-authorize."};if(!b.ok){let a=await b.text().catch(()=>""),c=a?`: ${a.slice(0,200)}`:"";return{message:`Grok CLI billing API error (${b.status})${c}`}}let i=await b.json().catch(()=>null);if(!i||"object"!=typeof i)return{message:"Grok CLI billing response was not JSON."};let j=null;h?.ok&&(j=await h.json().catch(()=>null));let k=function(a,b=null){let c,d=a&&"object"==typeof a?a:{},e=d.config&&"object"==typeof d.config&&!Array.isArray(d.config)?d.config:d,g=(0,f.eZ)(e.billingPeriodEnd)||(0,f.eZ)(e.billing_period_end)||(0,f.eZ)(e.currentPeriod?.end)||(0,f.eZ)(e.resetAt||e.resetsAt||e.periodEnd)||(0,f.eZ)(d.billingPeriodEnd)||(0,f.eZ)(d.billing_period_end)||(0,f.eZ)(d.resetAt||d.resetsAt||d.periodEnd)||null,h={},i=I(b,e),j=!!i&&!/^(free|none|null)$/i.test(i),k=H(e.monthlyLimit??e.monthly_limit??d.monthlyLimit??d.monthly_limit,NaN),l=H(e.includedUsed??e.included_used??d.includedUsed??d.included_used,NaN),m=H(e.totalUsed??e.total_used??d.totalUsed??d.total_used,NaN);Number.isFinite(k)&&k>0&&(h["Monthly included"]=J({used:Number.isFinite(l)?l:Number.isFinite(m)?m:0,total:k,resetAt:g}));let n=H(e.onDemandCap??d.onDemandCap,NaN),o=H(e.onDemandUsed??d.onDemandUsed,NaN);if(Number.isFinite(n)&&n>0){let a=Number.isFinite(o)?Math.max(0,o):0;h["On-demand"]=J({used:a,total:n,resetAt:g})}else!j&&Number.isFinite(n)&&0===n&&Number.isFinite(o)&&(h["On-demand"]={used:1,total:1,remainingPercentage:0,resetAt:g,unlimited:!1});let p=H(e.prepaidBalance??d.prepaidBalance,NaN);Number.isFinite(p)&&p>0&&(h.Prepaid={used:0,total:p,remainingPercentage:100,resetAt:null,unlimited:!1});let q=H(e.creditUsagePercent??e.credit_usage_percent??d.creditUsagePercent,NaN);for(let a of(Number.isFinite(q)&&q>=0&&(h["Weekly SuperGrok"]=J({used:Math.max(0,Math.min(100,q)),total:100,resetAt:g})),[d.credits,d.creditBalance,d.usage,e.credits,e.includedCredits,e.subscriptionCredits].filter(a=>a&&"object"==typeof a&&!Array.isArray(a)))){let b=H(a.total??a.limit??a.cap??a.allocation??a.amount,NaN),c=H(a.used??a.spent??a.consumed,NaN),d=H(a.remaining??a.balance??a.left,NaN);if(Number.isFinite(b)&&b>0){let e=Number.isFinite(c)?c:Number.isFinite(d)?Math.max(0,b-d):0;h.Credits||(h.Credits=J({used:e,total:b,resetAt:(0,f.eZ)(a.resetAt||a.resetsAt||a.end)||g}))}else Number.isFinite(d)&&d>=0&&!h.Credits&&(h.Credits={used:0,total:d>0?d:1,remainingPercentage:100*(d>0),resetAt:g,unlimited:!1})}let r=Object.keys(h).length>0&&Object.values(h).every(a=>!0!==a.unlimited&&(a.remainingPercentage??100)<=0);return{plan:(c=I(b,e))?c.replace(/[_-]+/g," ").replace(/\b\w/g,a=>a.toUpperCase()):b?.hasGrokCodeAccess===!0?"Grok Code":(e?.isUnifiedBillingUser,"Grok Build"),quotas:h,periodEnd:g,exhausted:r,subscriptionAccess:j,rawConfig:e}}(i,j);if(k.plan=function(a){try{return({0:"Free",1:"SuperGrok",2:"X Basic",3:"X Premium",4:"X Premium Plus",5:"SuperGrok Heavy",6:"SuperGrok Lite"})[JSON.parse(Buffer.from(a.split(".")[1],"base64url")).tier]||""}catch{return""}}(a)||k.plan,!k.quotas||0===Object.keys(k.quotas).length){var g;let b=(g=await K(a,c))&&Number.isFinite(g.percentUsed)?{"Weekly SuperGrok":J({used:Math.round(Math.max(0,Math.min(100,g.percentUsed))),total:100,resetAt:g.resetAt||null})}:null;if(b)return{plan:k.plan,quotas:b};return{plan:k.plan,message:k.subscriptionAccess?"Subscription access is active; Grok does not expose a numeric included quota.":"Grok Build connected, but no credit allotment was returned. Free promo may be exhausted.",quotas:{}}}return{plan:k.plan,quotas:k.quotas}}catch(a){return{message:`Grok CLI usage error: ${a.message}`}}}async function M(a=null,b=null){if(!a||"string"!=typeof a||!a.trim())return{message:"DeepSeek API key not available. Add a key to view usage."};try{let c=await (0,d.proxyAwareFetch)("https://api.deepseek.com/user/balance",{method:"GET",headers:{Authorization:`Bearer ${a.trim()}`,"Content-Type":"application/json",Accept:"application/json"}},b);if(401===c.status||403===c.status)return{plan:"DeepSeek",message:"DeepSeek authentication failed. Check the API key."};if(!c.ok){let a=await c.text().catch(()=>"");return{plan:"DeepSeek",message:`DeepSeek balance API error (${c.status})${a?`: ${a.slice(0,120)}`:""}`}}let e=await c.json().catch(()=>null);if(!e||"object"!=typeof e)return{message:"DeepSeek balance response was not JSON."};let g=function(a){let b=Array.isArray(a?.balance_infos)?a.balance_infos:[],c=[];for(let a of b){if(!a||"object"!=typeof a)continue;let b="string"==typeof a.currency?a.currency.toUpperCase():"";if(!b)continue;let d=(0,f.IQ)(a.total_balance??a.totalBalance,0);c.push({currency:b,totalBalance:d,grantedBalance:(0,f.IQ)(a.granted_balance??a.grantedBalance,0),toppedUpBalance:(0,f.IQ)(a.topped_up_balance??a.toppedUpBalance,0)})}return c}(e);if(0===g.length)return{plan:"DeepSeek",message:"DeepSeek connected. No balance data returned."};let h=!0===e.is_available||!0===e.isAvailable,i={};for(let a of g){let b=Math.max(0,a.totalBalance);i[`Balance (${a.currency})`]={used:0,total:b,remainingPercentage:100*(b>0),resetAt:null,unlimited:!1,isCreditBalance:!0,currency:a.currency}}return{plan:h?"DeepSeek":"DeepSeek (Insufficient Balance)",quotas:i}}catch(a){return{message:`DeepSeek error: ${a.message}`}}}let N=(0,f.U)("opencode-go").url,O={rolling:"Rolling",weekly:"Weekly",monthly:"Monthly"};async function P(a=null,b=null){if(!a||"string"!=typeof a||!a.trim())return{message:"OpenCode Go API key not available. Add a key to view usage."};try{let c=await (0,d.proxyAwareFetch)(N,{method:"GET",headers:{Authorization:`Bearer ${a.trim()}`,Accept:"application/json"}},b);if(401===c.status)return{plan:"OpenCode Go",message:"OpenCode Go authentication failed. Check the API key."};if(403===c.status){let a=await c.json().catch(()=>null),b=a?.error?.type==="EntitlementError";return{plan:"OpenCode Go",message:b?"OpenCode Go subscription required for this API key.":"OpenCode Go access forbidden for this API key."}}if(!c.ok)return{plan:"OpenCode Go",message:`OpenCode Go usage API error (${c.status}).`};let e=await c.json().catch(()=>null);if(!e?.usage||"object"!=typeof e.usage)return{plan:"OpenCode Go",message:"OpenCode Go usage response did not contain quota data."};let g={};for(let[a,b]of Object.entries(O)){let c=e.usage[a];if(!c||"object"!=typeof c)continue;let d=function(a){if("number"==typeof a&&Number.isFinite(a))return a;if("string"==typeof a&&a.trim()){let b=Number(a);if(Number.isFinite(b))return b}return null}(c.percent);if(null===d)continue;let h=Math.max(0,Math.min(100,(0,f.IQ)(d,0)));g[b]={used:h,total:100,remaining:100-h,remainingPercentage:100-h,resetAt:(0,f.eZ)(c.resetsAt),unlimited:!1}}if(0===Object.keys(g).length)return{plan:"OpenCode Go",message:"OpenCode Go usage response did not contain valid quota data."};return{plan:"OpenCode Go",quotas:g}}catch(a){return{message:`OpenCode Go error: ${a.message}`}}}let Q=(0,f.U)("groq").url;function R(a,b,c,d){let e,f=a.get(b),g=a.get(c);if(null===f||null===g)return null;let h=Number(f),i=Number(g);return Number.isFinite(h)&&Number.isFinite(i)?{used:Math.max(0,h-i),total:h,resetAt:null===(e=function(a){let b;if("string"!=typeof a||!a.trim())return null;let c=/(\d+(?:\.\d+)?)(ms|s|m|h)/g,d=0,e=!1;for(;b=c.exec(a);){e=!0;let a=Number(b[1]),c=b[2];d+=a*("h"===c?36e5:"m"===c?6e4:"ms"===c?1:1e3)}return e?d:null}(a.get(d)))?null:new Date(Date.now()+e).toISOString(),unlimited:!1}:null}async function S(a,b=null){if(!a||"string"!=typeof a||!a.trim())return{message:"Groq API key not available. Add a key to view usage."};try{let c=await (0,d.proxyAwareFetch)(Q,{method:"GET",headers:{Authorization:`Bearer ${a.trim()}`,Accept:"application/json"}},b);if(401===c.status||403===c.status)return{plan:"Groq",message:"Groq authentication failed. Check the API key."};if(!c.ok){let a=await c.text().catch(()=>"");return{plan:"Groq",message:`Groq usage API error (${c.status})${a?`: ${a.slice(0,120)}`:""}`}}await c.text().catch(()=>{});let e=R(c.headers,"x-ratelimit-limit-requests","x-ratelimit-remaining-requests","x-ratelimit-reset-requests"),f=R(c.headers,"x-ratelimit-limit-tokens","x-ratelimit-remaining-tokens","x-ratelimit-reset-tokens");if(!e&&!f)return{plan:"Groq",message:"Groq connected. No rate-limit data reported for this key yet.",quotas:{}};let g={};return e&&(g.Requests=e),f&&(g.Tokens=f),{plan:"Groq",quotas:g}}catch(a){return{message:`Groq error: ${a.message}`}}}var T=c(35047),U=c(38684);async function V(a=null,b=null,c=null){let e=await (0,U.Fp)(b,c);if("number"==typeof e.percent&&Number.isFinite(e.percent)){let a=Math.max(0,Math.min(100,Math.round(e.percent))),b=null;if("number"==typeof e.resetAt&&e.resetAt>0)b=new Date(1e3*e.resetAt).toISOString();else if("string"==typeof e.resetDate){let a=new Date(`${e.resetDate}T00:00:00Z`);Number.isNaN(a.getTime())||(b=a.toISOString())}return{plan:"Xiaomi MiMo Desktop",quotas:{Weekly:{used:100-a,total:100,remainingPercentage:a,resetAt:b,unlimited:!1}}}}let f=a||b?.apiKey;if(!f||"string"!=typeof f||!f.trim())return{message:"Xiaomi MiMo Desktop not connected. Add credentials to view usage."};try{let a=await (0,d.proxyAwareFetch)("https://aistudio.xiaomimimo.com/open-apis/v1/user/usage",{method:"GET",headers:{Authorization:`Bearer ${f.trim()}`,"X-Mimo-Source":"mimocode-cli",Accept:"application/json"},signal:AbortSignal.timeout(1e4)},c);if(401===a.status)return{plan:"Xiaomi MiMo Desktop",message:"Weekly quota requires Xiaomi account session. API key alone is insufficient."};if(!a.ok)return{plan:"Xiaomi MiMo Desktop",message:`Usage API error (${a.status})`};let b=await a.json().catch(()=>null);if(!b||0!==b.code||!b.data)return{plan:"Xiaomi MiMo Desktop",message:"Usage endpoint returned unexpected response."};let{percent:e,resetDate:g}=b.data;if("number"!=typeof e||!Number.isFinite(e))return{plan:"Xiaomi MiMo Desktop",message:"Usage data missing percent field."};let h=Math.max(0,Math.min(100,Math.round(e))),i=null;if(g&&"string"==typeof g){let a=new Date(`${g}T00:00:00Z`);Number.isNaN(a.getTime())||(i=a.toISOString())}return{plan:"Xiaomi MiMo Desktop",quotas:{Weekly:{used:100-h,total:100,remainingPercentage:h,resetAt:i,unlimited:!1}}}}catch(a){return{message:`Xiaomi MiMo Desktop usage error: ${a.message}`}}}var W=c(30881);let X={international:(0,f.U)("glm").url,china:(0,f.U)("glm-cn").url};async function Y(a,b,c=null){if(!a)return{message:"GLM API key not available."};let e=X["glm-cn"===b?"china":"international"];try{let b=await (0,d.proxyAwareFetch)(e,{headers:{Authorization:`Bearer ${a}`,Accept:"application/json"}},c);if(!b.ok){if(401===b.status)return{message:"GLM API key invalid or expired."};return{message:`GLM quota API error (${b.status}).`}}let f=await b.json(),g=f?.data&&"object"==typeof f.data?f.data:{},h=Array.isArray(g.limits)?g.limits:[],i={};for(let a of h){if(!a||"TOKENS_LIMIT"!==a.type&&"CREDIT_LIMIT"!==a.type)continue;let b=Number(a.percentage)||0,c=Number(a.nextResetTime)||0,d=Math.max(0,100-b);i[3===a.unit?`Session (${a.number}h)`:6===a.unit?"Weekly (7d)":"TOKENS_LIMIT"===a.type?"Tokens":`Limit (${a.number})`]={used:b,total:100,remaining:d,remainingPercentage:d,resetAt:c>0?new Date(c).toISOString():null,unlimited:!1}}let j="string"==typeof g.level?g.level:"";return{plan:j?j.charAt(0).toUpperCase()+j.slice(1).toLowerCase():"Unknown",quotas:i}}catch(a){return{message:`GLM error: ${a.message}`}}}let Z=(process.env.COMMAND_CODE_API_BASE_URL||"https://api.commandcode.ai").replace(/\/$/,""),$={"individual-go":"Go","individual-goat":"GOAT","individual-pro":"Pro","individual-pro-v1":"Pro","individual-provider":"Provider","individual-max":"Max","individual-ultra":"Ultra","teams-pro":"Teams Pro"},_={"individual-go":10,"individual-goat":70,"individual-pro":30,"individual-pro-v1":80,"individual-provider":15,"individual-max":150,"individual-ultra":300,"teams-pro":40};function aa(a,b){let c=new URLSearchParams(Object.entries(b||{}).filter(([,a])=>null!=a)).toString();return c?`${a}?${c}`:a}function ab(a){if(!a||"object"!=typeof a)return null;let b=(0,f.IQ)(a.used,0),c=(0,f.IQ)(a.cap,0);return c<=0&&b<=0?null:{used:b,total:c,remaining:Math.max(0,c-b),unlimited:!1,resetAt:(0,f.eZ)(a.resetAt)}}async function ac(a,b=null){if(!a||"string"!=typeof a||!a.trim())return{message:"Command Code API key not available. Add a key to view usage."};let c={Authorization:`Bearer ${a.trim()}`,Accept:"application/json"},e=async a=>await (0,d.proxyAwareFetch)(Z+a,{method:"GET",headers:c},b);try{let a=await e(aa("/alpha/whoami",{limits:"1"}));if(401===a.status||403===a.status)return{plan:"Command Code",message:"Command Code authentication failed. Check the API key."};if(!a.ok)return{plan:"Command Code",message:`Command Code usage API error (${a.status})`};let b=await a.json().catch(()=>({})),c=b?.org?.id??null,[d,g]=await Promise.all([e(aa("/alpha/billing/credits",{orgId:c})),e(aa("/alpha/billing/subscriptions",{orgId:c}))]);if(401===d.status||403===d.status||401===g.status||403===g.status)return{plan:"Command Code",message:"Command Code authentication failed. Check the API key."};if(!d.ok)return{plan:"Command Code",message:`Command Code credits API error (${d.status})`};if(!g.ok)return{plan:"Command Code",message:`Command Code subscriptions API error (${g.status})`};let h=await d.json().catch(()=>({})),i=await g.json().catch(()=>({})),j=i?.data?.planId??null,k=j&&$[j]||j||"Command Code",l=j&&_[j]||0,m=h?.credits||{},n=(0,f.IQ)(m.monthlyCredits,0)+(0,f.IQ)(m.purchasedCredits,0)+(0,f.IQ)(m.freeCredits,0),o=l>0?Math.max(0,l-n):0,p={};p.Credits={used:o,total:l>0?l:n,remaining:n,unlimited:l<=0,resetAt:(0,f.eZ)(i?.data?.currentPeriodEnd)};let q=ab(h?.windowLimits?.fiveHour);q&&(p["Session (5h)"]=q);let r=ab(h?.windowLimits?.weekly);return r&&(p.Weekly=r),{plan:k,quotas:p}}catch(a){return{message:`Command Code error: ${a.message}`}}}let ad=(0,f.U)("vercel-ai-gateway").url;async function ae(a){try{return{message:"iFlow connected. Usage tracked per request."}}catch(a){return{message:"Unable to fetch iFlow usage."}}}async function af(a,b,c=null){if(!a)return{message:"Ollama Cloud API key not available."};try{let b,f=await (0,d.proxyAwareFetch)("https://ollama.com/api/usage",{headers:{Authorization:`Bearer ${a}`,Accept:"application/json"}},c);if(401===f.status||403===f.status)return{message:"Ollama Cloud API key invalid or expired."};if(!f.ok)return{message:`Ollama Cloud usage API error (${f.status}).`};try{b=await f.json()}catch{return{message:"Ollama Cloud usage response was not JSON."}}let g=await (0,d.proxyAwareFetch)("https://ollama.com/api/me",{method:"POST",headers:{Authorization:`Bearer ${a}`,Accept:"application/json","Content-Length":"0"}},c).then(a=>a.ok?a.json():null).catch(()=>null),h="string"==typeof g?.Plan?g.Plan:"",i=h?h.charAt(0).toUpperCase()+h.slice(1).toLowerCase():"Ollama Cloud",j=b?.limits&&"object"==typeof b.limits?b.limits:{};function e(a,b=null){let c=Math.max(0,Math.min(1,Number(a)||0)),d=Math.round(100*c);return{used:d,total:100,remainingPercentage:100-d,resetAt:b,unlimited:!1}}let k=j.session?.usage,l=j.weekly?.usage,m=Number(k),n=Number(l),o=null!=k&&!Number.isNaN(m),p=null!=l&&!Number.isNaN(n);if(!o&&!p)return{plan:i,message:"Ollama Cloud connected. No usage limits reported.",quotas:{}};let q={};return o&&(q["Session (5h)"]=e(m)),p&&(q["Weekly (7d)"]=e(n)),{plan:i,quotas:q}}catch(a){return{message:`Ollama Cloud error: ${a.message}`}}}async function ag(a,b=null){if(!a)return{message:"Vercel AI Gateway API key not available."};try{let c=await (0,d.proxyAwareFetch)(ad,{method:"GET",headers:{Authorization:`Bearer ${a}`,Accept:"application/json"}},b);if(401===c.status||403===c.status)return{message:"Vercel AI Gateway API key invalid or expired."};if(!c.ok){let a=await c.text().catch(()=>""),b=a?`: ${a.slice(0,200)}`:"";return{message:`Vercel AI Gateway credits API error (${c.status})${b}`}}let e=await c.json(),f=Number(e?.balance)||0,g=Number(e?.total_used)||0;if(f<=0&&g<=0)return{plan:"Pay-as-you-go",message:"Vercel AI Gateway connected. No credit allocation found (BYOK or unfunded account).",quotas:{}};return{plan:"Pay-as-you-go",quotas:{"Used (USD)":{used:g,total:0,remaining:0,remainingPercentage:100,unlimited:!0},"Remaining (USD)":{used:f,total:5,remaining:f,remainingPercentage:f/5*100,unlimited:!1}}}}catch(a){return{message:`Vercel AI Gateway error: ${a.message}`}}}async function ah(a,b=null){if(!a)return{message:"Qoder usage unavailable: no access token"};try{let c=await (0,d.proxyAwareFetch)((0,f.U)("qoder").url,{method:"GET",headers:{Authorization:`Bearer ${a}`,Accept:"application/json"}},b);if(!c.ok)return{message:`Qoder connected. Usage fetch returned ${c.status}.`};let e=await c.json().catch(()=>null);if(!e)return{message:"Qoder connected. Usage response was not JSON."};let g=e.userQuota||{},h=e.orgResourcePackage||{},i=Number.isFinite(Number(e.expiresAt))&&Number(e.expiresAt)>0?Number(e.expiresAt):null,j=i?new Date(i).toISOString():null;return{quotas:{user:{total:Number(g.total)||0,used:Number(g.used)||0,remaining:Number(g.remaining)||0,unit:g.unit||"credits",resetAt:j},organization:{total:Number(h.total)||0,used:Number(h.used)||0,remaining:Number(h.remaining)||0,unit:h.unit||"credits",resetAt:j}},totalUsagePercentage:Number(e.totalUsagePercentage)||0,isQuotaExceeded:!!e.isQuotaExceeded,expiresAt:i}}catch(a){return{message:`Qoder connected. Unable to fetch usage: ${a.message}`}}}let ai={github:a=>h(a.accessToken,a.providerSpecificData,a.proxyOptions),antigravity:a=>(0,j.c)(a.accessToken,a.providerSpecificData,a.proxyOptions),claude:a=>(0,k.g)(a.accessToken,a.proxyOptions,{force:a.force}),codex:a=>(0,l.Tl)(a.accessToken,a.proxyOptions),qoder:async a=>{let b=await (0,W._M)(a,a.proxyOptions).catch(()=>null);return ah(b?.accessToken||a.accessToken,a.proxyOptions)},iflow:a=>ae(a.accessToken),ollama:a=>af(a.apiKey,a.providerSpecificData,a.proxyOptions),glm:a=>Y(a.apiKey,a.provider,a.proxyOptions),"glm-cn":a=>Y(a.apiKey,a.provider,a.proxyOptions),minimax:a=>t(a.apiKey,a.provider,a.proxyOptions),"minimax-cn":a=>t(a.apiKey,a.provider,a.proxyOptions),"vercel-ai-gateway":a=>ag(a.apiKey,a.proxyOptions),"codebuddy-cn":a=>w(a.accessToken,a.apiKey,a.providerSpecificData,a.proxyOptions),"codebuddy-intl":a=>x(a.accessToken,a.apiKey,a.providerSpecificData,a.proxyOptions),"grok-cli":a=>L(a.accessToken,a.providerSpecificData,a.proxyOptions),"opencode-go":a=>P(a.apiKey,a.proxyOptions),deepseek:a=>M(a.apiKey,a.proxyOptions),groq:a=>S(a.apiKey,a.proxyOptions),zed:a=>(0,T.vL)(a.accessToken,a.providerSpecificData,a.proxyOptions),"xiaomi-mimo":a=>V(a.accessToken,a.providerSpecificData,a.proxyOptions),commandcode:a=>ac(a.apiKey,a.proxyOptions)};async function aj(a,b=null,c={}){let{provider:d,accessToken:e,apiKey:f,providerSpecificData:g,projectId:h}=a,i={...g||{},...h?{projectId:h}:{}},j=ai[d];return j?await j({provider:d,accessToken:e,apiKey:f,providerSpecificData:g,providerDataWithProjectId:i,proxyOptions:b,force:!0===c.force}):{message:`Usage API not implemented for ${d}`}}},66823:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>m,refreshAndUpdateCredentials:()=>l});var e=c(36343),f=c(2398),g=c(6719),h=c(62282),i=c(98630),j=c(19287),k=a([e,h]);[e,h]=k.then?(await k)():k;let n=["expired","authentication","unauthorized","401","re-authorize"];async function l(a,b=!1,c=null){let d=(0,h.SB)(a.provider),e={accessToken:a.accessToken,refreshToken:a.refreshToken,idToken:a.idToken,expiresAt:a.expiresAt||a.tokenExpiresAt,lastRefreshAt:a.lastRefreshAt,connectionId:a.id,providerSpecificData:a.providerSpecificData,copilotToken:a.providerSpecificData?.copilotToken,copilotTokenExpiresAt:a.providerSpecificData?.copilotTokenExpiresAt};if(!(b||d.needsRefresh(e)))return{connection:a,refreshed:!1};let g=await d.refreshCredentials(e,console,c);if(!g){if(a.accessToken)return{connection:a,refreshed:!1};throw Error("Failed to refresh credentials. Please re-authorize the connection.")}let i={updatedAt:new Date().toISOString()};g.accessToken&&(i.accessToken=g.accessToken),g.refreshToken&&(i.refreshToken=g.refreshToken),g.idToken&&(i.idToken=g.idToken),g.lastRefreshAt&&(i.lastRefreshAt=g.lastRefreshAt),g.expiresIn?(i.expiresAt=new Date(Date.now()+1e3*g.expiresIn).toISOString(),i.expiresIn=g.expiresIn):g.expiresAt&&(i.expiresAt=g.expiresAt);let j={...g.providerSpecificData||{},...g.copilotToken?{copilotToken:g.copilotToken}:{},...g.copilotTokenExpiresAt?{copilotTokenExpiresAt:g.copilotTokenExpiresAt}:{}};return Object.keys(j).length>0&&(i.providerSpecificData={...a.providerSpecificData||{},...j}),await (0,f.updateProviderConnection)(a.id,i),{connection:{...a,...i,providerSpecificData:i.providerSpecificData||a.providerSpecificData},refreshed:!0}}async function m(a,{params:b}){let c;try{let{connectionId:d}=await b,e="1"===new URL(a.url).searchParams.get("force");if(!(c=await (0,f.Mc)(d)))return Response.json({error:"Connection not found"},{status:404});let h="oauth"===c.authType,k=("apikey"===c.authType||"api_key"===c.authType)&&j.jO.includes(c.provider);if(!h&&!k)return Response.json({message:"Usage not available for this connection"});let m=await (0,i.B)(c.providerSpecificData),o={connectionProxyEnabled:!0===m.connectionProxyEnabled,connectionProxyUrl:m.connectionProxyUrl||"",connectionNoProxy:m.connectionNoProxy||"",vercelRelayUrl:m.vercelRelayUrl||"",strictProxy:!1};if(h)try{c=(await l(c,!1,o)).connection}catch(a){return console.error("[Usage API] Credential refresh failed:",a),Response.json({error:`Credential refresh failed: ${a.message}`},{status:401})}let p=await (0,g.my)(c,o,{force:e});if(h&&function(a){if(!a?.message)return!1;let b=a.message.toLowerCase();return n.some(a=>b.includes(a))}(p)&&c.refreshToken)try{c=(await l(c,!0,o)).connection,p=await (0,g.my)(c,o,{force:e})}catch(a){console.warn(`[Usage] ${c.provider}: force refresh failed: ${a.message}`)}return Response.json(p)}catch(b){let a=c?.provider??"unknown";return console.warn(`[Usage] ${a}: ${b.message}`),Response.json({error:b.message},{status:500})}}d()}catch(a){d(a)}})},66852:(a,b,c)=>{c.d(b,{g:()=>j});var d=c(35841),e=c(13385),f=c(51215);let g={oauthUsageUrl:(0,f.U)("claude").oauthUrl,usageUrl:(0,f.U)("claude").orgUrl,settingsUrl:(0,f.U)("claude").settingsUrl,apiVersion:e.b8},h=new Map,i=new Map;async function j(a,b=null,c={}){let d=c?.force===!0;if(!d&&a){let b=i.get(a);if(b?.promise)return b.promise;if(b&&b.expiresAt>Date.now())return b.result}let e=!d&&a&&i.get(a)?.result||null,f=(async()=>{let c=await k(a,b);return a&&c?.quotas?(i.set(a,{result:c,expiresAt:Date.now()+3e5}),c):e||c})();return a&&i.set(a,{promise:f}),f}async function k(a,b=null){try{let c=h.get(a);if(c&&Date.now()<c)return await l(a,b);let e=await (0,d.proxyAwareFetch)(g.oauthUsageUrl,{method:"GET",headers:{Authorization:`Bearer ${a}`,"anthropic-beta":"oauth-2025-04-20","anthropic-version":g.apiVersion}},b);if(e.ok){let a=await e.json(),b={},c=a=>a&&"object"==typeof a&&"number"==typeof a.utilization,d=a=>{let b=a.utilization,c=Math.max(0,100-b);return{used:b,total:100,remaining:c,remainingPercentage:c,resetAt:(0,f.eZ)(a.resets_at),unlimited:!1}};for(let[e,f]of(c(a.five_hour)&&(b["session (5h)"]=d(a.five_hour)),c(a.seven_day)&&(b["weekly (7d)"]=d(a.seven_day)),Object.entries(a)))if(e.startsWith("seven_day_")&&"seven_day"!==e&&c(f)){let a=e.replace("seven_day_","");b[`weekly ${a} (7d)`]=d(f)}if(Array.isArray(a.limits))for(let c of a.limits){if(c?.kind!=="weekly_scoped")continue;let a=String(c?.scope?.model?.display_name||"").trim().toLowerCase();a&&"number"==typeof c.percent&&(b[`weekly ${a} (7d)`]=d({utilization:Math.max(0,Math.min(100,c.percent)),resets_at:c.resets_at}))}return{plan:"Claude Code",extraUsage:a.extra_usage??null,quotas:b}}return 429===e.status&&h.set(a,Date.now()+18e4),console.warn(`[Claude Usage] OAuth endpoint returned ${e.status}, falling back to legacy`),await l(a,b)}catch(a){return{message:`Claude connected. Unable to fetch usage: ${a.message}`}}}async function l(a,b=null){try{let c=await (0,d.proxyAwareFetch)(g.settingsUrl,{method:"GET",headers:{Authorization:`Bearer ${a}`,"anthropic-version":g.apiVersion}},b);if(c.ok){let e=await c.json();if(e.organization_id){let c=await (0,d.proxyAwareFetch)(g.usageUrl.replace("{org_id}",e.organization_id),{method:"GET",headers:{Authorization:`Bearer ${a}`,"anthropic-version":g.apiVersion}},b);if(c.ok){let a=await c.json();return{plan:e.plan||"Unknown",organization:e.organization_name,quotas:a}}}return{plan:e.plan||"Unknown",organization:e.organization_name,message:"Claude connected. Usage details require admin access."}}return{message:"Claude connected. Usage API requires admin permissions."}}catch(a){return{message:`Claude connected. Unable to fetch usage: ${a.message}`}}}},81887:(a,b,c)=>{c.d(b,{RO:()=>m,Tl:()=>k,Yt:()=>l});var d=c(35841),e=c(51215);let f={usageUrl:(0,e.U)("codex").url,resetCreditsUrl:(0,e.U)("codex").resetCreditsUrl,resetCreditsConsumeUrl:(0,e.U)("codex").resetCreditsConsumeUrl};function g(a){if(!a)return null;let b=a instanceof Date?a:new Date("number"==typeof a&&a<1e12?1e3*a:a);return Number.isFinite(b.getTime())?b.toISOString():null}function h(a){return!a||"object"!=typeof a||Array.isArray(a)?null:a.rate_limit&&"object"==typeof a.rate_limit?a.rate_limit:a}function i(a){let b=Math.max(0,Math.min(100,(0,e.IQ)(a?.used_percent??a?.percent_used,0)));return{used:b,total:100,remaining:Math.max(0,100-b),resetAt:(0,e.eZ)(a?.reset_at??a?.resets_at??a?.resetAt??null),unlimited:!1}}function j(a,b,c){let d=h(c);if(!d)return!1;let e=d.primary_window||d.primary||c.primary_window||c.primary,f=d.secondary_window||d.secondary||c.secondary_window||c.secondary,g=!1;return e&&(a[b?`${b}_session`:"session"]=i(e),g=!0),f&&(a[b?`${b}_weekly`:"weekly"]=i(f),g=!0),g}async function k(a,b=null){try{let c=await (0,d.proxyAwareFetch)(f.usageUrl,{method:"GET",headers:{Authorization:`Bearer ${a}`,Accept:"application/json"}},b);if(!c.ok)return{message:`Codex connected. Usage API temporarily unavailable (${c.status}).`};let g=await c.json(),i=g.rate_limit||g.rate_limits||g.rate_limits_by_limit_id?.codex||{},k=function(a){if(a.code_review_rate_limit||a.review_rate_limit)return a.code_review_rate_limit||a.review_rate_limit;let b=a.rate_limits_by_limit_id;return b&&"object"==typeof b&&!Array.isArray(b)?b.code_review||b.codex_review||b.review||null:(Array.isArray(a.additional_rate_limits)?a.additional_rate_limits:[]).find(a=>{let b=String(a?.limit_name||a?.metered_feature||a?.id||"").toLowerCase();return"code_review"===b||"codex_review"===b||"review"===b||b.includes("review")})||null}(g),l=function(a){if(a.spark_rate_limit||a.gpt_5_3_codex_spark_rate_limit)return a.spark_rate_limit||a.gpt_5_3_codex_spark_rate_limit;let b=a.rate_limits_by_limit_id;return b&&"object"==typeof b&&!Array.isArray(b)?b["gpt-5.3-codex-spark"]||b.gpt_5_3_codex_spark||b.spark||null:(Array.isArray(a.additional_rate_limits)?a.additional_rate_limits:[]).find(a=>{let b=String(a?.limit_name||a?.metered_feature||a?.id||"").toLowerCase();return b.includes("spark")||b.includes("5.3-codex-spark")})||null}(g),m=Math.max(0,(0,e.IQ)(g.rate_limit_reset_credits?.available_count,0)),n={};return j(n,"",i),j(n,"review",k),j(n,"spark",l),{plan:g.plan_type||g.summary?.plan||"unknown",limitReached:h(i)?.limit_reached||!1,reviewLimitReached:h(k)?.limit_reached||!1,sparkLimitReached:h(l)?.limit_reached||!1,resetCredits:{availableCount:m},quotas:n}}catch(a){throw Error(`Failed to fetch Codex usage: ${a.message}`)}}async function l(a,b=null,c=null){var h,i;if(!a)throw Error("No Codex access token available. Please re-authorize the connection.");let j=c?.workspaceId||c?.accountId||c?.chatgptAccountId||null,k={Authorization:`Bearer ${a}`,Accept:"application/json","OpenAI-Beta":"codex-1",originator:"codex_cli_rs"};j&&(k["ChatGPT-Account-ID"]=j);let m=await (0,d.proxyAwareFetch)(f.resetCreditsUrl,{method:"GET",headers:k},b),n=null;try{n=await m.json()}catch{n=null}if(!m.ok)throw Error((h=n?.message||n?.error||n?.detail,i=`Codex reset credits API unavailable (${m.status}).`,h?"string"==typeof h?h:"string"==typeof h.message?h.message:JSON.stringify(h):i));let o=Array.isArray(n?.credits)?n.credits:[];return{availableCount:Math.max(0,(0,e.IQ)(n?.available_count??n?.availableCount,0)),credits:o.map(a=>({status:String(a?.status||"unknown"),grantedAt:g(a?.granted_at??a?.grantedAt),expiresAt:g(a?.expires_at??a?.expiresAt)}))}}async function m(a,b,c=null){let g;if(!a)throw Error("No Codex access token available. Please re-authorize the connection.");if(!b||"string"!=typeof b)throw Error("A redeem request id is required to consume a Codex reset credit.");let h=null;try{g=await (0,d.proxyAwareFetch)(f.resetCreditsConsumeUrl,{method:"POST",headers:{Authorization:`Bearer ${a}`,Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({redeem_request_id:b})},c);let e=await g.text();h=e?JSON.parse(e):null}catch(a){throw Error(`Failed to consume Codex reset credit: ${a.message}`)}let i=h?.code||null,j=(0,e.IQ)(h?.windows_reset,0);return{ok:g.ok&&("reset"===i||j>0),noCredit:g.ok&&"no_credit"===i,status:g.status,code:i,windowsReset:j,message:h?.message||null,raw:h}}}};
|
|
1
|
+
"use strict";exports.id=6823,exports.ids=[6823],exports.modules={6719:(a,b,c)=>{c.d(b,{RO:()=>l.RO,Yt:()=>l.Yt,my:()=>aj});var d=c(35841),e=c(87156),f=c(51215);let g={apiVersion:e.sr.github?.apiVersion,userAgent:e.sr.github?.userAgent};async function h(a,b,c=null){try{if(!a)throw Error("No GitHub access token available. Please re-authorize the connection.");let b=await (0,d.proxyAwareFetch)((0,f.U)("github").url,{headers:{Authorization:`token ${a}`,Accept:"application/json","X-GitHub-Api-Version":g.apiVersion,"User-Agent":g.userAgent,"Editor-Version":"vscode/1.100.0","Editor-Plugin-Version":"copilot-chat/0.26.7"}},c);if(!b.ok){let a=await b.text();throw Error(`GitHub API error: ${a}`)}let e=await b.json();if(e.quota_snapshots){let a=e.quota_snapshots,b=(0,f.eZ)(e.quota_reset_date);return{plan:e.copilot_plan,resetDate:e.quota_reset_date,quotas:{chat:{...i(a.chat),resetAt:b},completions:{...i(a.completions),resetAt:b},premium_interactions:{...i(a.premium_interactions),resetAt:b}}}}if(e.monthly_quotas||e.limited_user_quotas){let a=e.monthly_quotas||{},b=e.limited_user_quotas||{},c=(0,f.eZ)(e.limited_user_reset_date);return{plan:e.copilot_plan||e.access_type_sku,resetDate:e.limited_user_reset_date,quotas:{chat:{used:b.chat||0,total:a.chat||0,unlimited:!1,resetAt:c},completions:{used:b.completions||0,total:a.completions||0,unlimited:!1,resetAt:c}}}}return{message:"GitHub Copilot connected. Unable to parse quota data."}}catch(a){throw Error(`Failed to fetch GitHub usage: ${a.message}`)}}function i(a){return a?{used:a.entitlement-a.remaining,total:a.entitlement,remaining:a.remaining,unlimited:a.unlimited||!1}:{used:0,total:0,unlimited:!0}}var j=c(79410),k=c(66852),l=c(81887);let m={minimax:(0,f.U)("minimax").urls,"minimax-cn":(0,f.U)("minimax-cn").urls};function n(a,b,c){return a&&"object"==typeof a?a[b]??a[c]??null:null}function o(a,b,c){if(!a||"object"!=typeof a)return null;let d=a[b]??a[c];if(null==d)return null;let e=Number(d);return Number.isFinite(e)?Math.max(0,Math.min(100,e)):null}function p(a){return Math.max(0,Number(n(a,"current_interval_total_count","currentIntervalTotalCount"))||0)}function q(a){return Math.max(0,Number(n(a,"current_weekly_total_count","currentWeeklyTotalCount"))||0)}function r(a){return!!(p(a)>0||q(a)>0)||null!==o(a,"current_interval_remaining_percent","currentIntervalRemainingPercent")||null!==o(a,"current_weekly_remaining_percent","currentWeeklyRemainingPercent")}function s(a,b,c,d,e,g,h,i,j,k){let l=d(c),m=o(c,h,i);if(l<=0&&null===m)return;let p=Math.max(0,Number(n(c,e,g))||0),q=l,r=p;l<=0&&(q=100,r=k?Math.round(m/100*q):Math.round(q*(1-m/100))),a[b]=function(a,b,c,d,e=null){var f,g,h;let i=Math.max(0,a),j=d?Math.max(i-b,0):Math.min(Math.max(0,b),i),k=Math.max(i-j,0),l=(f=e,g=k,h=i,null!=f&&Number.isFinite(f)?Math.max(0,Math.min(100,f)):h>0?Math.max(0,Math.min(100,g/h*100)):0);return{used:j,total:i,remaining:k,remainingPercentage:l,resetAt:c,unlimited:!1}}(q,r,function(a,b,c,d,e,g){let h=Number(n(a,c,d))||0;return h>0?new Date(b+h).toISOString():(0,f.eZ)(n(a,e,g))}(c,...j),k,m)}async function t(a,b,c=null){if(!a)return{message:"MiniMax API key not available."};let e=m[b]||[],f="";for(let b=0;b<e.length;b+=1){let g=e[b],h=b<e.length-1;try{let b=await (0,d.proxyAwareFetch)(g,{method:"GET",headers:{Authorization:`Bearer ${a}`,Accept:"application/json","Content-Type":"application/json"}},c),e=await b.text(),i={};if(e)try{i=JSON.parse(e)}catch{i={}}let j=(i?.base_resp??i?.baseResp)||{},k=Number(j.status_code??j.statusCode)||0,l=String(j.status_msg??j.statusMsg??"").trim(),m=`${l} ${e}`.trim(),o=/token plan|coding plan|invalid api key|invalid key|unauthorized|inactive/i;if(401===b.status||403===b.status||1004===k||o.test(m))return{message:"MiniMax API key invalid or inactive. Use an active Token/Coding Plan key."};if(!b.ok){if(f=`MiniMax usage endpoint error (${b.status})`,(404===b.status||405===b.status||b.status>=500)&&h)continue;return{message:`MiniMax connected. ${f}`}}if(0!==k)return{message:`MiniMax connected. ${l||"Upstream quota API error"}`};let t=i?.model_remains??i?.modelRemains,u=(Array.isArray(t)?t:[]).filter(r);if(0===u.length)return{message:"MiniMax connected. No quota data was returned."};let v=Date.now(),w=g.includes("/coding_plan/remains"),x={};for(let a of u){let b=function(a){let b=String(n(a,"model_name","modelName")||"").trim();return b?"MiniMax-M*"===b||"general"===b?"M-series":b.replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,a=>a.toUpperCase()).replace(/\bTo\b/g,"to").replace(/\bTts\b/g,"TTS").replace(/\bHd\b/g,"HD"):"MiniMax"}(a);s(x,`${b} (5h)`,a,p,"current_interval_usage_count","currentIntervalUsageCount","current_interval_remaining_percent","currentIntervalRemainingPercent",[v,"remains_time","remainsTime","end_time","endTime"],w),s(x,`${b} (7d)`,a,q,"current_weekly_usage_count","currentWeeklyUsageCount","current_weekly_remaining_percent","currentWeeklyRemainingPercent",[v,"weekly_remains_time","weeklyRemainsTime","weekly_end_time","weeklyEndTime"],w)}if(0===Object.keys(x).length)return{message:"MiniMax connected. Unable to extract quota usage."};return{quotas:x}}catch(a){if(f=a.message,!h)break}}return{message:f?`MiniMax connected. Unable to fetch usage: ${f}`:"MiniMax connected. Unable to fetch usage."}}function u(a,b){let c=Number(a??b);return Number.isFinite(c)?c:0}async function v(a,b,c,g,h=null){let i=b||c;if(!i)return{message:`CodeBuddy (${a}) credential not available.`};try{let b=await (0,d.proxyAwareFetch)((0,f.U)(a).url,{method:"POST",headers:{...e.xq[a]?.headers||{},Authorization:`Bearer ${i}`,"Content-Type":"application/json",Accept:"application/json"},body:"{}"},h);if(401===b.status||403===b.status)return{message:"CodeBuddy CN credential invalid or expired."};if(!b.ok)return{message:`CodeBuddy CN quota API error (${b.status}).`};let c=await b.json();if(c?.code!==0)return{message:`CodeBuddy CN quota error: ${c?.msg||"unknown"}`};let g=c?.data?.Response?.Data||{},j=Array.isArray(g.Accounts)?g.Accounts:[];if(0===j.length)return{message:"CodeBuddy CN connected. No credit package found."};let k=a=>{let b=(0,f.eZ)(a.CycleEndTime);return b?new Date(b).getTime():1/0},l=a=>{let b=k(a),c=Number(a.DeductionEndTime);return Number.isFinite(b)&&Number.isFinite(c)&&c-b>1728e5},m=(a,b)=>k(a)-k(b),n=j.filter(l).sort(m),o=j.filter(a=>!l(a)).sort(m),p={},q={};n.forEach(a=>{let b=function(a){let b=(0,f.eZ)(a.CycleStartTime),c=(0,f.eZ)(a.CycleEndTime);if(b&&c){let a=(new Date(c).getTime()-new Date(b).getTime())/864e5;if(a<=1.5)return"Daily";if(a<=10)return"Weekly"}return"Monthly"}(a);q[b]=(q[b]||0)+1,p[q[b]>1?`${b} ${q[b]}`:b]={used:u(a.CycleCapacityUsedPrecise,a.CycleCapacityUsed),total:u(a.CycleCapacitySizePrecise,a.CycleCapacitySize),resetAt:(0,f.eZ)(a.CycleEndTime),unlimited:!1,recurring:!0}}),o.forEach((a,b)=>{p[`Bonus Pack ${b+1}`]={used:u(a.CapacityUsedPrecise,a.CapacityUsed),total:u(a.CapacitySizePrecise,a.CapacitySize),resetAt:(0,f.eZ)(a.CycleEndTime),unlimited:!1,recurring:!1}});let r=n[0]||j[0]||{};return{plan:r.PackageName||r.SubProductName||"CodeBuddy",quotas:p}}catch(b){return{message:`CodeBuddy (${a}) error: ${b.message}`}}}async function w(a,b,c,d=null){return v("codebuddy-cn",a,b,c,d)}async function x(a,b,c,d=null){return v("codebuddy-intl",a,b,c,d)}var y=c(71305);function z(a,b=0){if(!Buffer.isBuffer(a)||b<0||a.length-b<5)return null;let c=a[b];if(0!==c&&1!==c&&128!==c&&129!==c)return null;let d=b+5,e=a.readUInt32BE(b+1);return e>a.length-d?null:{flag:c,payloadStart:d,payloadLength:e}}function A(a,b){let c=0n,d=0n,e=b;for(;;){if(e>=a.length)return null;let b=a[e];if(c|=BigInt(127&b)<<d,e+=1,(128&b)==0)break;if((d+=7n)>70n)return null}return{value:Number(c),next:e}}function B(a,b,c,d){return b+c>a.length?null:{field:{wireType:d,bytes:a.subarray(b,b+c)},next:b+c}}function C(a){let b=new Map,c=0;for(;c<a.length;){let d=function(a,b){let c=A(a,b);if(!c)return null;let d=c.value>>>3,e=7&c.value;if(0===d)return null;if(0===e){let b=A(a,c.next);return b?{fieldNumber:d,field:{wireType:0,value:b.value},next:b.next}:null}if(2===e){let b=function(a,b){let c=A(a,b);if(!c)return null;let{value:d,next:e}=c;return d<0||e+d>a.length?null:{field:{wireType:2,bytes:a.subarray(e,e+d)},next:e+d}}(a,c.next);return b?{fieldNumber:d,field:b.field,next:b.next}:null}if(1===e){let b=B(a,c.next,8,1);return b?{fieldNumber:d,field:b.field,next:b.next}:null}if(5===e){let b=B(a,c.next,4,5);return b?{fieldNumber:d,field:b.field,next:b.next}:null}return null}(a,c);if(!d)return null;b.set(d.fieldNumber,d.field),c=d.next}return b}let D=(0,f.U)("grok-cli"),E=D.url||"https://cli-chat-proxy.grok.com/v1/billing?format=credits",F=D.userUrl||"https://cli-chat-proxy.grok.com/v1/user?include=subscription",G=Buffer.from([0,0,0,0,0]);function H(a,b=0){return null==a?b:"object"==typeof a&&!Array.isArray(a)&&"val"in a?(0,f.IQ)(a.val,b):(0,f.IQ)(a,b)}function I(a,b){let c=a?.subscriptionTier??a?.subscription_tier??a?.subscription?.tier??b?.subscriptionTier??b?.subscription_tier;return"string"==typeof c?c.trim():""}function J({used:a,total:b,resetAt:c,unlimited:d=!1}){let e=Math.max(0,(0,f.IQ)(b,0)),g=Math.max(0,(0,f.IQ)(a,0));if(d||0===e)return{used:g,total:0,remainingPercentage:100*!!d,resetAt:c||null,unlimited:!0};let h=Math.max(0,e-g);return{used:g,total:e,remainingPercentage:h/e*100,resetAt:c||null,unlimited:!1}}async function K(a,b=null){if(!a)return null;try{let c=await (0,d.proxyAwareFetch)("https://grok.com/grok_api_v2.GrokBuildBilling/GetGrokCreditsConfig",{method:"POST",headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/grpc-web+proto","X-Grpc-Web":"1",Accept:"application/grpc-web+proto"},body:G},b);if(!c?.ok)return null;let e=await c.arrayBuffer().catch(()=>null);if(!e)return null;return function(a){if(!a||!Buffer.isBuffer(a)||0===a.length)return null;try{var b,c;let d=null!==z(a,0)?function(a){let b=0;for(;b<a.length;){let c=z(a,b);if(!c)break;let d=c.payloadStart+c.payloadLength;if((128&c.flag)==0)return a.subarray(c.payloadStart,d);b=d}return null}(a):a;if(!d)return null;let e=C(d);if(!e)return null;let f=(b=e.get(1))&&2===b.wireType?C(b.bytes):null;if(!f)return null;let g=(c=f.get(1))?5===c.wireType?c.bytes.readFloatLE(0):1===c.wireType?c.bytes.readDoubleLE(0):null:0;if(null===g||!Number.isFinite(g)||g<0)return null;return{percentUsed:Math.min(100,100*g),resetAt:function(a){if(!a||2!==a.wireType)return null;let b=C(a.bytes);if(!b)return null;let c=b.get(1),d=b.get(2),e=c?.wireType===0?c.value:0,f=new Date(1e3*e+Math.round((d?.wireType===0?d.value:0)/1e6));return Number.isNaN(f.getTime())?null:f.toISOString()}(f.get(5))}}catch{return null}}(Buffer.from(e))}catch{return null}}async function L(a,b=null,c=null){if(!a)return{message:"Grok CLI access token not available."};let e=function(a,b={}){let c=b||{},d={Authorization:`Bearer ${a}`,Accept:"application/json","User-Agent":y.fZ,"x-xai-token-auth":"xai-grok-cli","x-grok-client-identifier":y.rK,"x-grok-client-version":y.uG,"x-grok-client-mode":"headless"},e=c.email,f=c.userId||c.principalId;return e&&(d["x-email"]=e),f&&(d["x-userid"]=f),d}(a,b);try{let[b,h]=await Promise.all([(0,d.proxyAwareFetch)(E,{method:"GET",headers:e},c),(0,d.proxyAwareFetch)(F,{method:"GET",headers:e},c).catch(()=>null)]);if(401===b.status||403===b.status)return{message:"Grok CLI authentication expired. Please re-authorize."};if(!b.ok){let a=await b.text().catch(()=>""),c=a?`: ${a.slice(0,200)}`:"";return{message:`Grok CLI billing API error (${b.status})${c}`}}let i=await b.json().catch(()=>null);if(!i||"object"!=typeof i)return{message:"Grok CLI billing response was not JSON."};let j=null;h?.ok&&(j=await h.json().catch(()=>null));let k=function(a,b=null){let c,d=a&&"object"==typeof a?a:{},e=d.config&&"object"==typeof d.config&&!Array.isArray(d.config)?d.config:d,g=(0,f.eZ)(e.billingPeriodEnd)||(0,f.eZ)(e.billing_period_end)||(0,f.eZ)(e.currentPeriod?.end)||(0,f.eZ)(e.resetAt||e.resetsAt||e.periodEnd)||(0,f.eZ)(d.billingPeriodEnd)||(0,f.eZ)(d.billing_period_end)||(0,f.eZ)(d.resetAt||d.resetsAt||d.periodEnd)||null,h={},i=I(b,e),j=!!i&&!/^(free|none|null)$/i.test(i),k=H(e.monthlyLimit??e.monthly_limit??d.monthlyLimit??d.monthly_limit,NaN),l=H(e.includedUsed??e.included_used??d.includedUsed??d.included_used,NaN),m=H(e.totalUsed??e.total_used??d.totalUsed??d.total_used,NaN);Number.isFinite(k)&&k>0&&(h["Monthly included"]=J({used:Number.isFinite(l)?l:Number.isFinite(m)?m:0,total:k,resetAt:g}));let n=H(e.onDemandCap??d.onDemandCap,NaN),o=H(e.onDemandUsed??d.onDemandUsed,NaN);if(Number.isFinite(n)&&n>0){let a=Number.isFinite(o)?Math.max(0,o):0;h["On-demand"]=J({used:a,total:n,resetAt:g})}else!j&&Number.isFinite(n)&&0===n&&Number.isFinite(o)&&(h["On-demand"]={used:1,total:1,remainingPercentage:0,resetAt:g,unlimited:!1});let p=H(e.prepaidBalance??d.prepaidBalance,NaN);Number.isFinite(p)&&p>0&&(h.Prepaid={used:0,total:p,remainingPercentage:100,resetAt:null,unlimited:!1});let q=H(e.creditUsagePercent??e.credit_usage_percent??d.creditUsagePercent,NaN);for(let a of(Number.isFinite(q)&&q>=0&&(h["Weekly SuperGrok"]=J({used:Math.max(0,Math.min(100,q)),total:100,resetAt:g})),[d.credits,d.creditBalance,d.usage,e.credits,e.includedCredits,e.subscriptionCredits].filter(a=>a&&"object"==typeof a&&!Array.isArray(a)))){let b=H(a.total??a.limit??a.cap??a.allocation??a.amount,NaN),c=H(a.used??a.spent??a.consumed,NaN),d=H(a.remaining??a.balance??a.left,NaN);if(Number.isFinite(b)&&b>0){let e=Number.isFinite(c)?c:Number.isFinite(d)?Math.max(0,b-d):0;h.Credits||(h.Credits=J({used:e,total:b,resetAt:(0,f.eZ)(a.resetAt||a.resetsAt||a.end)||g}))}else Number.isFinite(d)&&d>=0&&!h.Credits&&(h.Credits={used:0,total:d>0?d:1,remainingPercentage:100*(d>0),resetAt:g,unlimited:!1})}let r=Object.keys(h).length>0&&Object.values(h).every(a=>!0!==a.unlimited&&(a.remainingPercentage??100)<=0);return{plan:(c=I(b,e))?c.replace(/[_-]+/g," ").replace(/\b\w/g,a=>a.toUpperCase()):b?.hasGrokCodeAccess===!0?"Grok Code":(e?.isUnifiedBillingUser,"Grok Build"),quotas:h,periodEnd:g,exhausted:r,subscriptionAccess:j,rawConfig:e}}(i,j);if(k.plan=function(a){try{return({0:"Free",1:"SuperGrok",2:"X Basic",3:"X Premium",4:"X Premium Plus",5:"SuperGrok Heavy",6:"SuperGrok Lite"})[JSON.parse(Buffer.from(a.split(".")[1],"base64url")).tier]||""}catch{return""}}(a)||k.plan,!k.quotas||0===Object.keys(k.quotas).length){var g;let b=(g=await K(a,c))&&Number.isFinite(g.percentUsed)?{"Weekly SuperGrok":J({used:Math.round(Math.max(0,Math.min(100,g.percentUsed))),total:100,resetAt:g.resetAt||null})}:null;if(b)return{plan:k.plan,quotas:b};return{plan:k.plan,message:k.subscriptionAccess?"Subscription access is active; Grok does not expose a numeric included quota.":"Grok Build connected, but no credit allotment was returned. Free promo may be exhausted.",quotas:{}}}return{plan:k.plan,quotas:k.quotas}}catch(a){return{message:`Grok CLI usage error: ${a.message}`}}}async function M(a=null,b=null){if(!a||"string"!=typeof a||!a.trim())return{message:"DeepSeek API key not available. Add a key to view usage."};try{let c=await (0,d.proxyAwareFetch)("https://api.deepseek.com/user/balance",{method:"GET",headers:{Authorization:`Bearer ${a.trim()}`,"Content-Type":"application/json",Accept:"application/json"}},b);if(401===c.status||403===c.status)return{plan:"DeepSeek",message:"DeepSeek authentication failed. Check the API key."};if(!c.ok){let a=await c.text().catch(()=>"");return{plan:"DeepSeek",message:`DeepSeek balance API error (${c.status})${a?`: ${a.slice(0,120)}`:""}`}}let e=await c.json().catch(()=>null);if(!e||"object"!=typeof e)return{message:"DeepSeek balance response was not JSON."};let g=function(a){let b=Array.isArray(a?.balance_infos)?a.balance_infos:[],c=[];for(let a of b){if(!a||"object"!=typeof a)continue;let b="string"==typeof a.currency?a.currency.toUpperCase():"";if(!b)continue;let d=(0,f.IQ)(a.total_balance??a.totalBalance,0);c.push({currency:b,totalBalance:d,grantedBalance:(0,f.IQ)(a.granted_balance??a.grantedBalance,0),toppedUpBalance:(0,f.IQ)(a.topped_up_balance??a.toppedUpBalance,0)})}return c}(e);if(0===g.length)return{plan:"DeepSeek",message:"DeepSeek connected. No balance data returned."};let h=!0===e.is_available||!0===e.isAvailable,i={};for(let a of g){let b=Math.max(0,a.totalBalance);i[`Balance (${a.currency})`]={used:0,total:b,remainingPercentage:100*(b>0),resetAt:null,unlimited:!1,isCreditBalance:!0,currency:a.currency}}return{plan:h?"DeepSeek":"DeepSeek (Insufficient Balance)",quotas:i}}catch(a){return{message:`DeepSeek error: ${a.message}`}}}let N=(0,f.U)("opencode-go").url,O={rolling:"Rolling",weekly:"Weekly",monthly:"Monthly"};async function P(a=null,b=null){if(!a||"string"!=typeof a||!a.trim())return{message:"OpenCode Go API key not available. Add a key to view usage."};try{let c=await (0,d.proxyAwareFetch)(N,{method:"GET",headers:{Authorization:`Bearer ${a.trim()}`,Accept:"application/json"}},b);if(401===c.status)return{plan:"OpenCode Go",message:"OpenCode Go authentication failed. Check the API key."};if(403===c.status){let a=await c.json().catch(()=>null),b=a?.error?.type==="EntitlementError";return{plan:"OpenCode Go",message:b?"OpenCode Go subscription required for this API key.":"OpenCode Go access forbidden for this API key."}}if(!c.ok)return{plan:"OpenCode Go",message:`OpenCode Go usage API error (${c.status}).`};let e=await c.json().catch(()=>null);if(!e?.usage||"object"!=typeof e.usage)return{plan:"OpenCode Go",message:"OpenCode Go usage response did not contain quota data."};let g={};for(let[a,b]of Object.entries(O)){let c=e.usage[a];if(!c||"object"!=typeof c)continue;let d=function(a){if("number"==typeof a&&Number.isFinite(a))return a;if("string"==typeof a&&a.trim()){let b=Number(a);if(Number.isFinite(b))return b}return null}(c.percent);if(null===d)continue;let h=Math.max(0,Math.min(100,(0,f.IQ)(d,0)));g[b]={used:h,total:100,remaining:100-h,remainingPercentage:100-h,resetAt:(0,f.eZ)(c.resetsAt),unlimited:!1}}if(0===Object.keys(g).length)return{plan:"OpenCode Go",message:"OpenCode Go usage response did not contain valid quota data."};return{plan:"OpenCode Go",quotas:g}}catch(a){return{message:`OpenCode Go error: ${a.message}`}}}let Q=(0,f.U)("groq").url;function R(a,b,c,d){let e,f=a.get(b),g=a.get(c);if(null===f||null===g)return null;let h=Number(f),i=Number(g);return Number.isFinite(h)&&Number.isFinite(i)?{used:Math.max(0,h-i),total:h,resetAt:null===(e=function(a){let b;if("string"!=typeof a||!a.trim())return null;let c=/(\d+(?:\.\d+)?)(ms|s|m|h)/g,d=0,e=!1;for(;b=c.exec(a);){e=!0;let a=Number(b[1]),c=b[2];d+=a*("h"===c?36e5:"m"===c?6e4:"ms"===c?1:1e3)}return e?d:null}(a.get(d)))?null:new Date(Date.now()+e).toISOString(),unlimited:!1}:null}async function S(a,b=null){if(!a||"string"!=typeof a||!a.trim())return{message:"Groq API key not available. Add a key to view usage."};try{let c=await (0,d.proxyAwareFetch)(Q,{method:"GET",headers:{Authorization:`Bearer ${a.trim()}`,Accept:"application/json"}},b);if(401===c.status||403===c.status)return{plan:"Groq",message:"Groq authentication failed. Check the API key."};if(!c.ok){let a=await c.text().catch(()=>"");return{plan:"Groq",message:`Groq usage API error (${c.status})${a?`: ${a.slice(0,120)}`:""}`}}await c.text().catch(()=>{});let e=R(c.headers,"x-ratelimit-limit-requests","x-ratelimit-remaining-requests","x-ratelimit-reset-requests"),f=R(c.headers,"x-ratelimit-limit-tokens","x-ratelimit-remaining-tokens","x-ratelimit-reset-tokens");if(!e&&!f)return{plan:"Groq",message:"Groq connected. No rate-limit data reported for this key yet.",quotas:{}};let g={};return e&&(g.Requests=e),f&&(g.Tokens=f),{plan:"Groq",quotas:g}}catch(a){return{message:`Groq error: ${a.message}`}}}var T=c(35047),U=c(38684);async function V(a=null,b=null,c=null){let e=await (0,U.Fp)(b,c);if("number"==typeof e.percent&&Number.isFinite(e.percent)){let a=Math.max(0,Math.min(100,Math.round(e.percent))),b=null;if("number"==typeof e.resetAt&&e.resetAt>0)b=new Date(1e3*e.resetAt).toISOString();else if("string"==typeof e.resetDate){let a=new Date(`${e.resetDate}T00:00:00Z`);Number.isNaN(a.getTime())||(b=a.toISOString())}return{plan:"Xiaomi MiMo Desktop",quotas:{Weekly:{used:100-a,total:100,remainingPercentage:a,resetAt:b,unlimited:!1}}}}let f=a||b?.apiKey;if(!f||"string"!=typeof f||!f.trim())return{message:"Xiaomi MiMo Desktop not connected. Add credentials to view usage."};try{let a=await (0,d.proxyAwareFetch)("https://aistudio.xiaomimimo.com/open-apis/v1/user/usage",{method:"GET",headers:{Authorization:`Bearer ${f.trim()}`,"X-Mimo-Source":"mimocode-cli",Accept:"application/json"},signal:AbortSignal.timeout(1e4)},c);if(401===a.status)return{plan:"Xiaomi MiMo Desktop",message:"Weekly quota requires Xiaomi account session. API key alone is insufficient."};if(!a.ok)return{plan:"Xiaomi MiMo Desktop",message:`Usage API error (${a.status})`};let b=await a.json().catch(()=>null);if(!b||0!==b.code||!b.data)return{plan:"Xiaomi MiMo Desktop",message:"Usage endpoint returned unexpected response."};let{percent:e,resetDate:g}=b.data;if("number"!=typeof e||!Number.isFinite(e))return{plan:"Xiaomi MiMo Desktop",message:"Usage data missing percent field."};let h=Math.max(0,Math.min(100,Math.round(e))),i=null;if(g&&"string"==typeof g){let a=new Date(`${g}T00:00:00Z`);Number.isNaN(a.getTime())||(i=a.toISOString())}return{plan:"Xiaomi MiMo Desktop",quotas:{Weekly:{used:100-h,total:100,remainingPercentage:h,resetAt:i,unlimited:!1}}}}catch(a){return{message:`Xiaomi MiMo Desktop usage error: ${a.message}`}}}var W=c(30881);let X={international:(0,f.U)("glm").url,china:(0,f.U)("glm-cn").url};async function Y(a,b,c=null){if(!a)return{message:"GLM API key not available."};let e=X["glm-cn"===b?"china":"international"];try{let b=await (0,d.proxyAwareFetch)(e,{headers:{Authorization:`Bearer ${a}`,Accept:"application/json"}},c);if(!b.ok){if(401===b.status)return{message:"GLM API key invalid or expired."};return{message:`GLM quota API error (${b.status}).`}}let f=await b.json(),g=f?.data&&"object"==typeof f.data?f.data:{},h=Array.isArray(g.limits)?g.limits:[],i={};for(let a of h){if(!a||"TOKENS_LIMIT"!==a.type&&"CREDIT_LIMIT"!==a.type)continue;let b=Number(a.percentage)||0,c=Number(a.nextResetTime)||0,d=Math.max(0,100-b);i[3===a.unit?`Session (${a.number}h)`:6===a.unit?"Weekly (7d)":"TOKENS_LIMIT"===a.type?"Tokens":`Limit (${a.number})`]={used:b,total:100,remaining:d,remainingPercentage:d,resetAt:c>0?new Date(c).toISOString():null,unlimited:!1}}let j="string"==typeof g.level?g.level:"";return{plan:j?j.charAt(0).toUpperCase()+j.slice(1).toLowerCase():"Unknown",quotas:i}}catch(a){return{message:`GLM error: ${a.message}`}}}let Z=(process.env.COMMAND_CODE_API_BASE_URL||"https://api.commandcode.ai").replace(/\/$/,""),$={"individual-go":"Go","individual-goat":"GOAT","individual-pro":"Pro","individual-pro-v1":"Pro","individual-provider":"Provider","individual-max":"Max","individual-ultra":"Ultra","teams-pro":"Teams Pro"},_={"individual-go":10,"individual-goat":70,"individual-pro":30,"individual-pro-v1":80,"individual-provider":15,"individual-max":150,"individual-ultra":300,"teams-pro":40};function aa(a,b){let c=new URLSearchParams(Object.entries(b||{}).filter(([,a])=>null!=a)).toString();return c?`${a}?${c}`:a}function ab(a){if(!a||"object"!=typeof a)return null;let b=(0,f.IQ)(a.used,0),c=(0,f.IQ)(a.cap,0);return c<=0&&b<=0?null:{used:b,total:c,remaining:Math.max(0,c-b),unlimited:!1,resetAt:(0,f.eZ)(a.resetAt)}}async function ac(a,b=null){if(!a||"string"!=typeof a||!a.trim())return{message:"Command Code API key not available. Add a key to view usage."};let c={Authorization:`Bearer ${a.trim()}`,Accept:"application/json"},e=async a=>await (0,d.proxyAwareFetch)(Z+a,{method:"GET",headers:c},b);try{let a=await e(aa("/alpha/whoami",{limits:"1"}));if(401===a.status||403===a.status)return{plan:"Command Code",message:"Command Code authentication failed. Check the API key."};if(!a.ok)return{plan:"Command Code",message:`Command Code usage API error (${a.status})`};let b=await a.json().catch(()=>({})),c=b?.org?.id??null,[d,g]=await Promise.all([e(aa("/alpha/billing/credits",{orgId:c})),e(aa("/alpha/billing/subscriptions",{orgId:c}))]);if(401===d.status||403===d.status||401===g.status||403===g.status)return{plan:"Command Code",message:"Command Code authentication failed. Check the API key."};if(!d.ok)return{plan:"Command Code",message:`Command Code credits API error (${d.status})`};if(!g.ok)return{plan:"Command Code",message:`Command Code subscriptions API error (${g.status})`};let h=await d.json().catch(()=>({})),i=await g.json().catch(()=>({})),j=i?.data?.planId??null,k=j&&$[j]||j||"Command Code",l=j&&_[j]||0,m=h?.credits||{},n=(0,f.IQ)(m.monthlyCredits,0)+(0,f.IQ)(m.purchasedCredits,0)+(0,f.IQ)(m.freeCredits,0),o=l>0?Math.max(0,l-n):0,p={};p.Credits={used:o,total:l>0?l:n,remaining:n,unlimited:l<=0,resetAt:(0,f.eZ)(i?.data?.currentPeriodEnd)};let q=ab(h?.windowLimits?.fiveHour);q&&(p["Session (5h)"]=q);let r=ab(h?.windowLimits?.weekly);return r&&(p.Weekly=r),{plan:k,quotas:p}}catch(a){return{message:`Command Code error: ${a.message}`}}}let ad=(0,f.U)("vercel-ai-gateway").url;async function ae(a){try{return{message:"iFlow connected. Usage tracked per request."}}catch(a){return{message:"Unable to fetch iFlow usage."}}}async function af(a,b,c=null){if(!a)return{message:"Ollama Cloud API key not available."};try{let b,f=await (0,d.proxyAwareFetch)("https://ollama.com/api/usage",{headers:{Authorization:`Bearer ${a}`,Accept:"application/json"}},c);if(401===f.status||403===f.status)return{message:"Ollama Cloud API key invalid or expired."};if(!f.ok)return{message:`Ollama Cloud usage API error (${f.status}).`};try{b=await f.json()}catch{return{message:"Ollama Cloud usage response was not JSON."}}let g=await (0,d.proxyAwareFetch)("https://ollama.com/api/me",{method:"POST",headers:{Authorization:`Bearer ${a}`,Accept:"application/json","Content-Length":"0"}},c).then(a=>a.ok?a.json():null).catch(()=>null),h="string"==typeof g?.Plan?g.Plan:"",i=h?h.charAt(0).toUpperCase()+h.slice(1).toLowerCase():"Ollama Cloud",j=b?.limits&&"object"==typeof b.limits?b.limits:{};function e(a,b=null){let c=Math.max(0,Math.min(1,Number(a)||0)),d=Math.round(100*c);return{used:d,total:100,remainingPercentage:100-d,resetAt:b,unlimited:!1}}let k=j.session?.usage,l=j.weekly?.usage,m=Number(k),n=Number(l),o=null!=k&&!Number.isNaN(m),p=null!=l&&!Number.isNaN(n);if(!o&&!p)return{plan:i,message:"Ollama Cloud connected. No usage limits reported.",quotas:{}};let q={};return o&&(q["Session (5h)"]=e(m)),p&&(q["Weekly (7d)"]=e(n)),{plan:i,quotas:q}}catch(a){return{message:`Ollama Cloud error: ${a.message}`}}}async function ag(a,b=null){if(!a)return{message:"Vercel AI Gateway API key not available."};try{let c=await (0,d.proxyAwareFetch)(ad,{method:"GET",headers:{Authorization:`Bearer ${a}`,Accept:"application/json"}},b);if(401===c.status||403===c.status)return{message:"Vercel AI Gateway API key invalid or expired."};if(!c.ok){let a=await c.text().catch(()=>""),b=a?`: ${a.slice(0,200)}`:"";return{message:`Vercel AI Gateway credits API error (${c.status})${b}`}}let e=await c.json(),f=Number(e?.balance)||0,g=Number(e?.total_used)||0;if(f<=0&&g<=0)return{plan:"Pay-as-you-go",message:"Vercel AI Gateway connected. No credit allocation found (BYOK or unfunded account).",quotas:{}};return{plan:"Pay-as-you-go",quotas:{"Used (USD)":{used:g,total:0,remaining:0,remainingPercentage:100,unlimited:!0},"Remaining (USD)":{used:f,total:5,remaining:f,remainingPercentage:f/5*100,unlimited:!1}}}}catch(a){return{message:`Vercel AI Gateway error: ${a.message}`}}}async function ah(a,b=null){if(!a)return{message:"Qoder usage unavailable: no access token"};try{let c=await (0,d.proxyAwareFetch)((0,f.U)("qoder").url,{method:"GET",headers:{Authorization:`Bearer ${a}`,Accept:"application/json"}},b);if(!c.ok)return{message:`Qoder connected. Usage fetch returned ${c.status}.`};let e=await c.json().catch(()=>null);if(!e)return{message:"Qoder connected. Usage response was not JSON."};let g=e.userQuota||{},h=e.orgResourcePackage||{},i=Number.isFinite(Number(e.expiresAt))&&Number(e.expiresAt)>0?Number(e.expiresAt):null,j=i?new Date(i).toISOString():null;return{quotas:{user:{total:Number(g.total)||0,used:Number(g.used)||0,remaining:Number(g.remaining)||0,unit:g.unit||"credits",resetAt:j},organization:{total:Number(h.total)||0,used:Number(h.used)||0,remaining:Number(h.remaining)||0,unit:h.unit||"credits",resetAt:j}},totalUsagePercentage:Number(e.totalUsagePercentage)||0,isQuotaExceeded:!!e.isQuotaExceeded,expiresAt:i}}catch(a){return{message:`Qoder connected. Unable to fetch usage: ${a.message}`}}}let ai={github:a=>h(a.accessToken,a.providerSpecificData,a.proxyOptions),antigravity:a=>(0,j.c)(a.accessToken,a.providerSpecificData,a.proxyOptions),claude:a=>(0,k.g)(a.accessToken,a.proxyOptions,{force:a.force}),codex:a=>(0,l.Tl)(a.accessToken,a.proxyOptions),qoder:async a=>{let b=await (0,W._M)(a,a.proxyOptions).catch(()=>null);return ah(b?.accessToken||a.accessToken,a.proxyOptions)},iflow:a=>ae(a.accessToken),ollama:a=>af(a.apiKey,a.providerSpecificData,a.proxyOptions),glm:a=>Y(a.apiKey,a.provider,a.proxyOptions),"glm-cn":a=>Y(a.apiKey,a.provider,a.proxyOptions),minimax:a=>t(a.apiKey,a.provider,a.proxyOptions),"minimax-cn":a=>t(a.apiKey,a.provider,a.proxyOptions),"vercel-ai-gateway":a=>ag(a.apiKey,a.proxyOptions),"codebuddy-cn":a=>w(a.accessToken,a.apiKey,a.providerSpecificData,a.proxyOptions),"codebuddy-intl":a=>x(a.accessToken,a.apiKey,a.providerSpecificData,a.proxyOptions),"grok-cli":a=>L(a.accessToken,a.providerSpecificData,a.proxyOptions),"opencode-go":a=>P(a.apiKey,a.proxyOptions),deepseek:a=>M(a.apiKey,a.proxyOptions),groq:a=>S(a.apiKey,a.proxyOptions),zed:a=>(0,T.vL)(a.accessToken,a.providerSpecificData,a.proxyOptions),"xiaomi-mimo":a=>V(a.accessToken,a.providerSpecificData,a.proxyOptions),commandcode:a=>ac(a.apiKey,a.proxyOptions)};async function aj(a,b=null,c={}){let{provider:d,accessToken:e,apiKey:f,providerSpecificData:g,projectId:h}=a,i={...g||{},...h?{projectId:h}:{}},j=ai[d];return j?await j({provider:d,accessToken:e,apiKey:f,providerSpecificData:g,providerDataWithProjectId:i,proxyOptions:b,force:!0===c.force}):{message:`Usage API not implemented for ${d}`}}},66823:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>m,refreshAndUpdateCredentials:()=>l});var e=c(36343),f=c(2398),g=c(6719),h=c(62282),i=c(98630),j=c(19287),k=a([e,h]);[e,h]=k.then?(await k)():k;let n=["expired","authentication","unauthorized","401","re-authorize"];async function l(a,b=!1,c=null){let d=(0,h.SB)(a.provider),e={accessToken:a.accessToken,refreshToken:a.refreshToken,idToken:a.idToken,expiresAt:a.expiresAt||a.tokenExpiresAt,lastRefreshAt:a.lastRefreshAt,connectionId:a.id,providerSpecificData:a.providerSpecificData,copilotToken:a.providerSpecificData?.copilotToken,copilotTokenExpiresAt:a.providerSpecificData?.copilotTokenExpiresAt};if(!(b||d.needsRefresh(e)))return{connection:a,refreshed:!1};let g=await d.refreshCredentials(e,console,c);if(!g){if(a.accessToken)return{connection:a,refreshed:!1};throw Error("Failed to refresh credentials. Please re-authorize the connection.")}let i={updatedAt:new Date().toISOString()};g.accessToken&&(i.accessToken=g.accessToken),g.refreshToken&&(i.refreshToken=g.refreshToken),g.idToken&&(i.idToken=g.idToken),g.lastRefreshAt&&(i.lastRefreshAt=g.lastRefreshAt),g.expiresIn?(i.expiresAt=new Date(Date.now()+1e3*g.expiresIn).toISOString(),i.expiresIn=g.expiresIn):g.expiresAt&&(i.expiresAt=g.expiresAt);let j={...g.providerSpecificData||{},...g.copilotToken?{copilotToken:g.copilotToken}:{},...g.copilotTokenExpiresAt?{copilotTokenExpiresAt:g.copilotTokenExpiresAt}:{}};return Object.keys(j).length>0&&(i.providerSpecificData={...a.providerSpecificData||{},...j}),await (0,f.updateProviderConnection)(a.id,i),{connection:{...a,...i,providerSpecificData:i.providerSpecificData||a.providerSpecificData},refreshed:!0}}async function m(a,{params:b}){let c;try{let{connectionId:d}=await b,e="1"===new URL(a.url).searchParams.get("force");if(!(c=await (0,f.Mc)(d)))return Response.json({error:"Connection not found"},{status:404});let h="oauth"===c.authType,k=("apikey"===c.authType||"api_key"===c.authType)&&j.jO.includes(c.provider);if(!h&&!k)return Response.json({message:"Usage not available for this connection"});let m=await (0,i.B)(c.providerSpecificData),o={connectionProxyEnabled:!0===m.connectionProxyEnabled,connectionProxyUrl:m.connectionProxyUrl||"",connectionNoProxy:m.connectionNoProxy||"",vercelRelayUrl:m.vercelRelayUrl||"",strictProxy:!1};if(h)try{c=(await l(c,!1,o)).connection}catch(a){return console.error("[Usage API] Credential refresh failed:",a),Response.json({error:`Credential refresh failed: ${a.message}`},{status:401})}let p=await (0,g.my)(c,o,{force:e});if(h&&function(a){if(!a?.message)return!1;let b=a.message.toLowerCase();return n.some(a=>b.includes(a))}(p)&&c.refreshToken)try{c=(await l(c,!0,o)).connection,p=await (0,g.my)(c,o,{force:e})}catch(a){console.warn(`[Usage] ${c.provider}: force refresh failed: ${a.message}`)}return Response.json(p)}catch(b){let a=c?.provider??"unknown";return console.warn(`[Usage] ${a}: ${b.message}`),Response.json({error:b.message},{status:500})}}d()}catch(a){d(a)}})},66852:(a,b,c)=>{c.d(b,{g:()=>j});var d=c(35841),e=c(13385),f=c(51215);let g={oauthUsageUrl:(0,f.U)("claude").oauthUrl,usageUrl:(0,f.U)("claude").orgUrl,settingsUrl:(0,f.U)("claude").settingsUrl,apiVersion:e.b8},h=new Map,i=new Map;async function j(a,b=null,c={}){let d=c?.force===!0;if(!d&&a){let b=i.get(a);if(b?.promise)return b.promise;if(b&&b.expiresAt>Date.now())return b.result}let e=!d&&a&&i.get(a)?.result||null,f=(async()=>{let c=await k(a,b);return a&&c?.quotas?(i.set(a,{result:c,expiresAt:Date.now()+3e5}),c):e||c})();return a&&i.set(a,{promise:f}),f}async function k(a,b=null){try{let c=h.get(a);if(c&&Date.now()<c)return await l(a,b);let e=await (0,d.proxyAwareFetch)(g.oauthUsageUrl,{method:"GET",headers:{Authorization:`Bearer ${a}`,"anthropic-beta":"oauth-2025-04-20","anthropic-version":g.apiVersion}},b);if(e.ok){let a=await e.json(),b={},c=a=>a&&"object"==typeof a&&"number"==typeof a.utilization,d=a=>{let b=a.utilization,c=Math.max(0,100-b);return{used:b,total:100,remaining:c,remainingPercentage:c,resetAt:(0,f.eZ)(a.resets_at),unlimited:!1}};for(let[e,f]of(c(a.five_hour)&&(b["session (5h)"]=d(a.five_hour)),c(a.seven_day)&&(b["weekly (7d)"]=d(a.seven_day)),Object.entries(a)))if(e.startsWith("seven_day_")&&"seven_day"!==e&&c(f)){let a=e.replace("seven_day_","");b[`weekly ${a} (7d)`]=d(f)}if(Array.isArray(a.limits))for(let c of a.limits){if(c?.kind!=="weekly_scoped")continue;let a=String(c?.scope?.model?.display_name||"").trim().toLowerCase();a&&"number"==typeof c.percent&&(b[`weekly ${a} (7d)`]=d({utilization:Math.max(0,Math.min(100,c.percent)),resets_at:c.resets_at}))}return{plan:"Claude Code",extraUsage:a.extra_usage??null,quotas:b}}return 429===e.status&&h.set(a,Date.now()+18e4),console.warn(`[Claude Usage] OAuth endpoint returned ${e.status}, falling back to legacy`),await l(a,b)}catch(a){return{message:`Claude connected. Unable to fetch usage: ${a.message}`}}}async function l(a,b=null){try{let c=await (0,d.proxyAwareFetch)(g.settingsUrl,{method:"GET",headers:{Authorization:`Bearer ${a}`,"anthropic-version":g.apiVersion}},b);if(c.ok){let e=await c.json();if(e.organization_id){let c=await (0,d.proxyAwareFetch)(g.usageUrl.replace("{org_id}",e.organization_id),{method:"GET",headers:{Authorization:`Bearer ${a}`,"anthropic-version":g.apiVersion}},b);if(c.ok){let a=await c.json();return{plan:e.plan||"Unknown",organization:e.organization_name,quotas:a}}}return{plan:e.plan||"Unknown",organization:e.organization_name,message:"Claude connected. Usage details require admin access."}}return{message:"Claude connected. Usage API requires admin permissions."}}catch(a){return{message:`Claude connected. Unable to fetch usage: ${a.message}`}}}setInterval(function(){let a=Date.now();for(let[b,c]of i)c?.promise||(!c||c.expiresAt<=a)&&i.delete(b);for(let[b,c]of h)c<=a&&h.delete(b)},3e5).unref?.()},81887:(a,b,c)=>{c.d(b,{RO:()=>m,Tl:()=>k,Yt:()=>l});var d=c(35841),e=c(51215);let f={usageUrl:(0,e.U)("codex").url,resetCreditsUrl:(0,e.U)("codex").resetCreditsUrl,resetCreditsConsumeUrl:(0,e.U)("codex").resetCreditsConsumeUrl};function g(a){if(!a)return null;let b=a instanceof Date?a:new Date("number"==typeof a&&a<1e12?1e3*a:a);return Number.isFinite(b.getTime())?b.toISOString():null}function h(a){return!a||"object"!=typeof a||Array.isArray(a)?null:a.rate_limit&&"object"==typeof a.rate_limit?a.rate_limit:a}function i(a){let b=Math.max(0,Math.min(100,(0,e.IQ)(a?.used_percent??a?.percent_used,0)));return{used:b,total:100,remaining:Math.max(0,100-b),resetAt:(0,e.eZ)(a?.reset_at??a?.resets_at??a?.resetAt??null),unlimited:!1}}function j(a,b,c){let d=h(c);if(!d)return!1;let e=d.primary_window||d.primary||c.primary_window||c.primary,f=d.secondary_window||d.secondary||c.secondary_window||c.secondary,g=!1;return e&&(a[b?`${b}_session`:"session"]=i(e),g=!0),f&&(a[b?`${b}_weekly`:"weekly"]=i(f),g=!0),g}async function k(a,b=null){try{let c=await (0,d.proxyAwareFetch)(f.usageUrl,{method:"GET",headers:{Authorization:`Bearer ${a}`,Accept:"application/json"}},b);if(!c.ok)return{message:`Codex connected. Usage API temporarily unavailable (${c.status}).`};let g=await c.json(),i=g.rate_limit||g.rate_limits||g.rate_limits_by_limit_id?.codex||{},k=function(a){if(a.code_review_rate_limit||a.review_rate_limit)return a.code_review_rate_limit||a.review_rate_limit;let b=a.rate_limits_by_limit_id;return b&&"object"==typeof b&&!Array.isArray(b)?b.code_review||b.codex_review||b.review||null:(Array.isArray(a.additional_rate_limits)?a.additional_rate_limits:[]).find(a=>{let b=String(a?.limit_name||a?.metered_feature||a?.id||"").toLowerCase();return"code_review"===b||"codex_review"===b||"review"===b||b.includes("review")})||null}(g),l=function(a){if(a.spark_rate_limit||a.gpt_5_3_codex_spark_rate_limit)return a.spark_rate_limit||a.gpt_5_3_codex_spark_rate_limit;let b=a.rate_limits_by_limit_id;return b&&"object"==typeof b&&!Array.isArray(b)?b["gpt-5.3-codex-spark"]||b.gpt_5_3_codex_spark||b.spark||null:(Array.isArray(a.additional_rate_limits)?a.additional_rate_limits:[]).find(a=>{let b=String(a?.limit_name||a?.metered_feature||a?.id||"").toLowerCase();return b.includes("spark")||b.includes("5.3-codex-spark")})||null}(g),m=Math.max(0,(0,e.IQ)(g.rate_limit_reset_credits?.available_count,0)),n={};return j(n,"",i),j(n,"review",k),j(n,"spark",l),{plan:g.plan_type||g.summary?.plan||"unknown",limitReached:h(i)?.limit_reached||!1,reviewLimitReached:h(k)?.limit_reached||!1,sparkLimitReached:h(l)?.limit_reached||!1,resetCredits:{availableCount:m},quotas:n}}catch(a){throw Error(`Failed to fetch Codex usage: ${a.message}`)}}async function l(a,b=null,c=null){var h,i;if(!a)throw Error("No Codex access token available. Please re-authorize the connection.");let j=c?.workspaceId||c?.accountId||c?.chatgptAccountId||null,k={Authorization:`Bearer ${a}`,Accept:"application/json","OpenAI-Beta":"codex-1",originator:"codex_cli_rs"};j&&(k["ChatGPT-Account-ID"]=j);let m=await (0,d.proxyAwareFetch)(f.resetCreditsUrl,{method:"GET",headers:k},b),n=null;try{n=await m.json()}catch{n=null}if(!m.ok)throw Error((h=n?.message||n?.error||n?.detail,i=`Codex reset credits API unavailable (${m.status}).`,h?"string"==typeof h?h:"string"==typeof h.message?h.message:JSON.stringify(h):i));let o=Array.isArray(n?.credits)?n.credits:[];return{availableCount:Math.max(0,(0,e.IQ)(n?.available_count??n?.availableCount,0)),credits:o.map(a=>({status:String(a?.status||"unknown"),grantedAt:g(a?.granted_at??a?.grantedAt),expiresAt:g(a?.expires_at??a?.expiresAt)}))}}async function m(a,b,c=null){let g;if(!a)throw Error("No Codex access token available. Please re-authorize the connection.");if(!b||"string"!=typeof b)throw Error("A redeem request id is required to consume a Codex reset credit.");let h=null;try{g=await (0,d.proxyAwareFetch)(f.resetCreditsConsumeUrl,{method:"POST",headers:{Authorization:`Bearer ${a}`,Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({redeem_request_id:b})},c);let e=await g.text();h=e?JSON.parse(e):null}catch(a){throw Error(`Failed to consume Codex reset credit: ${a.message}`)}let i=h?.code||null,j=(0,e.IQ)(h?.windows_reset,0);return{ok:g.ok&&("reset"===i||j>0),noCredit:g.ok&&"no_credit"===i,status:g.status,code:i,windowsReset:j,message:h?.message||null,raw:h}}}};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";exports.id=7019,exports.ids=[7019],exports.modules={9585:(a,b,c)=>{c.d(b,{d_:()=>j,mA:()=>i});var d=c(2398),e=c(16549),f=c(27816);let g={xmtp:"xiaomi-tokenplan","xiaomi-tokenplan":"xiaomi-tokenplan"},h=new Set(Object.keys(g));for(let a of f.default)for(let b of(h.add(a.id),a.alias&&h.add(a.alias),a.aliases||[]))h.add(b);async function i(a){let b,c=(b=(0,e.Xh)(a),b?.providerAlias&&g[b.providerAlias]?{...b,provider:g[b.providerAlias]}:b);if(!c.isAlias){if(!h.has(c.providerAlias)){let a=
|
|
1
|
+
"use strict";exports.id=7019,exports.ids=[7019],exports.modules={9585:(a,b,c)=>{c.d(b,{d_:()=>j,mA:()=>i});var d=c(2398),e=c(16549),f=c(27816);let g={xmtp:"xiaomi-tokenplan","xiaomi-tokenplan":"xiaomi-tokenplan"},h=new Set(Object.keys(g));for(let a of f.default)for(let b of(h.add(a.id),a.alias&&h.add(a.alias),a.aliases||[]))h.add(b);async function i(a){let b,c=(b=(0,e.Xh)(a),b?.providerAlias&&g[b.providerAlias]?{...b,provider:g[b.providerAlias]}:b);if(!c.isAlias){if(!h.has(c.providerAlias)){let a=await (0,d.Fh)();for(let b of["openai-compatible","anthropic-compatible","custom-embedding"]){let d=a.find(a=>a.type===b&&a.prefix===c.providerAlias);if(d)return{provider:d.id,model:c.model}}}return{provider:c.provider,model:c.model}}return await (0,d.Dj)(c.model)?{provider:null,model:c.model}:(0,e.js)(a,d.OM)}async function j(a){if(a.includes("/"))return null;let b=await (0,d.Dj)(a);return b&&b.models&&b.models.length>0?b.models:null}},12905:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{P:()=>z});var e=c(36343),f=c(83892),g=c(30924),h=c(64239),i=c(2398),j=c(9585),k=c(94844),l=c(33118),m=c(78213),n=c(42975),o=c(88115),p=c(2310),q=c(50747),r=c(24141),s=c(97508),t=c(74258),u=c(37645),v=c(99614),w=c(75800),x=c(37785),y=a([e,k]);async function z(a,b=null){let c;try{c=await a.json()}catch{return u.warn("CHAT","Invalid JSON body"),(0,o.yj)(s.gx.BAD_REQUEST,"Invalid JSON body")}b||(b={endpoint:new URL(a.url).pathname,body:c,headers:Object.fromEntries(a.headers.entries())});let{model:d,contextMarker:e}=(0,x.V)(c.model);e&&(c.model=d);let g=a.headers.get("Authorization"),h=(0,f.Tr)(a);if(g&&h){let a=u.maskKey(h);u.debug("AUTH",`API Key: ${a}`)}else u.debug("AUTH","No API key provided (local mode)");let k=await (0,i.mt)();if(k.requireApiKey){if(!h)return u.warn("AUTH","Missing API key (requireApiKey=true)"),(0,o.yj)(s.gx.UNAUTHORIZED,"Missing API key");if(!await (0,f.kI)(h))return u.warn("AUTH","Invalid API key (requireApiKey=true)"),(0,o.yj)(s.gx.UNAUTHORIZED,"Invalid API key")}if(!d)return u.warn("CHAT","Missing model"),(0,o.yj)(s.gx.BAD_REQUEST,"Missing model");let l=a?.headers?.get("user-agent")||"",m=(0,r.c)(c,d,l,!!k.ccFilterNaming);if(m)return m.response||m;let n=(0,p.t8)(c),t=await (0,j.d_)(d);if(t){let e=k.comboStrategies||{},f=e[d]?.fallbackStrategy||k.comboStrategy||"fallback",g=(0,q.R8)(t,n,k),i=g.filter(a=>!t.includes(a));if("fusion"===f)return u.info("CHAT",`Combo "${d}" with ${t.length} models (strategy: fusion)`),(0,p.vt)({body:c,models:t,handleSingleModel:(c,d,e)=>{let f=b;if(e&&b){let{tools:a,tool_choice:c,...d}=b.body||{};f={...b,body:d}}return A(c,d,f,a,h)},log:u,comboName:d,judgeModel:e[d]?.judgeModel,tuning:e[d]?.fusionTuning});let j=k.comboStickyRoundRobinLimit;return u.info("CHAT",`Combo "${d}" with ${g.length} models (strategy: ${f}, sticky: ${j})`),(0,p.Pr)({body:c,models:g,handleSingleModel:(0,q.ar)((c,d)=>A(c,d,b,a,h),i),log:u,comboName:d,comboStrategy:f,comboStickyLimit:j})}let v=(0,q.R8)([d],n,k);if(v.length>1){let e=v.filter(a=>a!==d);return u.info("CHAT",`Capacity adapter for [${[...n].join(",")}] on "${d}" → trying ${v.join(", ")}`),(0,p.Pr)({body:c,models:v,handleSingleModel:(0,q.ar)((c,d)=>A(c,d,b,a,h),e),log:u,comboName:d,comboStrategy:(0,q.vB)(n,k)})}return A(c,d,b,a,h)}async function A(a,b,c=null,d=null,e=null){let r=await (0,j.mA)(b);if(!r.provider){let f=await (0,j.d_)(b);if(f){let g=await (0,i.mt)(),h=g.comboStrategies||{},j=h[b]?.fallbackStrategy||g.comboStrategy||"fallback",k=(0,p.t8)(a),l=(0,q.R8)(f,k,g),m=l.filter(a=>!f.includes(a));if("fusion"===j)return u.info("CHAT",`Combo "${b}" with ${f.length} models (strategy: fusion)`),(0,p.vt)({body:a,models:f,handleSingleModel:(a,b,f)=>{let g=c;if(f&&c){let{tools:a,tool_choice:b,...d}=c.body||{};g={...c,body:d}}return A(a,b,g,d,e)},log:u,comboName:b,judgeModel:h[b]?.judgeModel,tuning:h[b]?.fusionTuning});let n=g.comboStickyRoundRobinLimit;return u.info("CHAT",`Combo "${b}" with ${l.length} models (strategy: ${j}, sticky: ${n})`),(0,p.Pr)({body:a,models:l,handleSingleModel:(0,q.ar)((a,b)=>A(a,b,c,d,e),m),log:u,comboName:b,comboStrategy:j,comboStickyLimit:n})}return u.warn("CHAT","Invalid model format",{model:b}),(0,o.yj)(s.gx.BAD_REQUEST,"Invalid model format")}let{provider:x,model:y}=r,z=d?.headers?.get("user-agent")||"",B=new Set,C=null,D=null;for(;;){let b=await (0,f.c1)(x,B,y);if(!b||b.allRateLimited){if(b?.allRateLimited){let a=C||b.lastError||"Unavailable",c=s.gx.SERVICE_UNAVAILABLE;return u.warn("CHAT",`[${x}/${y}] ${a} (${b.retryAfterHuman})`),(0,o.wO)(c,`[${x}/${y}] ${a}`,b.retryAfter,b.retryAfterHuman)}if(0===B.size)return u.warn("AUTH",`No active credentials for provider: ${x}`),(0,o.yj)(s.gx.NOT_FOUND,`No active credentials for provider: ${x}`);return u.warn("CHAT","No more accounts available",{provider:x}),(0,o.yj)(D||s.gx.SERVICE_UNAVAILABLE,C||"All accounts unavailable")}let j=await (0,v.checkAndRefreshToken)(x,b);if("antigravity"===x&&!j.projectId){let a=await (0,w.eG)(b.connectionId,j.accessToken,x);a&&(j.projectId=a,(0,v.vN)(b.connectionId,{projectId:a}).catch(a=>{u.warn("CHAT",`failed to persist projectId for ${b.connectionId}:`,a)}))}let p=await (0,i.mt)(),q=(p.providerThinking||{})[x]||null,r=await (0,k.wk)({body:{...a,model:`${x}/${y}`},modelInfo:{provider:x,model:y},credentials:j,log:u,clientRawRequest:c,connectionId:b.connectionId,userAgent:z,apiKey:e,ccFilterNaming:!!p.ccFilterNaming,rtkEnabled:!!p.rtkEnabled,headroomEnabled:!!p.headroomEnabled,headroomUrl:p.headroomUrl||l.ag,headroomCompressUserMessages:!!p.headroomCompressUserMessages,headroomTimeoutMs:p.headroomTimeoutMs,cavemanEnabled:!!p.cavemanEnabled,cavemanLevel:p.cavemanLevel||"full",ponytailEnabled:!!p.ponytailEnabled,ponytailLevel:p.ponytailLevel||"full",pxpipeEnabled:!!p.pxpipeEnabled,pxpipeMinChars:p.pxpipeMinChars,pxpipeTimeoutMs:p.pxpipeTimeoutMs,pxpipeTransform:p.pxpipeEnabled?await (0,m.RG)():null,onPxpipeEvent:n.T0,providerThinking:q,sourceFormatOverride:d?.url?(0,t.t)(new URL(d.url).pathname,a):null,onCredentialsRefreshed:async a=>{await (0,v.vN)(b.connectionId,{...a,existingProviderSpecificData:b.providerSpecificData,testStatus:"active"})},onRequestSuccess:async()=>{await (0,f.Pt)(b.connectionId,b,y),(0,g.vO)(b.connectionId,y),(0,h.iK)(b.connectionId)}});if(r.success)return r.response;let A=null,E=r.resetsAtMs;if("antigravity"===x&&(409===r.status||429===r.status)&&(A=await (0,g.XJ)(b.connectionId,r.status,y,j.accessToken,b.providerSpecificData))&&(E=A),"zed"===x&&(402===r.status||403===r.status||429===r.status)&&(A=await (0,h.KS)(b.connectionId,r.status,y,j.accessToken,b.providerSpecificData,r.error))&&(E=A),("antigravity"===x||"zed"===x)&&A||(await (0,f.vk)(b.connectionId,r.status,r.error,x,y,E)).shouldFallback){u.warn("FALLBACK",`⇄ ACC:${b.connectionName} UNAVAILABLE (${r.status}) → NEXT ACCOUNT`),B.add(b.connectionId),C=r.error,D=r.status;continue}return r.response}}[e,k]=y.then?(await y)():y,d()}catch(a){d(a)}})},15499:(a,b,c)=>{c.d(b,{CG:()=>q,ED:()=>u,S1:()=>s,XF:()=>j,_g:()=>t,no:()=>r,sW:()=>w});var d=c(29021),e=c.n(d),f=c(33873),g=c.n(f),h=c(79646),i=c(51336);let j=g().join(i.n,"pxpipe"),k="pxpipe-proxy",l=g().join(j,"install.log"),m="win32"===process.platform,n=[...m?[`${process.env.ProgramFiles||""}\\nodejs`,`${process.env.APPDATA||""}\\npm`]:["/usr/local/bin","/opt/homebrew/bin",`${process.env.HOME||""}/.local/bin`,"/usr/bin","/bin"],process.env.PATH||""].filter(Boolean).join(g().delimiter),o=null;function p(){return g().join(j,"node_modules",k)}function q(){return g().join(p(),"dist","core","library.js")}function r(){try{let a=(0,h.execSync)(`${m?"where":"which"} npm`,{stdio:["ignore","pipe","ignore"],windowsHide:!0,env:{...process.env,PATH:n}}).toString().trim();return a?a.split(/\r?\n/)[0].trim():null}catch{return null}}function s(){try{let a=g().join(p(),"package.json");if(!e().existsSync(a)||!e().existsSync(q()))return{installed:!1,version:null,path:null};let b=JSON.parse(e().readFileSync(a,"utf8"));return{installed:!0,version:b.version||null,path:p()}}catch{return{installed:!1,version:null,path:null}}}function t(){return null!==o}function u(){return o||(o=v().finally(()=>{o=null}))}async function v(){let a=r();if(!a){let a=Error("npm not found on PATH — Node.js/npm is required to install PXPIPE");throw a.code="NPM_NOT_FOUND",a}e().existsSync(j)||e().mkdirSync(j,{recursive:!0});let b=g().join(j,"package.json");e().existsSync(b)||e().writeFileSync(b,JSON.stringify({name:"10router-pxpipe-host",private:!0},null,2));let c=e().openSync(l,"a");e().writeSync(c,`
|
|
2
2
|
[${new Date().toISOString()}] npm install ${k}@latest
|
|
3
|
-
`),await new Promise((b,d)=>{let e=(0,h.spawn)(a,["install",`${k}@latest`,"--no-audit","--no-fund","--omit=dev"],{cwd:j,stdio:["ignore",c,c],windowsHide:!0,env:{...process.env,PATH:n}}),f=setTimeout(()=>{e.kill("SIGKILL"),d(Error("npm install timed out after 5 minutes — see install.log"))},3e5);e.once("error",a=>{clearTimeout(f),d(a)}),e.once("exit",a=>{clearTimeout(f),0===a?b():d(Error(`npm install exited with code ${a} — see install.log`))})}).finally(()=>e().closeSync(c));let d=s();if(!d.installed)throw Error("install finished but package is missing — see install.log");return d}function w(a=200){try{if(!e().existsSync(l))return"";return e().readFileSync(l,"utf8").split(/\r?\n/).filter(Boolean).slice(-a).join("\n")}catch{return""}}},28567:(a,b,c)=>{c.d(b,{KC:()=>t,OA:()=>p,PROVIDER_MODELS:()=>f.vq,SM:()=>j,Xg:()=>s,cY:()=>u,ez:()=>o,fZ:()=>k,kt:()=>q,ux:()=>n});var d=c(83336),e=c(27816),f=c(87156),g=c(68443),h=c(66016),i=c(74258);function j(a){return f.vq[a]||[]}function k(a){let b=f.vq[a];return b?.[0]?.id||null}let l=new Set(["kr"]);function m(a,b,c){if(!a)return;let d="string"==typeof b?b.replace(/\([^()]+\)\s*$/,"").trim():b,e=a.find(a=>a.id===b||a.id===d);if(e)return e;if(!l.has(c))return;let f=(0,g.Kq)(d);if(f!==d)return a.find(a=>a.id===f)}function n(a,b){if((!a||"oc"===a||"opencode"===a||"ocg"===a||"opencode-go"===a||"ocz"===a||"opencode-zen"===a)&&(0,h.nh)(b))return i.h.OPENAI_RESPONSES;let c=f.vq[a];return c?(0,g.gr)(m(c,b,a)):null}function o(a,b){let c=f.vq[a];return c?(0,g.ec)(m(c,b,a)):null}function p(a,b){let c=f.vq[a];if(!c)return null;let d=m(c,b,a);return d?.kind||d?.type||null}function q(a,b){let c="string"==typeof b?b.match(/\([^()]+\)\s*$/):null,d=c?c[0]:"",e=d?b.slice(0,c.index).trim():b,g=m(f.vq[a],e,a),i=g?.upstreamModelId||g?.id;if(i){let a=i.match(/\([^()]+\)\s*$/),b=a?.[0]||"";return(b?i.slice(0,a.index).trim():i)+(d||b)}return"cx"===a&&"string"==typeof e&&e.endsWith(h.d5)?e.slice(0,-h.d5.length)+d:e+d}let r=Object.fromEntries(e.default.filter(a=>a.alias&&a.alias!==a.id).map(a=>[a.id,a.alias])),s=Object.fromEntries(Object.keys(d.xq).map(a=>[a,r[a]||a]));function t(a){let b=s[a]||a;return f.vq[b]||[]}function u(a,b){return(0,g.g5)(m(f.vq[a],b,a))}},33118:(a,b,c)=>{c.d(b,{F_:()=>g,Nc:()=>h,Qh:()=>t,Su:()=>q,ag:()=>o,kI:()=>p,rl:()=>u,sy:()=>s});var d=c(79646),e=c(33873),f=c.n(e);let g=["code","ml"],h={code:["tree-sitter","tree-sitter-language-pack"],ml:["torch","huggingface-hub"]},i="win32"===process.platform,j=i?"where":"which",k=i?[`${process.env.LOCALAPPDATA||""}\\Programs\\Python\\Python313\\Scripts`,`${process.env.LOCALAPPDATA||""}\\Programs\\Python\\Python312\\Scripts`,`${process.env.LOCALAPPDATA||""}\\Programs\\Python\\Python311\\Scripts`,`${process.env.LOCALAPPDATA||""}\\Programs\\Python\\Python310\\Scripts`,`${process.env.APPDATA||""}\\Python\\Python313\\Scripts`]:["/usr/local/bin","/opt/homebrew/bin","/Library/Frameworks/Python.framework/Versions/3.13/bin","/Library/Frameworks/Python.framework/Versions/3.12/bin","/Library/Frameworks/Python.framework/Versions/3.11/bin","/Library/Frameworks/Python.framework/Versions/3.10/bin",`${process.env.HOME||""}/.local/bin`,"/usr/bin","/bin"],l=[...k,process.env.PATH||""].filter(Boolean).join(f().delimiter),m=["python3.13","python3.12","python3.11","python3.10","python3","python"],n=new Set(["localhost","127.0.0.1","::1","[::1]","0.0.0.0"]),o=process.env.HEADROOM_URL||"http://localhost:8787";function p(){try{let a=(0,d.execSync)(`${j} headroom`,{stdio:["ignore","pipe","ignore"],windowsHide:!0,env:{...process.env,PATH:l}}).toString().trim();return a?a.split(/\r?\n/)[0].trim():null}catch{return null}}function q(){let a=null;for(let b of function(){let a=[],b=p();if(b){let c=f().dirname(b);for(let b of i?["python.exe","python3.exe"]:["python3","python3.13","python"])a.push(f().join(c,b))}for(let b of k)if(b)for(let c of m)a.push(f().join(b,i?`${c}.exe`:c));return a.push(...m),a}())try{let c=(0,d.execSync)(`${b} --version`,{stdio:["ignore","pipe","ignore"],windowsHide:!0,env:{...process.env,PATH:l}}).toString().trim().match(/(\d+)\.(\d+)/);if(!c)continue;let[e,f]=[parseInt(c[1],10),parseInt(c[2],10)];if(!(e>3||3===e&&f>=10))continue;a||(a=b);try{return(0,d.execFileSync)(b,["-m","pip","show","headroom-ai"],{stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:8e3,env:{...process.env,PATH:l}}),b}catch{}}catch{}return a}async function r(a){if(!a)return!1;let b=String(a).replace(/\/$/,"");try{return(await fetch(`${b}/health`,{signal:AbortSignal.timeout(1500)})).ok}catch{return!1}}function s(a){try{let b=new URL(a);return n.has(b.hostname)}catch{return!1}}async function t(a){let b=p(),c=q(),d=!!b,e=await r(a),f=s(a),g=d?u(c):{installed:!1,version:null,extras:{code:!1,ml:!1}};return{installed:d,path:b,running:e,python:c,localUrl:f,canStart:d&&f,version:g.version,extras:g.extras}}function u(a){let b=a||q();if(!b)return{installed:!1,version:null,extras:{code:!1,ml:!1}};try{let a=(0,d.execFileSync)(b,["-m","pip","list","--format=json","--disable-pip-version-check"],{stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:8e3,env:{...process.env,PATH:l}}).toString(),c=JSON.parse(a),e=new Set(c.map(a=>String(a.name||"").toLowerCase()));if(!e.has("headroom-ai"))return{installed:!1,version:null,extras:{code:!1,ml:!1}};let f=c.find(a=>a.name?.toLowerCase()==="headroom-ai")?.version||null,i={};for(let a of g)i[a]=h[a].some(a=>e.has(a));return{installed:!0,version:f,extras:i}}catch{return{installed:!1,version:null,extras:{code:!1,ml:!1}}}}},37785:(a,b,c)=>{c.d(b,{V:()=>e});let d=/\[1m\]$/i;function e(a){if("string"!=typeof a)return{model:a,contextMarker:null};let b=a.trim(),c=b.match(d);return c?{model:b.slice(0,-c[0].length),contextMarker:c[0].slice(1,-1).toLowerCase()}:{model:a,contextMarker:null}}},42975:(a,b,c)=>{c.d(b,{Az:()=>l,SP:()=>o,T0:()=>k});var d=c(29021),e=c.n(d),f=c(33873),g=c.n(f),h=c(15499);let i=g().join(h.XF,"events.jsonl"),j=g().join(h.XF,"events.jsonl.1");function k(a){try{e().existsSync(h.XF)||e().mkdirSync(h.XF,{recursive:!0});try{e().statSync(i).size>5242880&&e().renameSync(i,j)}catch{}e().appendFile(i,JSON.stringify({ts:Date.now(),...a})+"\n",()=>{})}catch{}}function l({sinceMs:a=null,limit:b=null}={}){let c=[];for(let b of[j,i])try{if(!e().existsSync(b))continue;for(let d of e().readFileSync(b,"utf8").split("\n"))if(d)try{let b=JSON.parse(d);if(a&&b.ts<a)continue;c.push(b)}catch{}}catch{}return c.sort((a,b)=>a.ts-b.ts),b?c.slice(-b):c}function m(){return{requests:0,compressed:0,bypassed:0,errors:0,tokensBeforeEst:0,tokensAfterEst:0,tokensSavedEst:0,savedPct:0,imagesGenerated:0,compressionTimeMs:0,avgCompressionMs:0}}function n(a,b){a.requests++,b.applied?(a.compressed++,a.tokensBeforeEst+=b.tokensBeforeEst||0,a.tokensAfterEst+=b.tokensAfterEst||0,a.tokensSavedEst+=b.tokensSavedEst||0,a.imagesGenerated+=b.imageCount||0,a.compressionTimeMs+=b.durationMs||0):"transform_error"===b.reason||"timeout"===b.reason?a.errors++:a.bypassed++}function o({timelineDays:a=30,recentLimit:b=100}={}){let c=l(),d=Date.now(),e=new Date(new Date(d).setHours(0,0,0,0)).getTime(),f={all:m(),today:m(),yesterday:m(),last7d:m(),last30d:m()},g=new Map;for(let b=a-1;b>=0;b--){let a=new Date(e-864e5*b);g.set(a.toISOString().slice(0,10),{date:a.toISOString().slice(0,10),tokensSavedEst:0,compressed:0,requests:0})}for(let a of c){n(f.all,a),a.ts>=e?n(f.today,a):a.ts>=e-864e5&&n(f.yesterday,a),a.ts>=d-6048e5&&n(f.last7d,a),a.ts>=d-2592e6&&n(f.last30d,a);let b=new Date(a.ts).toISOString().slice(0,10),c=g.get(b);c&&(c.requests++,a.applied&&(c.compressed++,c.tokensSavedEst+=a.tokensSavedEst||0))}for(let a of Object.values(f))a.savedPct=a.tokensBeforeEst>0?+(a.tokensSavedEst/a.tokensBeforeEst*100).toFixed(2):0,a.avgCompressionMs=a.compressed>0?Math.round(a.compressionTimeMs/a.compressed):0;return{windows:f,timeline:[...g.values()],recent:c.slice(-b).reverse()}}},50747:(a,b,c)=>{c.d(b,{R8:()=>j,ar:()=>l,vB:()=>h});var d=c(12151);let e=["vision","pdf","audioInput","videoInput"],f=new Set(e);function g(a,b){var c;let d=Array.isArray(c=b?.capacityAdapter?.[a])?{enabled:!0,roundRobin:!1,models:c.map(a=>a?.model||a).filter(Boolean)}:c&&"object"==typeof c?{enabled:!1!==c.enabled,roundRobin:!!c.roundRobin,models:Array.isArray(c.models)?c.models.filter(Boolean):[]}:{enabled:!1,roundRobin:!1,models:[]};return d.enabled&&0===d.models.length?{...d,models:["oc/mimo-v2.5-free"]}:d}function h(a,b){for(let c of[...a||[]].filter(a=>f.has(a))){let{enabled:a,models:d}=g(c,b);if(a&&0!==d.length)return function(a,b){let{enabled:c,roundRobin:d}=g(a,b);return c&&d?"round-robin":"fallback"}(c,b)}return"fallback"}function i(a,b){let c=a.indexOf("/"),e=c>0?a.slice(0,c):"",f=c>0?a.slice(c+1):a,g=(0,d.getCapabilitiesForModel)(e,f);return b.every(a=>!0===g[a])}function j(a,b,c){let d=[...b||[]].filter(a=>f.has(a));if(0===d.length||!Array.isArray(a)||0===a.length||a.some(a=>i(a,d)))return a;let h=(function(a){let b=new Set,c=[];for(let d of e){let{enabled:e,models:f}=g(d,a);if(e)for(let a of f)b.has(a)||(b.add(a),c.push(a))}return c})(c).filter(b=>!a.includes(b)&&i(b,d));return 0===h.length?a:[...h,...a]}function k(a){return"string"==typeof a?a.length:Array.isArray(a)?a.reduce((a,b)=>a+("string"==typeof b?.text?b.text.length:50),0):0}function l(a,b){let c=new Set(b);return 0===c.size?a:(b,e,...f)=>{if(c.has(e)){let a=e.indexOf("/"),c=a>0?e.slice(0,a):"",f=a>0?e.slice(a+1):e,{contextWindow:g}=(0,d.getCapabilitiesForModel)(c,f);b=function(a,b){let c=Array.isArray(a.messages)?"messages":Array.isArray(a.input)?"input":Array.isArray(a.contents)?"contents":null;if(!c)return a;let d=a[c];if(!d||0===d.length)return a;let e=a=>"system"===a||"developer"===a,f=d.filter(a=>e(a?.role)),g=d.filter(a=>!e(a?.role));if(0===g.length)return a;let h=a=>"assistant"===a||"model"===a,i=g.length-1;for(;i>=0&&!h(g[i]?.role);)i--;let j=g.slice(i+1),l=g.slice(0,i+1);if(0===l.length)return a;let m=a=>a.content??a.parts,n=.8*(b||2e5)*4,o=l.slice(0,6),p=f.concat(o,j).reduce((a,b)=>a+k(m(b)),0);for(;p>n&&o.length>0;)p-=k(m(o.pop()));return o.length===l.length?a:{...a,[c]:[...f,...o,...j]}}(b,g)}return a(b,e,...f)}}},66016:(a,b,c)=>{c.d(b,{d5:()=>d,nh:()=>e});let d="-review";function e(a){if(!a||"string"!=typeof a)return!1;let b=a.replace(/\([^()]+\)\s*$/,"").trim(),c=b.includes("/")?b.split("/").pop():b;return/^muse[-_]?spark(?:$|[-_:.\s])/i.test(c)}},74258:(a,b,c)=>{c.d(b,{h:()=>d,t:()=>e});let d={OPENAI:"openai",OPENAI_RESPONSES:"openai-responses",OPENAI_RESPONSE:"openai-response",CLAUDE:"claude",GEMINI:"gemini",CODEX:"codex",ANTIGRAVITY:"antigravity",CURSOR:"cursor",OLLAMA:"ollama",COMMANDCODE:"commandcode"};function e(a,b){return a.includes("/v1/responses")?d.OPENAI_RESPONSES:a.includes("/v1/messages")?d.CLAUDE:a.includes("/v1/chat/completions")&&Array.isArray(b?.input)?d.OPENAI:null}},78213:(a,b,c)=>{c.d(b,{Mo:()=>h,RG:()=>l,V:()=>i,Y8:()=>k,xl:()=>m});var d=c(79551),e=c(15499);let f=null,g=null;function h(){return f?{loaded:!0,version:f.version,loadedAt:f.loadedAt}:{loaded:!1}}async function i(){return f||g||(g=j().finally(()=>{g=null}))}async function j(){let a=(0,e.S1)();if(!a.installed){let a=Error("PXPIPE is not installed");throw a.code="NOT_INSTALLED",a}let b=`${(0,d.pathToFileURL)((0,e.CG)()).href}?v=${encodeURIComponent(a.version||"0")}`,c=await import(b);if("function"!=typeof c.transformAnthropicMessages)throw Error("installed pxpipe package does not export transformAnthropicMessages");return f={module:c,version:a.version,loadedAt:Date.now()}}function k(){let a=!!f;return f=null,a}async function l({autoLoad:a=!0}={}){try{if(!f&&!a)return null;let{module:b}=await i();return b.transformAnthropicMessages}catch{return null}}async function m(){let a=Date.now(),{module:b}=await i(),c=new TextEncoder().encode(JSON.stringify({model:"claude-fable-5",max_tokens:16,messages:[{role:"user",content:"ping"}]})),d=await b.transformAnthropicMessages({body:c,model:"claude-fable-5"});if(!d||"boolean"!=typeof d.applied||!(d.body instanceof Uint8Array))throw Error("transform returned an unexpected shape");return{ok:!0,reason:d.reason,durationMs:Date.now()-a}}}};
|
|
3
|
+
`),await new Promise((b,d)=>{let e=(0,h.spawn)(a,["install",`${k}@latest`,"--no-audit","--no-fund","--omit=dev"],{cwd:j,stdio:["ignore",c,c],windowsHide:!0,env:{...process.env,PATH:n}}),f=setTimeout(()=>{e.kill("SIGKILL"),d(Error("npm install timed out after 5 minutes — see install.log"))},3e5);e.once("error",a=>{clearTimeout(f),d(a)}),e.once("exit",a=>{clearTimeout(f),0===a?b():d(Error(`npm install exited with code ${a} — see install.log`))})}).finally(()=>e().closeSync(c));let d=s();if(!d.installed)throw Error("install finished but package is missing — see install.log");return d}function w(a=200){try{if(!e().existsSync(l))return"";return e().readFileSync(l,"utf8").split(/\r?\n/).filter(Boolean).slice(-a).join("\n")}catch{return""}}},28567:(a,b,c)=>{c.d(b,{KC:()=>t,OA:()=>p,PROVIDER_MODELS:()=>f.vq,SM:()=>j,Xg:()=>s,cY:()=>u,ez:()=>o,fZ:()=>k,kt:()=>q,ux:()=>n});var d=c(83336),e=c(27816),f=c(87156),g=c(68443),h=c(66016),i=c(74258);function j(a){return f.vq[a]||[]}function k(a){let b=f.vq[a];return b?.[0]?.id||null}let l=new Set(["kr"]);function m(a,b,c){if(!a)return;let d="string"==typeof b?b.replace(/\([^()]+\)\s*$/,"").trim():b,e=a.find(a=>a.id===b||a.id===d);if(e)return e;if(!l.has(c))return;let f=(0,g.Kq)(d);if(f!==d)return a.find(a=>a.id===f)}function n(a,b){if((!a||"oc"===a||"opencode"===a||"ocg"===a||"opencode-go"===a||"ocz"===a||"opencode-zen"===a)&&(0,h.nh)(b))return i.h.OPENAI_RESPONSES;let c=f.vq[a];return c?(0,g.gr)(m(c,b,a)):null}function o(a,b){let c=f.vq[a];return c?(0,g.ec)(m(c,b,a)):null}function p(a,b){let c=f.vq[a];if(!c)return null;let d=m(c,b,a);return d?.kind||d?.type||null}function q(a,b){let c="string"==typeof b?b.match(/\([^()]+\)\s*$/):null,d=c?c[0]:"",e=d?b.slice(0,c.index).trim():b,g=m(f.vq[a],e,a),i=g?.upstreamModelId||g?.id;if(i){let a=i.match(/\([^()]+\)\s*$/),b=a?.[0]||"";return(b?i.slice(0,a.index).trim():i)+(d||b)}return"cx"===a&&"string"==typeof e&&e.endsWith(h.d5)?e.slice(0,-h.d5.length)+d:e+d}let r=Object.fromEntries(e.default.filter(a=>a.alias&&a.alias!==a.id).map(a=>[a.id,a.alias])),s=Object.fromEntries(Object.keys(d.xq).map(a=>[a,r[a]||a]));function t(a){let b=s[a]||a;return f.vq[b]||[]}function u(a,b){return(0,g.g5)(m(f.vq[a],b,a))}},33118:(a,b,c)=>{c.d(b,{F_:()=>g,Nc:()=>h,Qh:()=>t,Su:()=>q,ag:()=>o,kI:()=>p,rl:()=>u,sy:()=>s});var d=c(79646),e=c(33873),f=c.n(e);let g=["code","ml"],h={code:["tree-sitter","tree-sitter-language-pack"],ml:["torch","huggingface-hub"]},i="win32"===process.platform,j=i?"where":"which",k=i?[`${process.env.LOCALAPPDATA||""}\\Programs\\Python\\Python313\\Scripts`,`${process.env.LOCALAPPDATA||""}\\Programs\\Python\\Python312\\Scripts`,`${process.env.LOCALAPPDATA||""}\\Programs\\Python\\Python311\\Scripts`,`${process.env.LOCALAPPDATA||""}\\Programs\\Python\\Python310\\Scripts`,`${process.env.APPDATA||""}\\Python\\Python313\\Scripts`]:["/usr/local/bin","/opt/homebrew/bin","/Library/Frameworks/Python.framework/Versions/3.13/bin","/Library/Frameworks/Python.framework/Versions/3.12/bin","/Library/Frameworks/Python.framework/Versions/3.11/bin","/Library/Frameworks/Python.framework/Versions/3.10/bin",`${process.env.HOME||""}/.local/bin`,"/usr/bin","/bin"],l=[...k,process.env.PATH||""].filter(Boolean).join(f().delimiter),m=["python3.13","python3.12","python3.11","python3.10","python3","python"],n=new Set(["localhost","127.0.0.1","::1","[::1]","0.0.0.0"]),o=process.env.HEADROOM_URL||"http://localhost:8787";function p(){try{let a=(0,d.execSync)(`${j} headroom`,{stdio:["ignore","pipe","ignore"],windowsHide:!0,env:{...process.env,PATH:l}}).toString().trim();return a?a.split(/\r?\n/)[0].trim():null}catch{return null}}function q(){let a=null;for(let b of function(){let a=[],b=p();if(b){let c=f().dirname(b);for(let b of i?["python.exe","python3.exe"]:["python3","python3.13","python"])a.push(f().join(c,b))}for(let b of k)if(b)for(let c of m)a.push(f().join(b,i?`${c}.exe`:c));return a.push(...m),a}())try{let c=(0,d.execSync)(`${b} --version`,{stdio:["ignore","pipe","ignore"],windowsHide:!0,env:{...process.env,PATH:l}}).toString().trim().match(/(\d+)\.(\d+)/);if(!c)continue;let[e,f]=[parseInt(c[1],10),parseInt(c[2],10)];if(!(e>3||3===e&&f>=10))continue;a||(a=b);try{return(0,d.execFileSync)(b,["-m","pip","show","headroom-ai"],{stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:8e3,env:{...process.env,PATH:l}}),b}catch{}}catch{}return a}async function r(a){if(!a)return!1;let b=String(a).replace(/\/$/,"");try{return(await fetch(`${b}/health`,{signal:AbortSignal.timeout(1500)})).ok}catch{return!1}}function s(a){try{let b=new URL(a);return n.has(b.hostname)}catch{return!1}}async function t(a){let b=p(),c=q(),d=!!b,e=await r(a),f=s(a),g=d?u(c):{installed:!1,version:null,extras:{code:!1,ml:!1}};return{installed:d,path:b,running:e,python:c,localUrl:f,canStart:d&&f,version:g.version,extras:g.extras}}function u(a){let b=a||q();if(!b)return{installed:!1,version:null,extras:{code:!1,ml:!1}};try{let a=(0,d.execFileSync)(b,["-m","pip","list","--format=json","--disable-pip-version-check"],{stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:8e3,env:{...process.env,PATH:l}}).toString(),c=JSON.parse(a),e=new Set(c.map(a=>String(a.name||"").toLowerCase()));if(!e.has("headroom-ai"))return{installed:!1,version:null,extras:{code:!1,ml:!1}};let f=c.find(a=>a.name?.toLowerCase()==="headroom-ai")?.version||null,i={};for(let a of g)i[a]=h[a].some(a=>e.has(a));return{installed:!0,version:f,extras:i}}catch{return{installed:!1,version:null,extras:{code:!1,ml:!1}}}}},37785:(a,b,c)=>{c.d(b,{V:()=>e});let d=/\[1m\]$/i;function e(a){if("string"!=typeof a)return{model:a,contextMarker:null};let b=a.trim(),c=b.match(d);return c?{model:b.slice(0,-c[0].length),contextMarker:c[0].slice(1,-1).toLowerCase()}:{model:a,contextMarker:null}}},42975:(a,b,c)=>{c.d(b,{Az:()=>l,SP:()=>o,T0:()=>k});var d=c(29021),e=c.n(d),f=c(33873),g=c.n(f),h=c(15499);let i=g().join(h.XF,"events.jsonl"),j=g().join(h.XF,"events.jsonl.1");function k(a){try{e().existsSync(h.XF)||e().mkdirSync(h.XF,{recursive:!0});try{e().statSync(i).size>5242880&&e().renameSync(i,j)}catch{}e().appendFile(i,JSON.stringify({ts:Date.now(),...a})+"\n",()=>{})}catch{}}function l({sinceMs:a=null,limit:b=null}={}){let c=[];for(let b of[j,i])try{if(!e().existsSync(b))continue;for(let d of e().readFileSync(b,"utf8").split("\n"))if(d)try{let b=JSON.parse(d);if(a&&b.ts<a)continue;c.push(b)}catch{}}catch{}return c.sort((a,b)=>a.ts-b.ts),b?c.slice(-b):c}function m(){return{requests:0,compressed:0,bypassed:0,errors:0,tokensBeforeEst:0,tokensAfterEst:0,tokensSavedEst:0,savedPct:0,imagesGenerated:0,compressionTimeMs:0,avgCompressionMs:0}}function n(a,b){a.requests++,b.applied?(a.compressed++,a.tokensBeforeEst+=b.tokensBeforeEst||0,a.tokensAfterEst+=b.tokensAfterEst||0,a.tokensSavedEst+=b.tokensSavedEst||0,a.imagesGenerated+=b.imageCount||0,a.compressionTimeMs+=b.durationMs||0):"transform_error"===b.reason||"timeout"===b.reason?a.errors++:a.bypassed++}function o({timelineDays:a=30,recentLimit:b=100}={}){let c=l(),d=Date.now(),e=new Date(new Date(d).setHours(0,0,0,0)).getTime(),f={all:m(),today:m(),yesterday:m(),last7d:m(),last30d:m()},g=new Map;for(let b=a-1;b>=0;b--){let a=new Date(e-864e5*b);g.set(a.toISOString().slice(0,10),{date:a.toISOString().slice(0,10),tokensSavedEst:0,compressed:0,requests:0})}for(let a of c){n(f.all,a),a.ts>=e?n(f.today,a):a.ts>=e-864e5&&n(f.yesterday,a),a.ts>=d-6048e5&&n(f.last7d,a),a.ts>=d-2592e6&&n(f.last30d,a);let b=new Date(a.ts).toISOString().slice(0,10),c=g.get(b);c&&(c.requests++,a.applied&&(c.compressed++,c.tokensSavedEst+=a.tokensSavedEst||0))}for(let a of Object.values(f))a.savedPct=a.tokensBeforeEst>0?+(a.tokensSavedEst/a.tokensBeforeEst*100).toFixed(2):0,a.avgCompressionMs=a.compressed>0?Math.round(a.compressionTimeMs/a.compressed):0;return{windows:f,timeline:[...g.values()],recent:c.slice(-b).reverse()}}},66016:(a,b,c)=>{c.d(b,{d5:()=>d,nh:()=>e});let d="-review";function e(a){if(!a||"string"!=typeof a)return!1;let b=a.replace(/\([^()]+\)\s*$/,"").trim(),c=b.includes("/")?b.split("/").pop():b;return/^muse[-_]?spark(?:$|[-_:.\s])/i.test(c)}},74258:(a,b,c)=>{c.d(b,{h:()=>d,t:()=>e});let d={OPENAI:"openai",OPENAI_RESPONSES:"openai-responses",OPENAI_RESPONSE:"openai-response",CLAUDE:"claude",GEMINI:"gemini",CODEX:"codex",ANTIGRAVITY:"antigravity",CURSOR:"cursor",OLLAMA:"ollama",COMMANDCODE:"commandcode"};function e(a,b){return a.includes("/v1/responses")?d.OPENAI_RESPONSES:a.includes("/v1/messages")?d.CLAUDE:a.includes("/v1/chat/completions")&&Array.isArray(b?.input)?d.OPENAI:null}},78213:(a,b,c)=>{c.d(b,{Mo:()=>h,RG:()=>l,V:()=>i,Y8:()=>k,xl:()=>m});var d=c(79551),e=c(15499);let f=null,g=null;function h(){return f?{loaded:!0,version:f.version,loadedAt:f.loadedAt}:{loaded:!1}}async function i(){return f||g||(g=j().finally(()=>{g=null}))}async function j(){let a=(0,e.S1)();if(!a.installed){let a=Error("PXPIPE is not installed");throw a.code="NOT_INSTALLED",a}let b=`${(0,d.pathToFileURL)((0,e.CG)()).href}?v=${encodeURIComponent(a.version||"0")}`,c=await import(b);if("function"!=typeof c.transformAnthropicMessages)throw Error("installed pxpipe package does not export transformAnthropicMessages");return f={module:c,version:a.version,loadedAt:Date.now()}}function k(){let a=!!f;return f=null,a}async function l({autoLoad:a=!0}={}){try{if(!f&&!a)return null;let{module:b}=await i();return b.transformAnthropicMessages}catch{return null}}async function m(){let a=Date.now(),{module:b}=await i(),c=new TextEncoder().encode(JSON.stringify({model:"claude-fable-5",max_tokens:16,messages:[{role:"user",content:"ping"}]})),d=await b.transformAnthropicMessages({body:c,model:"claude-fable-5"});if(!d||"boolean"!=typeof d.applied||!(d.body instanceof Uint8Array))throw Error("transform returned an unexpected shape");return{ok:!0,reason:d.reason,durationMs:Date.now()-a}}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
exports.id=7348,exports.ids=[7348],exports.modules={18142:(a,b,c)=>{"use strict";c.d(b,{YW:()=>d.Page,pV:()=>d.CardGrid,wn:()=>d.Section,zY:()=>d.PageHeader}),c(73865),c(55204);var d=c(19509)},20482:(a,b,c)=>{"use strict";c.d(b,{CK:()=>i.default,G9:()=>l.default,Iz:()=>r.default,KX:()=>s.PanelSkeleton,LF:()=>f.default,LH:()=>m.default,Mu:()=>s.StatCardSkeleton,Nf:()=>j.default,Qv:()=>e.CardSkeleton,YW:()=>u.YW,gw:()=>q.default,jK:()=>k.default,nh:()=>t.default,pV:()=>u.pV,rq:()=>g.default,uR:()=>h.default,uo:()=>d.ConfirmModal,vE:()=>n.default,vj:()=>o.default,wI:()=>p.default,wn:()=>u.wn,zY:()=>u.zY}),c(28907);var d=c(87121),e=c(53546);c(62648),c(77562),c(79517),c(66453);var f=c(71e3),g=c(16582),h=c(94725),i=c(98279),j=c(22354),k=c(65666);c(49451),c(82466),c(70047),c(32328),c(92249);var l=c(85405),m=c(91236),n=c(89630),o=c(87556),p=c(46009);c(54928);var q=c(5409),r=c(12710);c(92393),c(51);var s=c(11442),t=c(9656),u=c(18142)},41296:(a,b,c)=>{"use strict";c.d(b,{default:()=>r});var d=c(86240),e=c(70433),f=c(4271),g=c(63265),h=c(81501),i=c(67209),j=c(31952),k=c(28907),l=c(20482),m=c(57145);function n({label:a,url:b,copyId:c,copied:e,onCopy:f,badge:i,actions:l}){return(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`shrink-0 rounded px-1.5 py-0.5 text-center font-mono text-xs min-w-[88px] ${"CF"===i||"TS"===i?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"}`,children:a}),(0,d.jsx)(h.p,{value:b,readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,d.jsxs)(j.m_,{children:[(0,d.jsx)(j.k$,{asChild:!0,children:(0,d.jsx)("span",{className:"relative inline-flex",children:(0,d.jsx)(g.$,{variant:"ghost",size:"icon-sm",onClick:()=>f(b,c),children:(0,d.jsx)(k.default,{name:e===c?"check":"content_copy",className:"text-[18px]"})})})}),(0,d.jsx)(j.ZI,{side:"top",children:e===c?"Copied!":"Copy"})]}),l]})}var o=c(58503),p=c(70369);function q({message:a,action:b}){return(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-amber-500/10 border border-amber-500/20 text-amber-700 dark:text-amber-400",children:[(0,d.jsx)(k.default,{name:"warning",className:"text-[16px] shrink-0 mt-0.5"}),(0,d.jsx)("p",{className:"text-xs flex-1",children:a}),b&&(0,d.jsx)("a",{href:b.href,className:"text-xs font-medium underline shrink-0 hover:opacity-80",onClick:b.href.startsWith("#")?a=>{a.preventDefault(),document.getElementById(b.href.slice(1))?.scrollIntoView({behavior:"smooth"})}:void 0,children:b.label})]})}function r({machineId:a}){let[b,c]=(0,e.useState)([]),[s,t]=(0,e.useState)(!0),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(""),[y,z]=(0,e.useState)(null),[A,B]=(0,e.useState)(null),[C,D]=(0,e.useState)(!1),[E,F]=(0,e.useState)(new Set),[G,H]=(0,e.useState)(!1),{copied:I,copy:J}=(0,m.C)(),K=async a=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireApiKey:a})})).ok&&D(a)}catch(a){console.log("Error updating requireApiKey:",a)}},L=async()=>{try{let a=async()=>{let a=await fetch("/api/keys");return a.ok&&(await a.json()).keys||[]},b=await a();if(0===b.length)try{(await fetch("/api/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"Default Key"})})).ok&&(b=await a())}catch{}c(b)}catch(a){console.log("Error fetching data:",a)}finally{t(!1)}},M=async()=>{if(w.trim())try{let a=await fetch("/api/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:w})}),b=await a.json();a.ok&&(z(b.key),await L(),x(""),v(!1))}catch(a){console.log("Error creating key:",a)}},N=async a=>{B({title:"Delete API Key",message:"Delete this API key?",onConfirm:async()=>{B(null);try{(await fetch(`/api/keys/${a}`,{method:"DELETE"})).ok&&(c(b.filter(b=>b.id!==a)),F(b=>{let c=new Set(b);return c.delete(a),c}))}catch(a){console.log("Error deleting key:",a)}}})},[O,P]=(0,e.useState)("/v1");return s?(0,d.jsxs)(l.YW,{children:[(0,d.jsx)(l.KX,{}),(0,d.jsx)(l.KX,{})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(l.YW,{children:[(0,d.jsxs)(f.Zp,{children:[(0,d.jsx)(f.aR,{children:(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"p-2 rounded-[10px] bg-background text-muted-foreground",children:(0,d.jsx)(k.default,{name:"api",className:"text-[20px]"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)(f.ZB,{children:"API Endpoint"}),(0,d.jsx)(f.BT,{children:"Local and remote access URLs"})]})]})}),(0,d.jsx)(f.Wu,{children:(0,d.jsx)("div",{className:"flex flex-col gap-2",children:(0,d.jsx)(n,{label:"Local",url:O,copyId:"local_url",copied:I,onCopy:J})})})]}),(0,d.jsxs)(f.Zp,{id:"require-api-key",children:[(0,d.jsxs)(f.aR,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"p-2 rounded-[10px] bg-background text-muted-foreground",children:(0,d.jsx)(k.default,{name:"vpn_key",className:"text-[20px]"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)(f.ZB,{children:"API Keys"}),(0,d.jsx)(f.BT,{children:"Keys for authenticating gateway requests"})]})]}),(0,d.jsx)(f.X9,{children:(0,d.jsxs)(g.$,{onClick:()=>v(!0),children:[(0,d.jsx)(k.default,{name:"add"}),"Create Key"]})})]}),(0,d.jsxs)(f.Wu,{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between pb-4 mb-4 border-b border-border",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium",children:"Require API key"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:"Requests without a valid key will be rejected"})]}),(0,d.jsx)(p.d,{checked:C,onCheckedChange:()=>K(!C)})]}),G&&!C&&(0,d.jsx)("div",{className:"mb-4 -mt-2",children:(0,d.jsx)(q,{message:"Endpoint is exposed without an API key."})}),0===b.length?(0,d.jsxs)("div",{className:"text-center py-12",children:[(0,d.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,d.jsx)(k.default,{name:"vpn_key",className:"text-[32px]"})}),(0,d.jsx)("p",{className:"text-foreground font-medium mb-1",children:"No API keys yet"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Create your first API key to get started"}),(0,d.jsxs)(g.$,{onClick:()=>v(!0),children:[(0,d.jsx)(k.default,{name:"add"}),"Create Key"]})]}):(0,d.jsx)("div",{className:"flex flex-col",children:b.map(a=>{var b;return(0,d.jsxs)("div",{className:`group flex items-center justify-between py-3 border-b border-black/[0.03] dark:border-white/[0.03] last:border-b-0 ${!1===a.isActive?"opacity-60":""}`,children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:a.name}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,d.jsx)("code",{className:"text-xs text-muted-foreground font-mono",children:E.has(a.id)?a.key:(b=a.key)&&!(b.length<=10)?b.slice(0,6)+"•".repeat(b.length-10)+b.slice(-4):b||""}),(0,d.jsxs)(j.m_,{children:[(0,d.jsx)(j.k$,{asChild:!0,children:(0,d.jsx)("span",{className:"relative inline-flex",children:(0,d.jsx)(g.$,{variant:"ghost",size:"icon-xs",onClick:()=>{var b;return b=a.id,void F(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},children:(0,d.jsx)(k.default,{name:E.has(a.id)?"visibility_off":"visibility",className:"text-[14px]"})})})}),(0,d.jsx)(j.ZI,{side:"top",children:E.has(a.id)?"Hide key":"Show key"})]}),(0,d.jsxs)(j.m_,{children:[(0,d.jsx)(j.k$,{asChild:!0,children:(0,d.jsx)("span",{className:"relative inline-flex",children:(0,d.jsx)(g.$,{variant:"ghost",size:"icon-xs",onClick:()=>J(a.key,a.id),children:(0,d.jsx)(k.default,{name:I===a.id?"check":"content_copy",className:"text-[14px]"})})})}),(0,d.jsx)(j.ZI,{side:"top",children:I===a.id?"Copied!":"Copy"})]})]}),(0,d.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:["Created ",new Date(a.createdAt).toLocaleDateString()]}),!1===a.isActive&&(0,d.jsx)("p",{className:"text-xs text-orange-500 mt-1",children:"Paused"})]}),(0,d.jsx)("div",{className:"flex items-center gap-2",children:(0,d.jsx)(g.$,{variant:"ghost",size:"icon-sm",onClick:()=>N(a.id),className:"text-red-500 opacity-100 hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",children:(0,d.jsx)(k.default,{name:"delete",className:"text-[18px]"})})})]},a.id)})})]})]})]}),(0,d.jsx)(i.lG,{open:u,onOpenChange:a=>{a||(v(!1),x(""))},children:(0,d.jsxs)(i.Cf,{className:"max-w-md",children:[(0,d.jsx)(i.c7,{children:(0,d.jsx)(i.L3,{children:"Create API Key"})}),(0,d.jsx)("div",{className:"max-h-[calc(85vh-100px)] overflow-y-auto p-4",children:(0,d.jsx)("div",{className:"flex flex-col gap-4",children:(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,d.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Key Name"}),(0,d.jsx)(h.p,{value:w,onChange:a=>x(a.target.value),placeholder:"Production Key"})]})})}),(0,d.jsx)(i.Es,{children:(0,d.jsx)("div",{className:"flex w-full gap-2 sm:w-auto",children:(0,d.jsx)(g.$,{onClick:M,className:"w-full sm:w-auto",disabled:!w.trim(),children:"Create"})})})]})}),(0,d.jsx)(i.lG,{open:!!y,onOpenChange:a=>!a&&z(null),children:(0,d.jsxs)(i.Cf,{className:"max-w-md",children:[(0,d.jsx)(i.c7,{children:(0,d.jsx)(i.L3,{children:"API Key Created"})}),(0,d.jsx)("div",{className:"max-h-[calc(85vh-100px)] overflow-y-auto p-4",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(o.Fc,{children:(0,d.jsxs)(o.TN,{children:[(0,d.jsx)("span",{className:"font-medium",children:"Save this key now! "}),"This is the only time you will see this key. Store it securely."]})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.p,{value:y||"",readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,d.jsxs)(g.$,{variant:"secondary",onClick:()=>J(y,"created_key"),children:[(0,d.jsx)(k.default,{name:"created_key"===I?"check":"content_copy"}),"created_key"===I?"Copied!":"Copy"]})]})]})}),(0,d.jsx)(i.Es,{children:(0,d.jsx)(g.$,{onClick:()=>z(null),className:"w-full sm:w-auto",children:"Done"})})]})}),(0,d.jsx)(l.uo,{isOpen:!!A,onClose:()=>B(null),onConfirm:A?.onConfirm,title:A?.title||"Confirm",message:A?.message,variant:"danger"})]})}},69691:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(35062).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/10Router/10Router/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/10Router/10Router/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.tsx","default")},72908:(a,b,c)=>{Promise.resolve().then(c.bind(c,41296))},86060:(a,b,c)=>{Promise.resolve().then(c.bind(c,69691))},92592:(a,b,c)=>{"use strict";c.d(b,{D:()=>e});var d=c(94621);async function e(){return await (0,d.Xj)()}},94621:(a,b,c)=>{"use strict";c.d(b,{Xj:()=>q});var d=c(78356),e=c(73024),f=c.n(e),g=c(76760),h=c.n(g),i=c(77598),j=c.n(i),k=c(51336);let l=h().join(k.n,"machine-id"),m=h().join(k.n,"auth"),n=h().join(m,"cli-secret"),o=null,p=null;async function q(a=null){let b=a||process.env.MACHINE_ID_SALT||"endpoint-proxy-salt",c=function(){if(o)return o;try{if(o=f().readFileSync(l,"utf8").trim())return o}catch{}try{o=(0,d.machineIdSync)()}catch{o=j().randomUUID()}try{f().mkdirSync(k.n,{recursive:!0}),f().writeFileSync(l,o,{mode:384})}catch{}return o}(),e="10r-cli-auth"===b?function(){if(p)return p;try{if(p=f().readFileSync(n,"utf8").trim())return p}catch{}p=j().randomBytes(32).toString("hex");try{f().mkdirSync(m,{recursive:!0}),f().writeFileSync(n,p,{mode:384})}catch{}return p}():"";return j().createHash("sha256").update(c+b+e).digest("hex").substring(0,16)}}};
|
|
1
|
+
exports.id=7348,exports.ids=[7348],exports.modules={18142:(a,b,c)=>{"use strict";c.d(b,{YW:()=>d.Page,pV:()=>d.CardGrid,wn:()=>d.Section,zY:()=>d.PageHeader}),c(73865),c(55204);var d=c(19509)},20482:(a,b,c)=>{"use strict";c.d(b,{CK:()=>i.default,G9:()=>l.default,Iz:()=>r.default,KX:()=>s.PanelSkeleton,LF:()=>f.default,LH:()=>m.default,Mu:()=>s.StatCardSkeleton,Nf:()=>j.default,Qv:()=>e.CardSkeleton,YW:()=>u.YW,gw:()=>q.default,jK:()=>k.default,nh:()=>t.default,pV:()=>u.pV,rq:()=>g.default,uR:()=>h.default,uo:()=>d.ConfirmModal,vE:()=>n.default,vj:()=>o.default,wI:()=>p.default,wn:()=>u.wn,zY:()=>u.zY}),c(28907);var d=c(87121),e=c(53546);c(62648),c(77562),c(79517),c(66453);var f=c(71e3),g=c(16582),h=c(94725),i=c(98279),j=c(22354),k=c(23165);c(49451),c(82466),c(70047),c(32328),c(92249);var l=c(85405),m=c(91236),n=c(89630),o=c(87556),p=c(46009);c(54928);var q=c(5409),r=c(12710);c(92393),c(51);var s=c(11442),t=c(9656),u=c(18142)},41296:(a,b,c)=>{"use strict";c.d(b,{default:()=>r});var d=c(86240),e=c(70433),f=c(4271),g=c(63265),h=c(81501),i=c(67209),j=c(31952),k=c(28907),l=c(20482),m=c(57145);function n({label:a,url:b,copyId:c,copied:e,onCopy:f,badge:i,actions:l}){return(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`shrink-0 rounded px-1.5 py-0.5 text-center font-mono text-xs min-w-[88px] ${"CF"===i||"TS"===i?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"}`,children:a}),(0,d.jsx)(h.p,{value:b,readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,d.jsxs)(j.m_,{children:[(0,d.jsx)(j.k$,{asChild:!0,children:(0,d.jsx)("span",{className:"relative inline-flex",children:(0,d.jsx)(g.$,{variant:"ghost",size:"icon-sm",onClick:()=>f(b,c),children:(0,d.jsx)(k.default,{name:e===c?"check":"content_copy",className:"text-[18px]"})})})}),(0,d.jsx)(j.ZI,{side:"top",children:e===c?"Copied!":"Copy"})]}),l]})}var o=c(58503),p=c(70369);function q({message:a,action:b}){return(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-amber-500/10 border border-amber-500/20 text-amber-700 dark:text-amber-400",children:[(0,d.jsx)(k.default,{name:"warning",className:"text-[16px] shrink-0 mt-0.5"}),(0,d.jsx)("p",{className:"text-xs flex-1",children:a}),b&&(0,d.jsx)("a",{href:b.href,className:"text-xs font-medium underline shrink-0 hover:opacity-80",onClick:b.href.startsWith("#")?a=>{a.preventDefault(),document.getElementById(b.href.slice(1))?.scrollIntoView({behavior:"smooth"})}:void 0,children:b.label})]})}function r({machineId:a}){let[b,c]=(0,e.useState)([]),[s,t]=(0,e.useState)(!0),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(""),[y,z]=(0,e.useState)(null),[A,B]=(0,e.useState)(null),[C,D]=(0,e.useState)(!1),[E,F]=(0,e.useState)(new Set),[G,H]=(0,e.useState)(!1),{copied:I,copy:J}=(0,m.C)(),K=async a=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireApiKey:a})})).ok&&D(a)}catch(a){console.log("Error updating requireApiKey:",a)}},L=async()=>{try{let a=async()=>{let a=await fetch("/api/keys");return a.ok&&(await a.json()).keys||[]},b=await a();if(0===b.length)try{(await fetch("/api/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"Default Key"})})).ok&&(b=await a())}catch{}c(b)}catch(a){console.log("Error fetching data:",a)}finally{t(!1)}},M=async()=>{if(w.trim())try{let a=await fetch("/api/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:w})}),b=await a.json();a.ok&&(z(b.key),await L(),x(""),v(!1))}catch(a){console.log("Error creating key:",a)}},N=async a=>{B({title:"Delete API Key",message:"Delete this API key?",onConfirm:async()=>{B(null);try{(await fetch(`/api/keys/${a}`,{method:"DELETE"})).ok&&(c(b.filter(b=>b.id!==a)),F(b=>{let c=new Set(b);return c.delete(a),c}))}catch(a){console.log("Error deleting key:",a)}}})},[O,P]=(0,e.useState)("/v1");return s?(0,d.jsxs)(l.YW,{children:[(0,d.jsx)(l.KX,{}),(0,d.jsx)(l.KX,{})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(l.YW,{children:[(0,d.jsxs)(f.Zp,{children:[(0,d.jsx)(f.aR,{children:(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"p-2 rounded-[10px] bg-background text-muted-foreground",children:(0,d.jsx)(k.default,{name:"api",className:"text-[20px]"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)(f.ZB,{children:"API Endpoint"}),(0,d.jsx)(f.BT,{children:"Local and remote access URLs"})]})]})}),(0,d.jsx)(f.Wu,{children:(0,d.jsx)("div",{className:"flex flex-col gap-2",children:(0,d.jsx)(n,{label:"Local",url:O,copyId:"local_url",copied:I,onCopy:J})})})]}),(0,d.jsxs)(f.Zp,{id:"require-api-key",children:[(0,d.jsxs)(f.aR,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"p-2 rounded-[10px] bg-background text-muted-foreground",children:(0,d.jsx)(k.default,{name:"vpn_key",className:"text-[20px]"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)(f.ZB,{children:"API Keys"}),(0,d.jsx)(f.BT,{children:"Keys for authenticating gateway requests"})]})]}),(0,d.jsx)(f.X9,{children:(0,d.jsxs)(g.$,{onClick:()=>v(!0),children:[(0,d.jsx)(k.default,{name:"add"}),"Create Key"]})})]}),(0,d.jsxs)(f.Wu,{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between pb-4 mb-4 border-b border-border",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium",children:"Require API key"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:"Requests without a valid key will be rejected"})]}),(0,d.jsx)(p.d,{checked:C,onCheckedChange:()=>K(!C)})]}),G&&!C&&(0,d.jsx)("div",{className:"mb-4 -mt-2",children:(0,d.jsx)(q,{message:"Endpoint is exposed without an API key."})}),0===b.length?(0,d.jsxs)("div",{className:"text-center py-12",children:[(0,d.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,d.jsx)(k.default,{name:"vpn_key",className:"text-[32px]"})}),(0,d.jsx)("p",{className:"text-foreground font-medium mb-1",children:"No API keys yet"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Create your first API key to get started"}),(0,d.jsxs)(g.$,{onClick:()=>v(!0),children:[(0,d.jsx)(k.default,{name:"add"}),"Create Key"]})]}):(0,d.jsx)("div",{className:"flex flex-col",children:b.map(a=>{var b;return(0,d.jsxs)("div",{className:`group flex items-center justify-between py-3 border-b border-black/[0.03] dark:border-white/[0.03] last:border-b-0 ${!1===a.isActive?"opacity-60":""}`,children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:a.name}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,d.jsx)("code",{className:"text-xs text-muted-foreground font-mono",children:E.has(a.id)?a.key:(b=a.key)&&!(b.length<=10)?b.slice(0,6)+"•".repeat(b.length-10)+b.slice(-4):b||""}),(0,d.jsxs)(j.m_,{children:[(0,d.jsx)(j.k$,{asChild:!0,children:(0,d.jsx)("span",{className:"relative inline-flex",children:(0,d.jsx)(g.$,{variant:"ghost",size:"icon-xs",onClick:()=>{var b;return b=a.id,void F(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},children:(0,d.jsx)(k.default,{name:E.has(a.id)?"visibility_off":"visibility",className:"text-[14px]"})})})}),(0,d.jsx)(j.ZI,{side:"top",children:E.has(a.id)?"Hide key":"Show key"})]}),(0,d.jsxs)(j.m_,{children:[(0,d.jsx)(j.k$,{asChild:!0,children:(0,d.jsx)("span",{className:"relative inline-flex",children:(0,d.jsx)(g.$,{variant:"ghost",size:"icon-xs",onClick:()=>J(a.key,a.id),children:(0,d.jsx)(k.default,{name:I===a.id?"check":"content_copy",className:"text-[14px]"})})})}),(0,d.jsx)(j.ZI,{side:"top",children:I===a.id?"Copied!":"Copy"})]})]}),(0,d.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:["Created ",new Date(a.createdAt).toLocaleDateString()]}),!1===a.isActive&&(0,d.jsx)("p",{className:"text-xs text-orange-500 mt-1",children:"Paused"})]}),(0,d.jsx)("div",{className:"flex items-center gap-2",children:(0,d.jsx)(g.$,{variant:"ghost",size:"icon-sm",onClick:()=>N(a.id),className:"text-red-500 opacity-100 hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",children:(0,d.jsx)(k.default,{name:"delete",className:"text-[18px]"})})})]},a.id)})})]})]})]}),(0,d.jsx)(i.lG,{open:u,onOpenChange:a=>{a||(v(!1),x(""))},children:(0,d.jsxs)(i.Cf,{className:"max-w-md",children:[(0,d.jsx)(i.c7,{children:(0,d.jsx)(i.L3,{children:"Create API Key"})}),(0,d.jsx)("div",{className:"max-h-[calc(85vh-100px)] overflow-y-auto p-4",children:(0,d.jsx)("div",{className:"flex flex-col gap-4",children:(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,d.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Key Name"}),(0,d.jsx)(h.p,{value:w,onChange:a=>x(a.target.value),placeholder:"Production Key"})]})})}),(0,d.jsx)(i.Es,{children:(0,d.jsx)("div",{className:"flex w-full gap-2 sm:w-auto",children:(0,d.jsx)(g.$,{onClick:M,className:"w-full sm:w-auto",disabled:!w.trim(),children:"Create"})})})]})}),(0,d.jsx)(i.lG,{open:!!y,onOpenChange:a=>!a&&z(null),children:(0,d.jsxs)(i.Cf,{className:"max-w-md",children:[(0,d.jsx)(i.c7,{children:(0,d.jsx)(i.L3,{children:"API Key Created"})}),(0,d.jsx)("div",{className:"max-h-[calc(85vh-100px)] overflow-y-auto p-4",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(o.Fc,{children:(0,d.jsxs)(o.TN,{children:[(0,d.jsx)("span",{className:"font-medium",children:"Save this key now! "}),"This is the only time you will see this key. Store it securely."]})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.p,{value:y||"",readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,d.jsxs)(g.$,{variant:"secondary",onClick:()=>J(y,"created_key"),children:[(0,d.jsx)(k.default,{name:"created_key"===I?"check":"content_copy"}),"created_key"===I?"Copied!":"Copy"]})]})]})}),(0,d.jsx)(i.Es,{children:(0,d.jsx)(g.$,{onClick:()=>z(null),className:"w-full sm:w-auto",children:"Done"})})]})}),(0,d.jsx)(l.uo,{isOpen:!!A,onClose:()=>B(null),onConfirm:A?.onConfirm,title:A?.title||"Confirm",message:A?.message,variant:"danger"})]})}},69691:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(35062).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/10Router/10Router/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/10Router/10Router/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.tsx","default")},72908:(a,b,c)=>{Promise.resolve().then(c.bind(c,41296))},86060:(a,b,c)=>{Promise.resolve().then(c.bind(c,69691))},92592:(a,b,c)=>{"use strict";c.d(b,{D:()=>e});var d=c(94621);async function e(){return await (0,d.Xj)()}},94621:(a,b,c)=>{"use strict";c.d(b,{Xj:()=>q});var d=c(78356),e=c(73024),f=c.n(e),g=c(76760),h=c.n(g),i=c(77598),j=c.n(i),k=c(51336);let l=h().join(k.n,"machine-id"),m=h().join(k.n,"auth"),n=h().join(m,"cli-secret"),o=null,p=null;async function q(a=null){let b=a||process.env.MACHINE_ID_SALT||"endpoint-proxy-salt",c=function(){if(o)return o;try{if(o=f().readFileSync(l,"utf8").trim())return o}catch{}try{o=(0,d.machineIdSync)()}catch{o=j().randomUUID()}try{f().mkdirSync(k.n,{recursive:!0}),f().writeFileSync(l,o,{mode:384})}catch{}return o}(),e="10r-cli-auth"===b?function(){if(p)return p;try{if(p=f().readFileSync(n,"utf8").trim())return p}catch{}p=j().randomBytes(32).toString("hex");try{f().mkdirSync(m,{recursive:!0}),f().writeFileSync(n,p,{mode:384})}catch{}return p}():"";return j().createHash("sha256").update(c+b+e).digest("hex").substring(0,16)}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.id=7504,exports.ids=[7504],exports.modules={7504:(a,b,c)=>{c.d(b,{PROVIDER_PRICING:()=>e,ad:()=>i,calculateCostFromTokens:()=>j,gH:()=>g,getPricingForModel:()=>h});let d={"claude-opus-4-6":{input:5,output:25,cached:.5,reasoning:25,cache_creation:6.25},"claude-opus-4-5-20251101":{input:5,output:25,cached:.5,reasoning:25,cache_creation:6.25},"claude-sonnet-4-6":{input:3,output:15,cached:.3,reasoning:15,cache_creation:3.75},"claude-sonnet-4-5-20250929":{input:3,output:15,cached:.3,reasoning:15,cache_creation:3.75},"claude-haiku-4-5-20251001":{input:1,output:5,cached:.1,reasoning:5,cache_creation:1.25},"claude-sonnet-4-20250514":{input:3,output:15,cached:1.5,reasoning:15,cache_creation:3},"claude-opus-4-20250514":{input:15,output:25,cached:7.5,reasoning:112.5,cache_creation:15},"claude-3-5-sonnet-20241022":{input:3,output:15,cached:1.5,reasoning:15,cache_creation:3},"claude-haiku-4.5":{input:.5,output:2.5,cached:.05,reasoning:3.75,cache_creation:.5},"claude-opus-4.1":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"claude-opus-4.5":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"claude-opus-4.6":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"claude-sonnet-4":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-sonnet-4.5":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-sonnet-4.6":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-opus-4-5-thinking":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"claude-opus-4-6-thinking":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"claude-fable-5":{input:10,output:50,cached:1,reasoning:50,cache_creation:12.5},"gpt-3.5-turbo":{input:.5,output:1.5,cached:.25,reasoning:2.25,cache_creation:.5},"gpt-4":{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5},"gpt-4-turbo":{input:10,output:30,cached:5,reasoning:45,cache_creation:10},"gpt-4o":{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5},"gpt-4o-mini":{input:.15,output:.6,cached:.075,reasoning:.9,cache_creation:.15},"gpt-4.1":{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5},"gpt-5":{input:1.25,output:10,cached:.625,reasoning:10,cache_creation:1.25},"gpt-5-mini":{input:.25,output:2,cached:.125,reasoning:2,cache_creation:.25},"gpt-5-codex":{input:1.25,output:10,cached:.625,reasoning:10,cache_creation:1.25},"gpt-5.1":{input:1.25,output:10,cached:.625,reasoning:10,cache_creation:1.25},"gpt-5.1-codex":{input:1.25,output:10,cached:.625,reasoning:10,cache_creation:1.25},"gpt-5.1-codex-mini":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5},"gpt-5.1-codex-mini-high":{input:2,output:8,cached:1,reasoning:12,cache_creation:2},"gpt-5.1-codex-max":{input:8,output:32,cached:4,reasoning:48,cache_creation:8},"gpt-5.2":{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75},"gpt-5.2-codex":{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75},"gpt-5.3-codex":{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75},"gpt-5.3-codex-spark":{input:3,output:12,cached:.3,reasoning:12,cache_creation:3},"gpt-5.6":{input:2.5,output:15,cached:.25,reasoning:15,cache_creation:2.5},"gpt-5.6-luna":{input:1,output:6,cached:.1,reasoning:6,cache_creation:1},"gpt-5.6-terra":{input:2.5,output:15,cached:.25,reasoning:15,cache_creation:2.5},"gpt-5.6-sol":{input:5,output:30,cached:.5,reasoning:30,cache_creation:5},"gpt-6-astra":{input:5,output:30,cached:.5,reasoning:30,cache_creation:5},o1:{input:15,output:60,cached:7.5,reasoning:90,cache_creation:15},"o1-mini":{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3},"gemini-3.8-flash":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.8-flash-high":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.8-flash-medium":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.8-flash-low":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.7-flash":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.7-flash-high":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.7-flash-medium":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.7-flash-low":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.6-flash":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.6-flash-high":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.6-flash-medium":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.6-flash-low":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.5-flash-lite":{input:.3,output:2.5,cached:.03,reasoning:3.75,cache_creation:.375},"gemini-3.5-flash-high":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-3-flash-preview":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-3-pro-preview":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-3.1-pro-low":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-3.1-pro-high":{input:4,output:18,cached:.5,reasoning:27,cache_creation:4},"gemini-pro-agent":{input:4,output:18,cached:.5,reasoning:27,cache_creation:4},"gemini-3-flash-agent":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-3.5-flash-low":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-3.5-flash-extra-low":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-3-flash":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-2.5-pro":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-2.5-flash":{input:.3,output:2.5,cached:.03,reasoning:3.75,cache_creation:.3},"gemini-2.5-flash-lite":{input:.15,output:1.25,cached:.015,reasoning:1.875,cache_creation:.15},"qwen3-coder-plus":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"qwen3-coder-flash":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"kimi-k3":{input:3,output:15,cached:.3,reasoning:15,cache_creation:3},k3:{input:3,output:15,cached:.3,reasoning:15,cache_creation:3},"kimi-k2.7-code":{input:.95,output:4,cached:.19,reasoning:4,cache_creation:.95},"kimi-k2.7-code-highspeed":{input:1.9,output:8,cached:.38,reasoning:8,cache_creation:1.9},"kimi-for-coding":{input:.95,output:4,cached:.19,reasoning:4,cache_creation:.95},"kimi-for-coding-highspeed":{input:1.9,output:8,cached:.38,reasoning:8,cache_creation:1.9},"kimi-k2":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"kimi-k2-thinking":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5},"kimi-k2.5":{input:1.2,output:4.8,cached:.6,reasoning:7.2,cache_creation:1.2},"kimi-k2.5-thinking":{input:1.8,output:7.2,cached:.9,reasoning:10.8,cache_creation:1.8},"kimi-k2.6":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"kimi-latest":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"deepseek-chat":{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14},"deepseek-reasoner":{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14},"deepseek-r1":{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14},"deepseek-v3.2-chat":{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14},"deepseek-v3.2-reasoner":{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14},"deepseek-v4-flash":{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14},"deepseek-v4.1-flash":{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14},"deepseek-flash":{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14},"deepseek-v4-pro":{input:.435,output:.87,cached:.003625,reasoning:.87,cache_creation:.435},"glm-4.6":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"glm-4.6v":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"glm-4.7":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"glm-5":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"MiniMax-M3":{input:.3,output:1.2,cached:.06,reasoning:1.8,cache_creation:.3},"MiniMax-M2.1":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"MiniMax-M2.5":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"MiniMax-M2.7":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"minimax-m2.1":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"minimax-m2.5":{input:.6,output:2.4,cached:.3,reasoning:3.6,cache_creation:.6},"grok-code-fast-1":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},auto:{input:2,output:8,cached:1,reasoning:12,cache_creation:2},"oswe-vscode-prime":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"gpt-oss-120b-medium":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"vision-model":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5},"coder-model":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5}},e={gh:{"gpt-5.3-codex":{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75}},tokenrouter:{"MiniMax-M3":{input:.3,output:1.2,cached:.06,reasoning:1.2},"anthropic/claude-fable-5":{input:10,output:50,cached:1,cache_creation:12.5,reasoning:50},"anthropic/claude-haiku-4.5":{input:1,output:5,cached:.1,cache_creation:1.25,reasoning:5},"anthropic/claude-opus-4.5":{input:5,output:25,cached:.5,cache_creation:6.25,reasoning:25},"anthropic/claude-opus-4.6":{input:5,output:25,cached:.5,cache_creation:6.25,reasoning:25},"anthropic/claude-opus-4.7":{input:5,output:25,cached:.5,cache_creation:6.25,reasoning:25},"anthropic/claude-opus-4.7-fast":{input:30,output:150,cached:3,reasoning:150},"anthropic/claude-opus-4.8":{input:5,output:25,cached:.5,cache_creation:6.25,reasoning:25},"anthropic/claude-opus-4.8-fast":{input:10,output:50,cached:1,cache_creation:12.5,reasoning:50},"anthropic/claude-opus-5":{input:5,output:25,cached:.5,cache_creation:6.25,reasoning:25},"anthropic/claude-opus-5-fast":{input:10,output:50,cached:1,cache_creation:12.5,reasoning:50},"anthropic/claude-sonnet-4":{input:3,output:15,cached:.3,cache_creation:3.75,reasoning:15},"anthropic/claude-sonnet-4.5":{input:3,output:15,cached:.3,cache_creation:3.75,reasoning:15},"anthropic/claude-sonnet-4.6":{input:3,output:15,cached:.3,cache_creation:3.75,reasoning:15},"anthropic/claude-sonnet-5":{input:2,output:10,cached:.2,reasoning:10},"claude-opus-4-8-m-aws":{input:5,output:25,cached:.5,cache_creation:6.25,reasoning:25},"deepseek/deepseek-v3.2":{input:.26,output:.38,cached:.13,reasoning:.38},"deepseek/deepseek-v4-flash":{input:.14,output:.28,cached:.0028,reasoning:.28},"deepseek/deepseek-v4-flash-0731":{input:.14,output:.28,cached:.0028,reasoning:.28},"deepseek/deepseek-v4-pro":{input:.435,output:.87,cached:.003625,reasoning:.87},"ex/gpt-5.4":{input:2.5,output:15,cached:.25,reasoning:15},"google/gemini-2.5-flash-image":{input:.3,output:2.5,reasoning:2.5},"google/gemini-3-flash-preview":{input:.5,output:3,cached:.05,cache_creation:.08333,reasoning:3},"google/gemini-3-pro-image-preview":{input:2,output:12,reasoning:12},"google/gemini-3.1-flash-image-preview":{input:.5,output:3,reasoning:3},"google/gemini-3.1-flash-lite-image":{input:.25,output:1.5,reasoning:1.5},"google/gemini-3.1-pro-preview":{input:2,output:12,cached:.2,cache_creation:.375,reasoning:12},"google/gemini-3.5-flash":{input:1.5,output:9,cached:.15,cache_creation:.08333,reasoning:9},"google/gemini-3.5-flash-lite":{input:.3,output:2.5,cached:.03,cache_creation:.08333,reasoning:2.5},"google/gemini-3.6-flash":{input:1.5,output:7.5,cached:.15,cache_creation:.08333,reasoning:7.5},"google/gemini-embedding-2":{input:1,output:6,cached:.1,reasoning:6},"google/gemma-4-26b-a4b-it":{input:.06,output:.33,reasoning:.33},"kling-3.0-turbo":{input:2.1,output:2.1,reasoning:2.1},"microsoft/mai-image-2.5":{input:5,output:47,reasoning:47},"minimax/minimax-m2-her":{input:.3,output:1.2,cached:.03,reasoning:1.2},"minimax/minimax-m2.1":{input:.3,output:1.2,cached:.03,reasoning:1.2},"minimax/minimax-m2.1-highspeed":{input:.6,output:2.4,cached:.06,reasoning:2.4},"minimax/minimax-m2.5":{input:.3,output:1.2,cached:.03,reasoning:1.2},"minimax/minimax-m2.7":{input:.3,output:1.2,cached:.06,reasoning:1.2},"minimax/minimax-m2.7-highspeed":{input:.6,output:2.4,cached:.06,reasoning:2.4},"miromind/mirothinker-1-7-deepresearch":{input:4,output:25,reasoning:25},"miromind/mirothinker-1-7-deepresearch-mini":{input:1.25,output:10,reasoning:10},"mistralai/devstral-2512":{input:.4,output:2,cached:.04,reasoning:2},"mistralai/mistral-medium-3-5":{input:1.5,output:7.5,reasoning:7.5},"mistralai/mistral-small-2603":{input:.15,output:.6,cached:.015,reasoning:.6},"mistralai/voxtral-small-24b-2507":{input:.1,output:.3,cached:.01,reasoning:.3},"moonshotai/kimi-k2.5":{input:.6,output:3,cached:.1,reasoning:3},"moonshotai/kimi-k2.6":{input:.95,output:4,cached:.16,reasoning:4},"moonshotai/kimi-k2.7-code":{input:.9286,output:3.8571,cached:.1857,reasoning:3.8571},"moonshotai/kimi-k3":{input:3,output:15,cached:.3,reasoning:15},"nvidia/nemotron-3-super-120b-a12b":{input:.3,output:.9,cached:.1,reasoning:.9},"openai/gpt-4o-mini":{input:.15,output:.6,cached:.075,reasoning:.6},"openai/gpt-5":{input:1.25,output:10,cached:.125,reasoning:10},"openai/gpt-5-image":{input:10,output:40,cached:2.5,reasoning:40},"openai/gpt-5-image-mini":{input:2.5,output:8,cached:.25,reasoning:8},"openai/gpt-5-mini":{input:.25,output:2,cached:.025,reasoning:2},"openai/gpt-5.2":{input:1.75,output:14,cached:.175,reasoning:14},"openai/gpt-5.3-codex":{input:1.75,output:14,cached:.175,reasoning:14},"openai/gpt-5.4":{input:2.5,output:15,cached:.25,reasoning:15},"openai/gpt-5.4-image-2":{input:8,output:30,cached:2,reasoning:30},"openai/gpt-5.4-mini":{input:.75,output:4.5,cached:.075,reasoning:4.5},"openai/gpt-5.4-nano":{input:.2,output:1.25,cached:.02,reasoning:1.25},"openai/gpt-5.4-pro":{input:30,output:180,reasoning:180},"openai/gpt-5.5":{input:5,output:30,cached:.5,reasoning:30},"openai/gpt-5.5-pro":{input:30,output:180,reasoning:180},"openai/gpt-5.6-luna":{input:.2,output:1.2,cached:.02,cache_creation:.25,reasoning:1.2},"openai/gpt-5.6-sol":{input:5,output:30,cached:.5,cache_creation:6.25,reasoning:30},"openai/gpt-5.6-terra":{input:2,output:12,cached:.2,cache_creation:2.5,reasoning:12},"openai/gpt-audio":{input:2.5,output:10,reasoning:10},"openai/gpt-audio-mini":{input:.6,output:2.4,reasoning:2.4},"openai/gpt-oss-120b":{input:.039,output:.18,reasoning:.18},"qwen/qwen3-coder-next":{input:.12,output:.75,cached:.06,reasoning:.75},"qwen/qwen3.5-122b-a10b":{input:.26,output:2.08,reasoning:2.08},"qwen/qwen3.5-35b-a3b":{input:.1625,output:1.3,reasoning:1.3},"qwen/qwen3.5-397b-a17b":{input:.39,output:2.34,reasoning:2.34},"qwen/qwen3.5-9b":{input:.1,output:.15,reasoning:.15},"qwen/qwen3.5-flash":{input:.1048,output:.4194,reasoning:.4194},"qwen/qwen3.5-plus-02-15":{input:.26,output:1.56,reasoning:1.56},"qwen/qwen3.6-plus":{input:.54,output:3.21,reasoning:3.21},"qwen/qwen3.7-max":{input:1.25,output:3.75,cached:.25,reasoning:3.75},"qwen/qwen3.7-plus":{input:.4,output:1.6,cached:.08,reasoning:1.6},"qwen/qwen3.8-max":{input:2,output:6,cached:.25,cache_creation:2.5,reasoning:6},"qwen3.5-omni-plus":{input:1,output:5.7143,reasoning:5.7143},"qwen3.6-flash":{input:.171,output:1.029,cached:.017,cache_creation:.214,reasoning:1.029},"sakana/fugu-ultra":{input:5,output:30,cached:.5,reasoning:30},"seed-2-0-code-preview-260328":{input:1,output:6,cached:.2,cache_creation:.008333,reasoning:6},"seed-2-0-lite-260428":{input:.5,output:4,cached:.1,cache_creation:.008333,reasoning:4},"seed-2-0-mini-260428":{input:.2,output:.8,cached:.04,cache_creation:.00833,reasoning:.8},"seed-2-0-pro-260328":{input:1,output:6,cached:.2,cache_creation:.008333,reasoning:6},"stepfun/step-3.5-flash":{input:.1,output:.3,cached:.02,reasoning:.3},"stepfun/step-3.7-flash":{input:.2,output:1.15,cached:.04,reasoning:1.15},"tencent/hy3-preview":{input:.066,output:.26,cached:.029,reasoning:.26},"x-ai/grok-4.1-fast":{input:.2,output:.5,cached:.05,reasoning:.5},"x-ai/grok-4.20-beta":{input:2,output:6,cached:.2,reasoning:6},"x-ai/grok-4.3":{input:1.25,output:2.5,cached:.2,reasoning:2.5},"x-ai/grok-4.5":{input:2,output:6,cached:.5,reasoning:6},"x-ai/grok-build-0.1":{input:1,output:2,cached:.2,reasoning:2},"xiaomi/mimo-v2-flash":{input:.1,output:.3,cached:.01,reasoning:.3},"xiaomi/mimo-v2-omni":{input:.4,output:2,cached:.08,reasoning:2},"xiaomi/mimo-v2-pro":{input:1,output:3,cached:.2,reasoning:3},"xiaomi/mimo-v2.5":{input:.4,output:2,cached:.08,reasoning:2},"xiaomi/mimo-v2.5-pro":{input:1,output:3,cached:.2,reasoning:3},"z-ai/glm-4.5-air":{input:.13,output:.85,cached:.025,reasoning:.85},"z-ai/glm-4.6":{input:.6,output:2.2,cached:.11,reasoning:2.2},"z-ai/glm-4.6v":{input:.3,output:.9,reasoning:.9},"z-ai/glm-4.7":{input:.6,output:2.2,cached:.11,reasoning:2.2},"z-ai/glm-5":{input:1,output:3.2,cached:.2,reasoning:3.2},"z-ai/glm-5-turbo":{input:1.2,output:4,cached:.24,reasoning:4},"z-ai/glm-5.1":{input:1.05,output:3.5,cached:.525,reasoning:3.5},"z-ai/glm-5.2":{input:1.4,output:4.4,cached:.26,reasoning:4.4},"z-ai/glm-5.3-free":{input:0,output:0,cached:0,reasoning:0}}},f=[{pattern:"*-codex-xhigh",pricing:{input:10,output:40,cached:5,reasoning:60,cache_creation:10}},{pattern:"*-codex-high",pricing:{input:8,output:32,cached:4,reasoning:48,cache_creation:8}},{pattern:"*-codex-max",pricing:{input:8,output:32,cached:4,reasoning:48,cache_creation:8}},{pattern:"*-codex-mini-*",pricing:{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5}},{pattern:"*-codex-mini",pricing:{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5}},{pattern:"*-codex-low",pricing:{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75}},{pattern:"*-codex-none",pricing:{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75}},{pattern:"*-codex-spark",pricing:{input:3,output:12,cached:.3,reasoning:12,cache_creation:3}},{pattern:"codex-*",pricing:{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75}},{pattern:"*-codex",pricing:{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75}},{pattern:"claude-opus-*",pricing:{input:5,output:25,cached:.5,reasoning:25,cache_creation:6.25}},{pattern:"claude-sonnet-*",pricing:{input:3,output:15,cached:.3,reasoning:15,cache_creation:3.75}},{pattern:"claude-haiku-*",pricing:{input:1,output:5,cached:.1,reasoning:5,cache_creation:1.25}},{pattern:"claude-*",pricing:{input:3,output:15,cached:.3,reasoning:15,cache_creation:3.75}},{pattern:"gemini-*-flash-lite",pricing:{input:.15,output:1.25,cached:.015,reasoning:1.875,cache_creation:.15}},{pattern:"gemini-*-flash",pricing:{input:.3,output:2.5,cached:.03,reasoning:3.75,cache_creation:.3}},{pattern:"gemini-*-pro",pricing:{input:2,output:12,cached:.25,reasoning:18,cache_creation:2}},{pattern:"gemini-3-*",pricing:{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5}},{pattern:"gemini-2.5-*",pricing:{input:.3,output:2.5,cached:.03,reasoning:3.75,cache_creation:.3}},{pattern:"gemini-*",pricing:{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5}},{pattern:"gpt-5.6-*",pricing:{input:2.5,output:15,cached:.25,reasoning:15,cache_creation:2.5}},{pattern:"gpt-5.3-*",pricing:{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75}},{pattern:"gpt-5.2-*",pricing:{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75}},{pattern:"gpt-5.1-*",pricing:{input:1.25,output:10,cached:.625,reasoning:10,cache_creation:1.25}},{pattern:"gpt-5-*",pricing:{input:1.25,output:10,cached:.625,reasoning:10,cache_creation:1.25}},{pattern:"gpt-5*",pricing:{input:1.25,output:10,cached:.625,reasoning:10,cache_creation:1.25}},{pattern:"gpt-4o-*",pricing:{input:.15,output:.6,cached:.075,reasoning:.9,cache_creation:.15}},{pattern:"gpt-4o",pricing:{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5}},{pattern:"gpt-4*",pricing:{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5}},{pattern:"o1-*",pricing:{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3}},{pattern:"o1",pricing:{input:15,output:60,cached:7.5,reasoning:90,cache_creation:15}},{pattern:"o3-*",pricing:{input:10,output:40,cached:5,reasoning:60,cache_creation:10}},{pattern:"o4-*",pricing:{input:2,output:8,cached:1,reasoning:12,cache_creation:2}},{pattern:"qwen3-coder-*",pricing:{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},{pattern:"qwen*-coder-*",pricing:{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},{pattern:"qwen*",pricing:{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},{pattern:"kimi-*-thinking",pricing:{input:1.8,output:7.2,cached:.9,reasoning:10.8,cache_creation:1.8}},{pattern:"kimi-k3*",pricing:{input:3,output:15,cached:.3,reasoning:15,cache_creation:3}},{pattern:"kimi-k2*",pricing:{input:1.2,output:4.8,cached:.6,reasoning:7.2,cache_creation:1.2}},{pattern:"kimi-*",pricing:{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},{pattern:"deepseek-*reasoner*",pricing:{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14}},{pattern:"deepseek-r*",pricing:{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14}},{pattern:"deepseek-v*",pricing:{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14}},{pattern:"deepseek-*",pricing:{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14}},{pattern:"glm-5*",pricing:{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},{pattern:"glm-4*",pricing:{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75}},{pattern:"glm-*",pricing:{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},{pattern:"MiniMax-*",pricing:{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},{pattern:"minimax-*",pricing:{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},{pattern:"grok-code-*",pricing:{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},{pattern:"grok-*",pricing:{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}}];function g(a,b){return RegExp("^"+a.split("*").map(a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*")+"$","i").test(b)}function h(a,b){if(!b)return null;if(a&&e[a]?.[b])return e[a][b];let c=b.includes("/")?b.split("/").pop():b;if(d[c])return d[c];if(d[b])return d[b];for(let{pattern:a,pricing:d}of f)if(g(a,c)||g(a,b))return d;return null}function i(){return e}function j(a,b){if(!a||!b)return 0;let c=0,d=a.prompt_tokens||a.input_tokens||0,e=a.cached_tokens||a.cache_read_input_tokens||0,f=a.cache_creation_input_tokens||0;c+=Math.max(0,d-e-f)*(b.input/1e6),e>0&&(c+=e*((b.cached||b.input)/1e6)),c+=(a.completion_tokens||a.output_tokens||0)*(b.output/1e6);let g=a.reasoning_tokens||0;return g>0&&(c+=g*((b.reasoning||b.output)/1e6)),f>0&&(c+=f*((b.cache_creation||b.input)/1e6)),c}}};
|
|
1
|
+
"use strict";exports.id=7504,exports.ids=[7504],exports.modules={7504:(a,b,c)=>{c.d(b,{PROVIDER_PRICING:()=>e,ad:()=>j,calculateCostFromTokens:()=>k,gH:()=>h,getPricingForModel:()=>i});let d={"claude-opus-4-6":{input:5,output:25,cached:.5,reasoning:25,cache_creation:6.25},"claude-opus-4-5-20251101":{input:5,output:25,cached:.5,reasoning:25,cache_creation:6.25},"claude-sonnet-4-6":{input:3,output:15,cached:.3,reasoning:15,cache_creation:3.75},"claude-sonnet-4-5-20250929":{input:3,output:15,cached:.3,reasoning:15,cache_creation:3.75},"claude-haiku-4-5-20251001":{input:1,output:5,cached:.1,reasoning:5,cache_creation:1.25},"claude-sonnet-4-20250514":{input:3,output:15,cached:1.5,reasoning:15,cache_creation:3},"claude-opus-4-20250514":{input:15,output:25,cached:7.5,reasoning:112.5,cache_creation:15},"claude-3-5-sonnet-20241022":{input:3,output:15,cached:1.5,reasoning:15,cache_creation:3},"claude-haiku-4.5":{input:.5,output:2.5,cached:.05,reasoning:3.75,cache_creation:.5},"claude-opus-4.1":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"claude-opus-4.5":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"claude-opus-4.6":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"claude-sonnet-4":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-sonnet-4.5":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-sonnet-4.6":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-opus-4-5-thinking":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"claude-opus-4-6-thinking":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"claude-fable-5":{input:10,output:50,cached:1,reasoning:50,cache_creation:12.5},"gpt-3.5-turbo":{input:.5,output:1.5,cached:.25,reasoning:2.25,cache_creation:.5},"gpt-4":{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5},"gpt-4-turbo":{input:10,output:30,cached:5,reasoning:45,cache_creation:10},"gpt-4o":{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5},"gpt-4o-mini":{input:.15,output:.6,cached:.075,reasoning:.9,cache_creation:.15},"gpt-4.1":{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5},"gpt-5":{input:1.25,output:10,cached:.625,reasoning:10,cache_creation:1.25},"gpt-5-mini":{input:.25,output:2,cached:.125,reasoning:2,cache_creation:.25},"gpt-5-codex":{input:1.25,output:10,cached:.625,reasoning:10,cache_creation:1.25},"gpt-5.1":{input:1.25,output:10,cached:.625,reasoning:10,cache_creation:1.25},"gpt-5.1-codex":{input:1.25,output:10,cached:.625,reasoning:10,cache_creation:1.25},"gpt-5.1-codex-mini":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5},"gpt-5.1-codex-mini-high":{input:2,output:8,cached:1,reasoning:12,cache_creation:2},"gpt-5.1-codex-max":{input:8,output:32,cached:4,reasoning:48,cache_creation:8},"gpt-5.2":{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75},"gpt-5.2-codex":{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75},"gpt-5.3-codex":{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75},"gpt-5.3-codex-spark":{input:3,output:12,cached:.3,reasoning:12,cache_creation:3},"gpt-5.6":{input:2.5,output:15,cached:.25,reasoning:15,cache_creation:2.5},"gpt-5.6-luna":{input:1,output:6,cached:.1,reasoning:6,cache_creation:1},"gpt-5.6-terra":{input:2.5,output:15,cached:.25,reasoning:15,cache_creation:2.5},"gpt-5.6-sol":{input:5,output:30,cached:.5,reasoning:30,cache_creation:5},"gpt-6-astra":{input:5,output:30,cached:.5,reasoning:30,cache_creation:5},o1:{input:15,output:60,cached:7.5,reasoning:90,cache_creation:15},"o1-mini":{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3},"gemini-3.8-flash":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.8-flash-high":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.8-flash-medium":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.8-flash-low":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.7-flash":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.7-flash-high":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.7-flash-medium":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.7-flash-low":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.6-flash":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.6-flash-high":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.6-flash-medium":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.6-flash-low":{input:1.5,output:7.5,cached:.15,reasoning:11.25,cache_creation:1.875},"gemini-3.5-flash-lite":{input:.3,output:2.5,cached:.03,reasoning:3.75,cache_creation:.375},"gemini-3.5-flash-high":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-3-flash-preview":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-3-pro-preview":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-3.1-pro-low":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-3.1-pro-high":{input:4,output:18,cached:.5,reasoning:27,cache_creation:4},"gemini-pro-agent":{input:4,output:18,cached:.5,reasoning:27,cache_creation:4},"gemini-3-flash-agent":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-3.5-flash-low":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-3.5-flash-extra-low":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-3-flash":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-2.5-pro":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-2.5-flash":{input:.3,output:2.5,cached:.03,reasoning:3.75,cache_creation:.3},"gemini-2.5-flash-lite":{input:.15,output:1.25,cached:.015,reasoning:1.875,cache_creation:.15},"qwen3-coder-plus":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"qwen3-coder-flash":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"kimi-k3":{input:3,output:15,cached:.3,reasoning:15,cache_creation:3},k3:{input:3,output:15,cached:.3,reasoning:15,cache_creation:3},"kimi-k2.7-code":{input:.95,output:4,cached:.19,reasoning:4,cache_creation:.95},"kimi-k2.7-code-highspeed":{input:1.9,output:8,cached:.38,reasoning:8,cache_creation:1.9},"kimi-for-coding":{input:.95,output:4,cached:.19,reasoning:4,cache_creation:.95},"kimi-for-coding-highspeed":{input:1.9,output:8,cached:.38,reasoning:8,cache_creation:1.9},"kimi-k2":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"kimi-k2-thinking":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5},"kimi-k2.5":{input:1.2,output:4.8,cached:.6,reasoning:7.2,cache_creation:1.2},"kimi-k2.5-thinking":{input:1.8,output:7.2,cached:.9,reasoning:10.8,cache_creation:1.8},"kimi-k2.6":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"kimi-latest":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"deepseek-chat":{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14},"deepseek-reasoner":{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14},"deepseek-r1":{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14},"deepseek-v3.2-chat":{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14},"deepseek-v3.2-reasoner":{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14},"deepseek-v4-flash":{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14},"deepseek-v4.1-flash":{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14},"deepseek-flash":{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14},"deepseek-v4-pro":{input:.435,output:.87,cached:.003625,reasoning:.87,cache_creation:.435},"glm-4.6":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"glm-4.6v":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"glm-4.7":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"glm-5":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"MiniMax-M3":{input:.3,output:1.2,cached:.06,reasoning:1.8,cache_creation:.3},"MiniMax-M2.1":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"MiniMax-M2.5":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"MiniMax-M2.7":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"minimax-m2.1":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"minimax-m2.5":{input:.6,output:2.4,cached:.3,reasoning:3.6,cache_creation:.6},"grok-code-fast-1":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},auto:{input:2,output:8,cached:1,reasoning:12,cache_creation:2},"oswe-vscode-prime":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"gpt-oss-120b-medium":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"vision-model":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5},"coder-model":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5}},e={gh:{"gpt-5.3-codex":{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75}},tokenrouter:{"MiniMax-M3":{input:.3,output:1.2,cached:.06,reasoning:1.2},"anthropic/claude-fable-5":{input:10,output:50,cached:1,cache_creation:12.5,reasoning:50},"anthropic/claude-haiku-4.5":{input:1,output:5,cached:.1,cache_creation:1.25,reasoning:5},"anthropic/claude-opus-4.5":{input:5,output:25,cached:.5,cache_creation:6.25,reasoning:25},"anthropic/claude-opus-4.6":{input:5,output:25,cached:.5,cache_creation:6.25,reasoning:25},"anthropic/claude-opus-4.7":{input:5,output:25,cached:.5,cache_creation:6.25,reasoning:25},"anthropic/claude-opus-4.7-fast":{input:30,output:150,cached:3,reasoning:150},"anthropic/claude-opus-4.8":{input:5,output:25,cached:.5,cache_creation:6.25,reasoning:25},"anthropic/claude-opus-4.8-fast":{input:10,output:50,cached:1,cache_creation:12.5,reasoning:50},"anthropic/claude-opus-5":{input:5,output:25,cached:.5,cache_creation:6.25,reasoning:25},"anthropic/claude-opus-5-fast":{input:10,output:50,cached:1,cache_creation:12.5,reasoning:50},"anthropic/claude-sonnet-4":{input:3,output:15,cached:.3,cache_creation:3.75,reasoning:15},"anthropic/claude-sonnet-4.5":{input:3,output:15,cached:.3,cache_creation:3.75,reasoning:15},"anthropic/claude-sonnet-4.6":{input:3,output:15,cached:.3,cache_creation:3.75,reasoning:15},"anthropic/claude-sonnet-5":{input:2,output:10,cached:.2,reasoning:10},"claude-opus-4-8-m-aws":{input:5,output:25,cached:.5,cache_creation:6.25,reasoning:25},"deepseek/deepseek-v3.2":{input:.26,output:.38,cached:.13,reasoning:.38},"deepseek/deepseek-v4-flash":{input:.14,output:.28,cached:.0028,reasoning:.28},"deepseek/deepseek-v4-flash-0731":{input:.14,output:.28,cached:.0028,reasoning:.28},"deepseek/deepseek-v4-pro":{input:.435,output:.87,cached:.003625,reasoning:.87},"ex/gpt-5.4":{input:2.5,output:15,cached:.25,reasoning:15},"google/gemini-2.5-flash-image":{input:.3,output:2.5,reasoning:2.5},"google/gemini-3-flash-preview":{input:.5,output:3,cached:.05,cache_creation:.08333,reasoning:3},"google/gemini-3-pro-image-preview":{input:2,output:12,reasoning:12},"google/gemini-3.1-flash-image-preview":{input:.5,output:3,reasoning:3},"google/gemini-3.1-flash-lite-image":{input:.25,output:1.5,reasoning:1.5},"google/gemini-3.1-pro-preview":{input:2,output:12,cached:.2,cache_creation:.375,reasoning:12},"google/gemini-3.5-flash":{input:1.5,output:9,cached:.15,cache_creation:.08333,reasoning:9},"google/gemini-3.5-flash-lite":{input:.3,output:2.5,cached:.03,cache_creation:.08333,reasoning:2.5},"google/gemini-3.6-flash":{input:1.5,output:7.5,cached:.15,cache_creation:.08333,reasoning:7.5},"google/gemini-embedding-2":{input:1,output:6,cached:.1,reasoning:6},"google/gemma-4-26b-a4b-it":{input:.06,output:.33,reasoning:.33},"kling-3.0-turbo":{input:2.1,output:2.1,reasoning:2.1},"microsoft/mai-image-2.5":{input:5,output:47,reasoning:47},"minimax/minimax-m2-her":{input:.3,output:1.2,cached:.03,reasoning:1.2},"minimax/minimax-m2.1":{input:.3,output:1.2,cached:.03,reasoning:1.2},"minimax/minimax-m2.1-highspeed":{input:.6,output:2.4,cached:.06,reasoning:2.4},"minimax/minimax-m2.5":{input:.3,output:1.2,cached:.03,reasoning:1.2},"minimax/minimax-m2.7":{input:.3,output:1.2,cached:.06,reasoning:1.2},"minimax/minimax-m2.7-highspeed":{input:.6,output:2.4,cached:.06,reasoning:2.4},"miromind/mirothinker-1-7-deepresearch":{input:4,output:25,reasoning:25},"miromind/mirothinker-1-7-deepresearch-mini":{input:1.25,output:10,reasoning:10},"mistralai/devstral-2512":{input:.4,output:2,cached:.04,reasoning:2},"mistralai/mistral-medium-3-5":{input:1.5,output:7.5,reasoning:7.5},"mistralai/mistral-small-2603":{input:.15,output:.6,cached:.015,reasoning:.6},"mistralai/voxtral-small-24b-2507":{input:.1,output:.3,cached:.01,reasoning:.3},"moonshotai/kimi-k2.5":{input:.6,output:3,cached:.1,reasoning:3},"moonshotai/kimi-k2.6":{input:.95,output:4,cached:.16,reasoning:4},"moonshotai/kimi-k2.7-code":{input:.9286,output:3.8571,cached:.1857,reasoning:3.8571},"moonshotai/kimi-k3":{input:3,output:15,cached:.3,reasoning:15},"nvidia/nemotron-3-super-120b-a12b":{input:.3,output:.9,cached:.1,reasoning:.9},"openai/gpt-4o-mini":{input:.15,output:.6,cached:.075,reasoning:.6},"openai/gpt-5":{input:1.25,output:10,cached:.125,reasoning:10},"openai/gpt-5-image":{input:10,output:40,cached:2.5,reasoning:40},"openai/gpt-5-image-mini":{input:2.5,output:8,cached:.25,reasoning:8},"openai/gpt-5-mini":{input:.25,output:2,cached:.025,reasoning:2},"openai/gpt-5.2":{input:1.75,output:14,cached:.175,reasoning:14},"openai/gpt-5.3-codex":{input:1.75,output:14,cached:.175,reasoning:14},"openai/gpt-5.4":{input:2.5,output:15,cached:.25,reasoning:15},"openai/gpt-5.4-image-2":{input:8,output:30,cached:2,reasoning:30},"openai/gpt-5.4-mini":{input:.75,output:4.5,cached:.075,reasoning:4.5},"openai/gpt-5.4-nano":{input:.2,output:1.25,cached:.02,reasoning:1.25},"openai/gpt-5.4-pro":{input:30,output:180,reasoning:180},"openai/gpt-5.5":{input:5,output:30,cached:.5,reasoning:30},"openai/gpt-5.5-pro":{input:30,output:180,reasoning:180},"openai/gpt-5.6-luna":{input:.2,output:1.2,cached:.02,cache_creation:.25,reasoning:1.2},"openai/gpt-5.6-sol":{input:5,output:30,cached:.5,cache_creation:6.25,reasoning:30},"openai/gpt-5.6-terra":{input:2,output:12,cached:.2,cache_creation:2.5,reasoning:12},"openai/gpt-audio":{input:2.5,output:10,reasoning:10},"openai/gpt-audio-mini":{input:.6,output:2.4,reasoning:2.4},"openai/gpt-oss-120b":{input:.039,output:.18,reasoning:.18},"qwen/qwen3-coder-next":{input:.12,output:.75,cached:.06,reasoning:.75},"qwen/qwen3.5-122b-a10b":{input:.26,output:2.08,reasoning:2.08},"qwen/qwen3.5-35b-a3b":{input:.1625,output:1.3,reasoning:1.3},"qwen/qwen3.5-397b-a17b":{input:.39,output:2.34,reasoning:2.34},"qwen/qwen3.5-9b":{input:.1,output:.15,reasoning:.15},"qwen/qwen3.5-flash":{input:.1048,output:.4194,reasoning:.4194},"qwen/qwen3.5-plus-02-15":{input:.26,output:1.56,reasoning:1.56},"qwen/qwen3.6-plus":{input:.54,output:3.21,reasoning:3.21},"qwen/qwen3.7-max":{input:1.25,output:3.75,cached:.25,reasoning:3.75},"qwen/qwen3.7-plus":{input:.4,output:1.6,cached:.08,reasoning:1.6},"qwen/qwen3.8-max":{input:2,output:6,cached:.25,cache_creation:2.5,reasoning:6},"qwen3.5-omni-plus":{input:1,output:5.7143,reasoning:5.7143},"qwen3.6-flash":{input:.171,output:1.029,cached:.017,cache_creation:.214,reasoning:1.029},"sakana/fugu-ultra":{input:5,output:30,cached:.5,reasoning:30},"seed-2-0-code-preview-260328":{input:1,output:6,cached:.2,cache_creation:.008333,reasoning:6},"seed-2-0-lite-260428":{input:.5,output:4,cached:.1,cache_creation:.008333,reasoning:4},"seed-2-0-mini-260428":{input:.2,output:.8,cached:.04,cache_creation:.00833,reasoning:.8},"seed-2-0-pro-260328":{input:1,output:6,cached:.2,cache_creation:.008333,reasoning:6},"stepfun/step-3.5-flash":{input:.1,output:.3,cached:.02,reasoning:.3},"stepfun/step-3.7-flash":{input:.2,output:1.15,cached:.04,reasoning:1.15},"tencent/hy3-preview":{input:.066,output:.26,cached:.029,reasoning:.26},"x-ai/grok-4.1-fast":{input:.2,output:.5,cached:.05,reasoning:.5},"x-ai/grok-4.20-beta":{input:2,output:6,cached:.2,reasoning:6},"x-ai/grok-4.3":{input:1.25,output:2.5,cached:.2,reasoning:2.5},"x-ai/grok-4.5":{input:2,output:6,cached:.5,reasoning:6},"x-ai/grok-build-0.1":{input:1,output:2,cached:.2,reasoning:2},"xiaomi/mimo-v2-flash":{input:.1,output:.3,cached:.01,reasoning:.3},"xiaomi/mimo-v2-omni":{input:.4,output:2,cached:.08,reasoning:2},"xiaomi/mimo-v2-pro":{input:1,output:3,cached:.2,reasoning:3},"xiaomi/mimo-v2.5":{input:.4,output:2,cached:.08,reasoning:2},"xiaomi/mimo-v2.5-pro":{input:1,output:3,cached:.2,reasoning:3},"z-ai/glm-4.5-air":{input:.13,output:.85,cached:.025,reasoning:.85},"z-ai/glm-4.6":{input:.6,output:2.2,cached:.11,reasoning:2.2},"z-ai/glm-4.6v":{input:.3,output:.9,reasoning:.9},"z-ai/glm-4.7":{input:.6,output:2.2,cached:.11,reasoning:2.2},"z-ai/glm-5":{input:1,output:3.2,cached:.2,reasoning:3.2},"z-ai/glm-5-turbo":{input:1.2,output:4,cached:.24,reasoning:4},"z-ai/glm-5.1":{input:1.05,output:3.5,cached:.525,reasoning:3.5},"z-ai/glm-5.2":{input:1.4,output:4.4,cached:.26,reasoning:4.4},"z-ai/glm-5.3-free":{input:0,output:0,cached:0,reasoning:0}}},f=[{pattern:"*-codex-xhigh",pricing:{input:10,output:40,cached:5,reasoning:60,cache_creation:10}},{pattern:"*-codex-high",pricing:{input:8,output:32,cached:4,reasoning:48,cache_creation:8}},{pattern:"*-codex-max",pricing:{input:8,output:32,cached:4,reasoning:48,cache_creation:8}},{pattern:"*-codex-mini-*",pricing:{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5}},{pattern:"*-codex-mini",pricing:{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5}},{pattern:"*-codex-low",pricing:{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75}},{pattern:"*-codex-none",pricing:{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75}},{pattern:"*-codex-spark",pricing:{input:3,output:12,cached:.3,reasoning:12,cache_creation:3}},{pattern:"codex-*",pricing:{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75}},{pattern:"*-codex",pricing:{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75}},{pattern:"claude-opus-*",pricing:{input:5,output:25,cached:.5,reasoning:25,cache_creation:6.25}},{pattern:"claude-sonnet-*",pricing:{input:3,output:15,cached:.3,reasoning:15,cache_creation:3.75}},{pattern:"claude-haiku-*",pricing:{input:1,output:5,cached:.1,reasoning:5,cache_creation:1.25}},{pattern:"claude-*",pricing:{input:3,output:15,cached:.3,reasoning:15,cache_creation:3.75}},{pattern:"gemini-*-flash-lite",pricing:{input:.15,output:1.25,cached:.015,reasoning:1.875,cache_creation:.15}},{pattern:"gemini-*-flash",pricing:{input:.3,output:2.5,cached:.03,reasoning:3.75,cache_creation:.3}},{pattern:"gemini-*-pro",pricing:{input:2,output:12,cached:.25,reasoning:18,cache_creation:2}},{pattern:"gemini-3-*",pricing:{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5}},{pattern:"gemini-2.5-*",pricing:{input:.3,output:2.5,cached:.03,reasoning:3.75,cache_creation:.3}},{pattern:"gemini-*",pricing:{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5}},{pattern:"gpt-5.6-*",pricing:{input:2.5,output:15,cached:.25,reasoning:15,cache_creation:2.5}},{pattern:"gpt-5.3-*",pricing:{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75}},{pattern:"gpt-5.2-*",pricing:{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75}},{pattern:"gpt-5.1-*",pricing:{input:1.25,output:10,cached:.625,reasoning:10,cache_creation:1.25}},{pattern:"gpt-5-*",pricing:{input:1.25,output:10,cached:.625,reasoning:10,cache_creation:1.25}},{pattern:"gpt-5*",pricing:{input:1.25,output:10,cached:.625,reasoning:10,cache_creation:1.25}},{pattern:"gpt-4o-*",pricing:{input:.15,output:.6,cached:.075,reasoning:.9,cache_creation:.15}},{pattern:"gpt-4o",pricing:{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5}},{pattern:"gpt-4*",pricing:{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5}},{pattern:"o1-*",pricing:{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3}},{pattern:"o1",pricing:{input:15,output:60,cached:7.5,reasoning:90,cache_creation:15}},{pattern:"o3-*",pricing:{input:10,output:40,cached:5,reasoning:60,cache_creation:10}},{pattern:"o4-*",pricing:{input:2,output:8,cached:1,reasoning:12,cache_creation:2}},{pattern:"qwen3-coder-*",pricing:{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},{pattern:"qwen*-coder-*",pricing:{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},{pattern:"qwen*",pricing:{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},{pattern:"kimi-*-thinking",pricing:{input:1.8,output:7.2,cached:.9,reasoning:10.8,cache_creation:1.8}},{pattern:"kimi-k3*",pricing:{input:3,output:15,cached:.3,reasoning:15,cache_creation:3}},{pattern:"kimi-k2*",pricing:{input:1.2,output:4.8,cached:.6,reasoning:7.2,cache_creation:1.2}},{pattern:"kimi-*",pricing:{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},{pattern:"deepseek-*reasoner*",pricing:{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14}},{pattern:"deepseek-r*",pricing:{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14}},{pattern:"deepseek-v*",pricing:{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14}},{pattern:"deepseek-*",pricing:{input:.14,output:.28,cached:.0028,reasoning:.28,cache_creation:.14}},{pattern:"glm-5*",pricing:{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},{pattern:"glm-4*",pricing:{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75}},{pattern:"glm-*",pricing:{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},{pattern:"MiniMax-*",pricing:{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},{pattern:"minimax-*",pricing:{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},{pattern:"grok-code-*",pricing:{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},{pattern:"grok-*",pricing:{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}}],g=new Map;function h(a,b){let c;return(!(c=g.get(a))&&(c=RegExp("^"+a.split("*").map(a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*")+"$","i"),g.set(a,c)),c).test(b)}function i(a,b){if(!b)return null;if(a&&e[a]?.[b])return e[a][b];let c=b.includes("/")?b.split("/").pop():b;if(d[c])return d[c];if(d[b])return d[b];for(let{pattern:a,pricing:d}of f)if(h(a,c)||h(a,b))return d;return null}function j(){return e}function k(a,b){if(!a||!b)return 0;let c=0,d=a.prompt_tokens||a.input_tokens||0,e=a.cached_tokens||a.cache_read_input_tokens||0,f=a.cache_creation_input_tokens||0;c+=Math.max(0,d-e-f)*(b.input/1e6),e>0&&(c+=e*((b.cached||b.input)/1e6)),c+=(a.completion_tokens||a.output_tokens||0)*(b.output/1e6);let g=a.reasoning_tokens||0;return g>0&&(c+=g*((b.reasoning||b.output)/1e6)),f>0&&(c+=f*((b.cache_creation||b.input)/1e6)),c}}};
|