swayrouter 1.0.0
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/.env.example +43 -0
- package/CHANGELOG.md +132 -0
- package/LICENSE +30 -0
- package/README.id.md +633 -0
- package/README.md +628 -0
- package/cli/cli.js +388 -0
- package/cli/package.json +4 -0
- package/cli/src/cli/commands/xaiVideo.js +280 -0
- package/cli/src/cli/tray/SwayAvatar.svg +20 -0
- package/cli/src/cli/tray/autostart.js +351 -0
- package/cli/src/cli/tray/icon.ico +0 -0
- package/cli/src/cli/tray/icon.png +0 -0
- package/cli/src/cli/tray/tray.js +258 -0
- package/cli/src/cli/tray/tray.ps1 +129 -0
- package/cli/src/cli/tray/trayHost.js +157 -0
- package/cli/src/cli/tray/trayWin.js +83 -0
- package/cli/src/cli/utils/display.js +123 -0
- package/cli/src/cli/utils/input.js +138 -0
- package/cli/src/runtime/discover.js +153 -0
- package/cli/src/runtime/lifecycle.js +333 -0
- package/cli/src/runtime/runMenu.js +250 -0
- package/cli/src/runtime/uiAdapters.js +12 -0
- package/cli/src/runtime/update.js +130 -0
- package/dashboard/dist/assets/CliTools-Ch3gKuNw.js +24 -0
- package/dashboard/dist/assets/Combo-BBCldjWi.js +1 -0
- package/dashboard/dist/assets/ConsoleLog-wywAYcPT.js +6 -0
- package/dashboard/dist/assets/Dashboard-DxzyF41b.js +1 -0
- package/dashboard/dist/assets/Header-C_9Su9BF.js +1 -0
- package/dashboard/dist/assets/Keys-D0ufgcsc.js +1 -0
- package/dashboard/dist/assets/Login-BeKpipS_.js +1 -0
- package/dashboard/dist/assets/ManageApiKey-CVXsmW2B.js +1 -0
- package/dashboard/dist/assets/OAuthCallback-D_UZYcF6.js +1 -0
- package/dashboard/dist/assets/Provider-BU7JfTqm.js +4 -0
- package/dashboard/dist/assets/ProviderModelAccordion-BAifkfVR.js +1 -0
- package/dashboard/dist/assets/Proxy-CU15VJ--.js +1 -0
- package/dashboard/dist/assets/QuotaMonitor-HzGK7bcc.js +1 -0
- package/dashboard/dist/assets/Settings-Dt4y2dC0.js +1 -0
- package/dashboard/dist/assets/Setup-DSDUwU7N.js +1 -0
- package/dashboard/dist/assets/StatusBadge-1nAOyHU2.js +1 -0
- package/dashboard/dist/assets/SwayChat-Bup7up6D.js +10 -0
- package/dashboard/dist/assets/Usage-eWnrPQ_v.js +4 -0
- package/dashboard/dist/assets/accordion-DOOPDDgt.js +1 -0
- package/dashboard/dist/assets/admin-extras-api-CCdu5TFM.js +1 -0
- package/dashboard/dist/assets/api-keys-api-ifAC2Ok3.js +1 -0
- package/dashboard/dist/assets/card-CC0Omjcv.js +1 -0
- package/dashboard/dist/assets/chatStudio-C0zPz_Z_.js +2 -0
- package/dashboard/dist/assets/checkbox-7SZBrmbN.js +1 -0
- package/dashboard/dist/assets/connections-api-_N54UD3S.js +1 -0
- package/dashboard/dist/assets/copy-button-qBvM6H9z.js +1 -0
- package/dashboard/dist/assets/currency-api-SV9CBf5e.js +1 -0
- package/dashboard/dist/assets/flip-button-BGgkjtl0.js +1 -0
- package/dashboard/dist/assets/frame-cUiti6Lq.js +1 -0
- package/dashboard/dist/assets/icons-vendor-CUx7SB5V.js +541 -0
- package/dashboard/dist/assets/index-B6j-9zHy.js +10 -0
- package/dashboard/dist/assets/index-C-_l0yYz.css +1 -0
- package/dashboard/dist/assets/live-mode-CHShLY4E.js +1 -0
- package/dashboard/dist/assets/markdown-vendor-BY8e1gQ8.js +29 -0
- package/dashboard/dist/assets/motion-vendor-g5fpGzmJ.js +9 -0
- package/dashboard/dist/assets/oauth-callback-CqYQzyd7.js +1 -0
- package/dashboard/dist/assets/query-vendor-DVevaSVS.js +1 -0
- package/dashboard/dist/assets/react-vendor-xnYrwzsL.js +61 -0
- package/dashboard/dist/assets/ripple-button-l8aMiVVG.js +1 -0
- package/dashboard/dist/assets/segmented-CqmEnQjZ.js +1 -0
- package/dashboard/dist/assets/select-D8pUtMXp.js +1 -0
- package/dashboard/dist/assets/skeleton-7uJDiIXe.js +1 -0
- package/dashboard/dist/assets/table-D0M60Tu1.js +1 -0
- package/dashboard/dist/assets/tabs-C6YkuulG.js +1 -0
- package/dashboard/dist/assets/tunnel-api-DDPsBaDV.js +1 -0
- package/dashboard/dist/assets/ui-vendor-BuM9f2NY.js +17 -0
- package/dashboard/dist/image2/SwayAvatar.svg +20 -0
- package/dashboard/dist/index.html +32 -0
- package/dashboard/dist/logo/avatar.svg +1 -0
- package/dashboard/dist/logo/sway.svg +20 -0
- package/dashboard/dist/logo/swaychat.svg +20 -0
- package/dashboard/dist/providers/SwayCustom.svg +19 -0
- package/dashboard/dist/providers/alicode.svg +12 -0
- package/dashboard/dist/providers/anthropic.svg +11 -0
- package/dashboard/dist/providers/antigravity.svg +3 -0
- package/dashboard/dist/providers/azure.svg +5 -0
- package/dashboard/dist/providers/baidu.svg +3 -0
- package/dashboard/dist/providers/blackbox.svg +5 -0
- package/dashboard/dist/providers/byteplus.svg +3 -0
- package/dashboard/dist/providers/cerebras.svg +4 -0
- package/dashboard/dist/providers/chutes.svg +4 -0
- package/dashboard/dist/providers/claude.svg +3 -0
- package/dashboard/dist/providers/cline.svg +11 -0
- package/dashboard/dist/providers/cloudflare-ai.svg +4 -0
- package/dashboard/dist/providers/codebuddy.svg +11 -0
- package/dashboard/dist/providers/codex.svg +10 -0
- package/dashboard/dist/providers/commandcode.svg +3 -0
- package/dashboard/dist/providers/cursor.svg +3 -0
- package/dashboard/dist/providers/deepseek.svg +10 -0
- package/dashboard/dist/providers/featherless.svg +3 -0
- package/dashboard/dist/providers/fireworks.svg +3 -0
- package/dashboard/dist/providers/gemini.svg +3 -0
- package/dashboard/dist/providers/geminicli.svg +11 -0
- package/dashboard/dist/providers/github.svg +3 -0
- package/dashboard/dist/providers/grok.svg +3 -0
- package/dashboard/dist/providers/groq.svg +3 -0
- package/dashboard/dist/providers/hermesagent.svg +1 -0
- package/dashboard/dist/providers/kilocode.svg +15 -0
- package/dashboard/dist/providers/kimchi.svg +3 -0
- package/dashboard/dist/providers/kimi.svg +4 -0
- package/dashboard/dist/providers/kiro.svg +10 -0
- package/dashboard/dist/providers/meta.svg +3 -0
- package/dashboard/dist/providers/mimo.svg +10 -0
- package/dashboard/dist/providers/minimax.svg +3 -0
- package/dashboard/dist/providers/mistral.svg +3 -0
- package/dashboard/dist/providers/morph.svg +3 -0
- package/dashboard/dist/providers/nebius.svg +4 -0
- package/dashboard/dist/providers/nvidia.svg +3 -0
- package/dashboard/dist/providers/ollama.svg +3 -0
- package/dashboard/dist/providers/omp.svg +5 -0
- package/dashboard/dist/providers/openai.svg +3 -0
- package/dashboard/dist/providers/opencode.svg +3 -0
- package/dashboard/dist/providers/openrouter.svg +3 -0
- package/dashboard/dist/providers/perplexity.svg +3 -0
- package/dashboard/dist/providers/poolside.svg +36 -0
- package/dashboard/dist/providers/qoder.svg +11 -0
- package/dashboard/dist/providers/sumopod.svg +3 -0
- package/dashboard/dist/providers/tencent.svg +5 -0
- package/dashboard/dist/providers/together.svg +12 -0
- package/dashboard/dist/providers/trae.svg +3 -0
- package/dashboard/dist/providers/venice.svg +4 -0
- package/dashboard/dist/providers/vercel.svg +3 -0
- package/dashboard/dist/providers/vertex.svg +17 -0
- package/dashboard/dist/providers/windsurf.svg +10 -0
- package/dashboard/dist/providers/zai.svg +3 -0
- package/dashboard/tsconfig.json +13 -0
- package/package.json +87 -0
- package/src/config/appConstants.js +153 -0
- package/src/config/defaultThinkingSignature.js +7 -0
- package/src/config/errorConfig.js +117 -0
- package/src/config/grokCli.js +9 -0
- package/src/config/kiroConstants.js +235 -0
- package/src/config/mediaConfig.js +20 -0
- package/src/config/ollamaModels.js +18 -0
- package/src/config/providerModels.js +109 -0
- package/src/config/providers.js +17 -0
- package/src/config/runtimeConfig.js +84 -0
- package/src/dashboardGuard.js +254 -0
- package/src/executors/antigravity.js +389 -0
- package/src/executors/azure.js +49 -0
- package/src/executors/base.js +225 -0
- package/src/executors/codebuddy-cn.js +23 -0
- package/src/executors/codebuddy-intl.js +60 -0
- package/src/executors/codex.js +436 -0
- package/src/executors/commandcode.js +83 -0
- package/src/executors/cursor.js +1075 -0
- package/src/executors/default.js +294 -0
- package/src/executors/gemini-cli.js +88 -0
- package/src/executors/github.js +393 -0
- package/src/executors/grok-cli.js +510 -0
- package/src/executors/grok-web.js +342 -0
- package/src/executors/index.js +86 -0
- package/src/executors/kimchi.js +116 -0
- package/src/executors/kiro.js +1155 -0
- package/src/executors/ollama-local.js +14 -0
- package/src/executors/opencode-go.js +47 -0
- package/src/executors/opencode.js +31 -0
- package/src/executors/qoder.js +433 -0
- package/src/executors/trae.js +318 -0
- package/src/executors/vertex.js +151 -0
- package/src/executors/windsurf.js +555 -0
- package/src/executors/xiaomi-tokenplan.js +16 -0
- package/src/handlers/chatCore/nonStreamingHandler.js +370 -0
- package/src/handlers/chatCore/requestDetail.js +130 -0
- package/src/handlers/chatCore/sseToJsonHandler.js +318 -0
- package/src/handlers/chatCore/streamingHandler.js +250 -0
- package/src/handlers/chatCore.js +652 -0
- package/src/lib/auth/dashboardSession.js +83 -0
- package/src/lib/auth/loginLimiter.js +99 -0
- package/src/lib/cache/ttlCache.js +153 -0
- package/src/lib/consoleLogBuffer.js +127 -0
- package/src/lib/dataDir.js +45 -0
- package/src/lib/db/adapters/betterSqliteAdapter.js +36 -0
- package/src/lib/db/adapters/bunSqliteAdapter.js +47 -0
- package/src/lib/db/adapters/nodeSqliteAdapter.js +65 -0
- package/src/lib/db/adapters/runtimeHelpers.js +23 -0
- package/src/lib/db/adapters/sqljsAdapter.js +103 -0
- package/src/lib/db/backup.js +75 -0
- package/src/lib/db/driver.js +110 -0
- package/src/lib/db/helpers/jsonCol.js +18 -0
- package/src/lib/db/helpers/kvStore.js +48 -0
- package/src/lib/db/helpers/metaStore.js +32 -0
- package/src/lib/db/index.js +473 -0
- package/src/lib/db/migrate.js +267 -0
- package/src/lib/db/migrations/001-initial.js +12 -0
- package/src/lib/db/migrations/002-prune-headroom-pxpipe-settings.js +32 -0
- package/src/lib/db/migrations/004-request-details-trace-id.js +12 -0
- package/src/lib/db/migrations/005-request-details-payload-capture.js +11 -0
- package/src/lib/db/migrations/007-headroom-readd-settings.js +35 -0
- package/src/lib/db/migrations/008-account-model-locks.js +22 -0
- package/src/lib/db/migrations/009-warp-pool-lifecycle.js +5 -0
- package/src/lib/db/migrations/010-api-key-file-permissions.js +7 -0
- package/src/lib/db/migrations/011-remove-upstream-user-agent-profile.js +41 -0
- package/src/lib/db/migrations/012-remove-headroom-settings.js +33 -0
- package/src/lib/db/migrations/013-default-fill-first-routing.js +20 -0
- package/src/lib/db/migrations/014-normalize-fill-first-routing.js +37 -0
- package/src/lib/db/migrations/015-remove-ip-ban-tables.js +8 -0
- package/src/lib/db/migrations/016-prune-legacy-codebuddy-intl-models.js +25 -0
- package/src/lib/db/migrations/index.js +20 -0
- package/src/lib/db/nineRouterMigration.js +785 -0
- package/src/lib/db/paths.js +23 -0
- package/src/lib/db/repos/accountModelLocksRepo.js +74 -0
- package/src/lib/db/repos/aliasRepo.js +108 -0
- package/src/lib/db/repos/apiKeysRepo.js +204 -0
- package/src/lib/db/repos/combosRepo.js +85 -0
- package/src/lib/db/repos/connectionsRepo.js +522 -0
- package/src/lib/db/repos/disabledModelsRepo.js +63 -0
- package/src/lib/db/repos/nodesRepo.js +127 -0
- package/src/lib/db/repos/pricingRepo.js +108 -0
- package/src/lib/db/repos/proxyPoolsRepo.js +104 -0
- package/src/lib/db/repos/requestDetailsRepo.js +345 -0
- package/src/lib/db/repos/settingsRepo.js +135 -0
- package/src/lib/db/repos/usageRepo.js +1335 -0
- package/src/lib/db/schema.js +179 -0
- package/src/lib/db/version.js +32 -0
- package/src/lib/db/writeBehind.js +174 -0
- package/src/lib/disabledModelsDb.js +3 -0
- package/src/lib/env.ts +175 -0
- package/src/lib/errors/publicError.js +18 -0
- package/src/lib/grokBuildConfig.js +243 -0
- package/src/lib/guardRequest.js +51 -0
- package/src/lib/localDb.js +21 -0
- package/src/lib/mcp/stdioSseBridge.js +174 -0
- package/src/lib/network/connectionProxy.js +200 -0
- package/src/lib/network/proxyTest.js +158 -0
- package/src/lib/network/proxyUrl.js +76 -0
- package/src/lib/network/relay.js +71 -0
- package/src/lib/oauth/constants/oauth.js +152 -0
- package/src/lib/oauth/constants/xai.js +43 -0
- package/src/lib/oauth/kiroExternalIdp.js +167 -0
- package/src/lib/oauth/providerHelpers.js +90 -0
- package/src/lib/oauth/providers/_shared.js +12 -0
- package/src/lib/oauth/providers/antigravity.js +126 -0
- package/src/lib/oauth/providers/claude.js +60 -0
- package/src/lib/oauth/providers/cline.js +62 -0
- package/src/lib/oauth/providers/clinepass.js +62 -0
- package/src/lib/oauth/providers/codebuddy-cn.js +75 -0
- package/src/lib/oauth/providers/codebuddy-intl.js +73 -0
- package/src/lib/oauth/providers/codex.js +72 -0
- package/src/lib/oauth/providers/cursor.js +18 -0
- package/src/lib/oauth/providers/gemini-cli.js +84 -0
- package/src/lib/oauth/providers/github.js +96 -0
- package/src/lib/oauth/providers/grok-cli.js +123 -0
- package/src/lib/oauth/providers/index.js +233 -0
- package/src/lib/oauth/providers/kilocode.js +60 -0
- package/src/lib/oauth/providers/kimchi.js +79 -0
- package/src/lib/oauth/providers/kimi.js +79 -0
- package/src/lib/oauth/providers/kiro.js +147 -0
- package/src/lib/oauth/providers/qoder.js +90 -0
- package/src/lib/oauth/providers/trae.js +244 -0
- package/src/lib/oauth/providers/windsurf.js +123 -0
- package/src/lib/oauth/providers/xai.js +95 -0
- package/src/lib/oauth/providers.js +16 -0
- package/src/lib/oauth/services/cursor.js +132 -0
- package/src/lib/oauth/services/kiro.js +351 -0
- package/src/lib/oauth/services/oauth.js +135 -0
- package/src/lib/oauth/services/qoder.js +151 -0
- package/src/lib/oauth/services/xai.js +204 -0
- package/src/lib/oauth/utils/ideDetect.js +55 -0
- package/src/lib/oauth/utils/pkce.js +25 -0
- package/src/lib/oauth/utils/server.js +732 -0
- package/src/lib/oauth/utils/ui.js +43 -0
- package/src/lib/providerNormalization.js +40 -0
- package/src/lib/qoder/constants.js +1 -0
- package/src/lib/requestDetailsDb.js +3 -0
- package/src/lib/resourceProfile.ts +124 -0
- package/src/lib/runtimeSecrets.ts +130 -0
- package/src/lib/security/payloadCapture.js +87 -0
- package/src/lib/tunnel/cloudflare/cloudflared.js +436 -0
- package/src/lib/tunnel/cloudflare/config.js +8 -0
- package/src/lib/tunnel/cloudflare/healthCheck.js +37 -0
- package/src/lib/tunnel/cloudflare/manager.js +149 -0
- package/src/lib/tunnel/cloudflare/pid.js +31 -0
- package/src/lib/tunnel/cloudflare/publicUrl.js +41 -0
- package/src/lib/tunnel/cloudflare/requirements.js +12 -0
- package/src/lib/tunnel/index.js +26 -0
- package/src/lib/tunnel/shared/dnsResolver.js +16 -0
- package/src/lib/tunnel/shared/internetCheck.js +30 -0
- package/src/lib/tunnel/shared/state.js +45 -0
- package/src/lib/tunnel/shared/watchdogConfig.js +6 -0
- package/src/lib/update/installer.js +52 -0
- package/src/lib/update/version.js +116 -0
- package/src/lib/usageDb.js +6 -0
- package/src/lib/usageRefresh.js +88 -0
- package/src/lifecycle/appLifecycle.ts +99 -0
- package/src/models.js +36 -0
- package/src/next/headers.js +12 -0
- package/src/next/server.js +74 -0
- package/src/observability/metrics.js +439 -0
- package/src/observability/tracing.js +107 -0
- package/src/open-sse-index.js +70 -0
- package/src/providers/capabilities.js +299 -0
- package/src/providers/display.ts +142 -0
- package/src/providers/index.js +27 -0
- package/src/providers/models/helpers.js +19 -0
- package/src/providers/models/namePatterns.js +27 -0
- package/src/providers/models/schema.js +32 -0
- package/src/providers/pricing.js +248 -0
- package/src/providers/registry/agentrouter.js +52 -0
- package/src/providers/registry/alicode-intl.js +32 -0
- package/src/providers/registry/alicode.js +33 -0
- package/src/providers/registry/alims-intl.js +30 -0
- package/src/providers/registry/anthropic.js +29 -0
- package/src/providers/registry/antigravity.js +139 -0
- package/src/providers/registry/azure.js +23 -0
- package/src/providers/registry/baidu.js +35 -0
- package/src/providers/registry/blackbox.js +41 -0
- package/src/providers/registry/byteplus.js +36 -0
- package/src/providers/registry/cerebras.js +33 -0
- package/src/providers/registry/chutes.js +26 -0
- package/src/providers/registry/claude.js +80 -0
- package/src/providers/registry/cline.js +53 -0
- package/src/providers/registry/clinepass.js +62 -0
- package/src/providers/registry/cloudflare-ai.js +84 -0
- package/src/providers/registry/codebuddy-cn.js +95 -0
- package/src/providers/registry/codebuddy-intl.js +91 -0
- package/src/providers/registry/codex.js +145 -0
- package/src/providers/registry/commandcode.js +45 -0
- package/src/providers/registry/cursor.js +61 -0
- package/src/providers/registry/deepseek.js +55 -0
- package/src/providers/registry/featherless.js +36 -0
- package/src/providers/registry/fireworks.js +34 -0
- package/src/providers/registry/gemini-cli.js +59 -0
- package/src/providers/registry/gemini.js +76 -0
- package/src/providers/registry/github.js +131 -0
- package/src/providers/registry/glm-cn.js +35 -0
- package/src/providers/registry/glm.js +58 -0
- package/src/providers/registry/grok-cli.js +87 -0
- package/src/providers/registry/grok-web.js +41 -0
- package/src/providers/registry/groq.js +38 -0
- package/src/providers/registry/index.js +77 -0
- package/src/providers/registry/kilo-gateway.js +34 -0
- package/src/providers/registry/kilocode.js +48 -0
- package/src/providers/registry/kimchi.js +49 -0
- package/src/providers/registry/kimi.js +82 -0
- package/src/providers/registry/kiro.js +132 -0
- package/src/providers/registry/meta.js +34 -0
- package/src/providers/registry/minimax-cn.js +90 -0
- package/src/providers/registry/minimax.js +90 -0
- package/src/providers/registry/mistral.js +36 -0
- package/src/providers/registry/morph.js +31 -0
- package/src/providers/registry/nebius.js +26 -0
- package/src/providers/registry/nvidia.js +55 -0
- package/src/providers/registry/ollama-local.js +18 -0
- package/src/providers/registry/ollama.js +38 -0
- package/src/providers/registry/openai.js +114 -0
- package/src/providers/registry/opencode-go.js +41 -0
- package/src/providers/registry/opencode.js +26 -0
- package/src/providers/registry/openrouter.js +36 -0
- package/src/providers/registry/perplexity.js +56 -0
- package/src/providers/registry/poolside.js +30 -0
- package/src/providers/registry/qoder.js +58 -0
- package/src/providers/registry/sumopod.js +84 -0
- package/src/providers/registry/tencent.js +29 -0
- package/src/providers/registry/together.js +38 -0
- package/src/providers/registry/trae.js +71 -0
- package/src/providers/registry/venice.js +69 -0
- package/src/providers/registry/vercel-ai-gateway.js +37 -0
- package/src/providers/registry/vertex-partner.js +31 -0
- package/src/providers/registry/vertex.js +33 -0
- package/src/providers/registry/windsurf.js +129 -0
- package/src/providers/registry/xai.js +46 -0
- package/src/providers/registry/xiaomi-mimo.js +66 -0
- package/src/providers/registry/xiaomi-tokenplan.js +58 -0
- package/src/providers/registryEntry.js +3 -0
- package/src/providers/schema.js +33 -0
- package/src/providers/shared.js +114 -0
- package/src/providers/thinkingLevels.js +49 -0
- package/src/routes/api/auth/login/route.js +82 -0
- package/src/routes/api/auth/logout/route.js +9 -0
- package/src/routes/api/auth/reset-password/route.js +12 -0
- package/src/routes/api/auth/status/route.js +33 -0
- package/src/routes/api/auth/verify-password/route.js +39 -0
- package/src/routes/api/chat/tools/curl/route.js +100 -0
- package/src/routes/api/chat/tools/router/route.js +215 -0
- package/src/routes/api/chat/tools/search/route.js +362 -0
- package/src/routes/api/chat/tools/shell/route.js +228 -0
- package/src/routes/api/cli-tools/all-statuses/route.js +37 -0
- package/src/routes/api/cli-tools/claude-settings/route.js +261 -0
- package/src/routes/api/cli-tools/codex-settings/route.js +220 -0
- package/src/routes/api/cli-tools/cowork-mcp-registry/route.js +80 -0
- package/src/routes/api/cli-tools/cowork-mcp-tools/route.js +96 -0
- package/src/routes/api/cli-tools/cowork-settings/route.js +380 -0
- package/src/routes/api/cli-tools/grok-build-settings/route.js +152 -0
- package/src/routes/api/cli-tools/hermes-settings/route.js +169 -0
- package/src/routes/api/cli-tools/kilo-settings/route.js +131 -0
- package/src/routes/api/cli-tools/model-mappings/route.js +43 -0
- package/src/routes/api/cli-tools/omp-settings/route.js +266 -0
- package/src/routes/api/cli-tools/opencode-settings/route.js +243 -0
- package/src/routes/api/combos/[id]/route.js +73 -0
- package/src/routes/api/combos/route.js +43 -0
- package/src/routes/api/health/live/route.js +7 -0
- package/src/routes/api/health/ready/route.js +19 -0
- package/src/routes/api/health/route.js +17 -0
- package/src/routes/api/inflight/stream/route.js +24 -0
- package/src/routes/api/init/route.js +3 -0
- package/src/routes/api/keys/[id]/route.js +71 -0
- package/src/routes/api/keys/route.js +41 -0
- package/src/routes/api/logs/route.js +19 -0
- package/src/routes/api/mcp/[plugin]/message/route.js +23 -0
- package/src/routes/api/mcp/[plugin]/sse/route.js +35 -0
- package/src/routes/api/models/availability/route.js +104 -0
- package/src/routes/api/models/custom/route.js +58 -0
- package/src/routes/api/models/disabled/route.js +47 -0
- package/src/routes/api/models/route.js +64 -0
- package/src/routes/api/models/test/ping.js +236 -0
- package/src/routes/api/models/test/route.js +14 -0
- package/src/routes/api/oauth/[provider]/[action]/route.js +491 -0
- package/src/routes/api/oauth/codex/bulk-import/route.js +105 -0
- package/src/routes/api/oauth/codex/import-token/route.js +82 -0
- package/src/routes/api/oauth/cursor/auto-import/route.js +250 -0
- package/src/routes/api/oauth/cursor/import/route.js +86 -0
- package/src/routes/api/oauth/kiro/api-key/route.js +60 -0
- package/src/routes/api/oauth/kiro/auto-import/route.js +120 -0
- package/src/routes/api/oauth/kiro/import/route.js +72 -0
- package/src/routes/api/oauth/kiro/import-cli-proxy/route.js +42 -0
- package/src/routes/api/oauth/kiro/social-authorize/route.js +40 -0
- package/src/routes/api/oauth/kiro/social-exchange/route.js +62 -0
- package/src/routes/api/pricing/route.js +96 -0
- package/src/routes/api/provider-nodes/[id]/route.js +106 -0
- package/src/routes/api/provider-nodes/route.js +110 -0
- package/src/routes/api/provider-nodes/validate/route.js +197 -0
- package/src/routes/api/providers/[id]/models/route.js +716 -0
- package/src/routes/api/providers/[id]/route.js +195 -0
- package/src/routes/api/providers/[id]/test/route.js +27 -0
- package/src/routes/api/providers/[id]/test/testUtils.js +912 -0
- package/src/routes/api/providers/[id]/test-models/route.js +211 -0
- package/src/routes/api/providers/catalog/route.js +58 -0
- package/src/routes/api/providers/client/route.js +133 -0
- package/src/routes/api/providers/counts/route.js +43 -0
- package/src/routes/api/providers/kilo/free-models/route.js +58 -0
- package/src/routes/api/providers/route.js +361 -0
- package/src/routes/api/providers/suggested-models/filters.js +24 -0
- package/src/routes/api/providers/suggested-models/route.js +34 -0
- package/src/routes/api/providers/test-batch/route.js +145 -0
- package/src/routes/api/providers/validate/route.js +633 -0
- package/src/routes/api/proxy-pools/[id]/route.js +129 -0
- package/src/routes/api/proxy-pools/[id]/test/route.js +64 -0
- package/src/routes/api/proxy-pools/cloudflare-deploy/route.js +183 -0
- package/src/routes/api/proxy-pools/route.js +85 -0
- package/src/routes/api/proxy-pools/vercel-deploy/route.js +181 -0
- package/src/routes/api/settings/currency/route.js +29 -0
- package/src/routes/api/settings/database/path/route.js +8 -0
- package/src/routes/api/settings/database/route.js +89 -0
- package/src/routes/api/settings/migrate-9router/route.js +81 -0
- package/src/routes/api/settings/require-login/route.js +14 -0
- package/src/routes/api/settings/route.js +186 -0
- package/src/routes/api/shutdown/route.js +25 -0
- package/src/routes/api/tags/route.js +17 -0
- package/src/routes/api/translator/console-logs/route.js +28 -0
- package/src/routes/api/translator/console-logs/stream/route.js +95 -0
- package/src/routes/api/tunnel/disable/route.js +18 -0
- package/src/routes/api/tunnel/enable/route.js +32 -0
- package/src/routes/api/tunnel/status/route.js +23 -0
- package/src/routes/api/update/route.js +42 -0
- package/src/routes/api/usage/[connectionId]/codex-reset-credits/route.js +169 -0
- package/src/routes/api/usage/[connectionId]/route.js +222 -0
- package/src/routes/api/usage/chart/route.js +27 -0
- package/src/routes/api/usage/history/route.js +94 -0
- package/src/routes/api/usage/logs/route.js +14 -0
- package/src/routes/api/usage/providers/route.js +36 -0
- package/src/routes/api/usage/request-details/route.js +61 -0
- package/src/routes/api/usage/request-logs/route.js +15 -0
- package/src/routes/api/usage/stats/route.js +23 -0
- package/src/routes/api/usage/stream/route.js +78 -0
- package/src/routes/api/v1/api/chat/route.js +36 -0
- package/src/routes/api/v1/chat/completions/route.js +28 -0
- package/src/routes/api/v1/images/edits/route.js +70 -0
- package/src/routes/api/v1/images/generations/route.js +50 -0
- package/src/routes/api/v1/images/imageValidation.js +45 -0
- package/src/routes/api/v1/messages/count_tokens/route.js +87 -0
- package/src/routes/api/v1/messages/route.js +26 -0
- package/src/routes/api/v1/models/route.js +440 -0
- package/src/routes/api/v1/responses/compact/route.js +34 -0
- package/src/routes/api/v1/responses/route.js +26 -0
- package/src/routes/api/v1/route.js +1 -0
- package/src/routes/api/version/route.js +11 -0
- package/src/routes/table.js +1141 -0
- package/src/rtk/applyFilter.js +13 -0
- package/src/rtk/autodetect.js +104 -0
- package/src/rtk/caveman.js +6 -0
- package/src/rtk/cavemanPrompts.js +107 -0
- package/src/rtk/constants.js +51 -0
- package/src/rtk/filters/buildOutput.js +120 -0
- package/src/rtk/filters/dedupLog.js +43 -0
- package/src/rtk/filters/find.js +47 -0
- package/src/rtk/filters/gitDiff.js +90 -0
- package/src/rtk/filters/gitLog.js +88 -0
- package/src/rtk/filters/gitStatus.js +101 -0
- package/src/rtk/filters/grep.js +45 -0
- package/src/rtk/filters/ls.js +73 -0
- package/src/rtk/filters/readNumbered.js +22 -0
- package/src/rtk/filters/searchList.js +49 -0
- package/src/rtk/filters/smartTruncate.js +13 -0
- package/src/rtk/filters/tree.js +28 -0
- package/src/rtk/index.js +143 -0
- package/src/rtk/ponytail.js +6 -0
- package/src/rtk/ponytailPrompt.js +49 -0
- package/src/rtk/systemInject.js +89 -0
- package/src/server.ts +474 -0
- package/src/services/accountFallback.js +241 -0
- package/src/services/accountPool.js +389 -0
- package/src/services/capacityAdapter.js +140 -0
- package/src/services/cliModelMapping.js +84 -0
- package/src/services/clinepassModels.js +60 -0
- package/src/services/codebuddyModels.js +250 -0
- package/src/services/combo.js +482 -0
- package/src/services/copilotModels.js +126 -0
- package/src/services/currencyRate.js +56 -0
- package/src/services/cursorModels.js +197 -0
- package/src/services/grokCliModels.js +130 -0
- package/src/services/kimchiModels.js +175 -0
- package/src/services/kiroModels.js +246 -0
- package/src/services/model.js +83 -0
- package/src/services/oauthCredentialManager.js +153 -0
- package/src/services/projectId.js +240 -0
- package/src/services/provider.js +145 -0
- package/src/services/qoderModels.js +274 -0
- package/src/services/tokenRefresh/dedup.js +70 -0
- package/src/services/tokenRefresh/providers.js +626 -0
- package/src/services/tokenRefresh.js +274 -0
- package/src/services/usage/claude.js +134 -0
- package/src/services/usage/codebuddy-cn.js +212 -0
- package/src/services/usage/codex.js +193 -0
- package/src/services/usage/deepseek.js +103 -0
- package/src/services/usage/github.js +94 -0
- package/src/services/usage/google.js +218 -0
- package/src/services/usage/grok-cli.js +368 -0
- package/src/services/usage/grokCliQuotaFrame.js +170 -0
- package/src/services/usage/kimi.js +185 -0
- package/src/services/usage/kiro.js +172 -0
- package/src/services/usage/minimax.js +215 -0
- package/src/services/usage/misc.js +264 -0
- package/src/services/usage/shared.js +59 -0
- package/src/services/usage.js +56 -0
- package/src/shared/clineAuth.js +37 -0
- package/src/shared/constants/config.js +80 -0
- package/src/shared/constants/coworkPlugins.js +69 -0
- package/src/shared/constants/models.js +41 -0
- package/src/shared/constants/providers.js +128 -0
- package/src/shared/constants/providersDisplay.js +1 -0
- package/src/shared/qoder/constants.js +50 -0
- package/src/shared/qoder/cosy.js +134 -0
- package/src/shared/qoder/encoding.js +36 -0
- package/src/shared/services/initializeApp.js +226 -0
- package/src/shared/services/quotaAutoPing.js +310 -0
- package/src/shared/utils/apiKey.js +65 -0
- package/src/shared/utils/clineAuth.js +1 -0
- package/src/shared/utils/index.js +3 -0
- package/src/shared/utils/machineId.js +60 -0
- package/src/shared/utils/ssrfGuard.js +280 -0
- package/src/sse/handlers/chat.js +426 -0
- package/src/sse/oauthLease.js +32 -0
- package/src/sse/recovery.js +235 -0
- package/src/sse/services/auth.js +489 -0
- package/src/sse/services/backgroundTokenRefresh.js +173 -0
- package/src/sse/services/model.js +129 -0
- package/src/sse/services/requestCancellation.js +4 -0
- package/src/sse/services/tokenRefresh.js +264 -0
- package/src/sse/utils/logger.js +142 -0
- package/src/staticServe.ts +95 -0
- package/src/transformer/streamToJsonConverter.js +87 -0
- package/src/translator/canonical.js +81 -0
- package/src/translator/concerns/chunk.js +9 -0
- package/src/translator/concerns/compatFallback.js +147 -0
- package/src/translator/concerns/finishReason.js +59 -0
- package/src/translator/concerns/image.js +105 -0
- package/src/translator/concerns/json.js +4 -0
- package/src/translator/concerns/kiroConversation.js +428 -0
- package/src/translator/concerns/message.js +5 -0
- package/src/translator/concerns/modality.js +134 -0
- package/src/translator/concerns/paramSupport.js +97 -0
- package/src/translator/concerns/prefetch.js +86 -0
- package/src/translator/concerns/reasoning.js +18 -0
- package/src/translator/concerns/thinking.js +40 -0
- package/src/translator/concerns/thinkingUnified.js +319 -0
- package/src/translator/concerns/toolCall.js +134 -0
- package/src/translator/concerns/usage.js +61 -0
- package/src/translator/detection.js +42 -0
- package/src/translator/formats/claude.js +323 -0
- package/src/translator/formats/gemini.js +366 -0
- package/src/translator/formats/maxTokens.js +19 -0
- package/src/translator/formats/openai.js +116 -0
- package/src/translator/formats/responsesApi.js +117 -0
- package/src/translator/formats.js +28 -0
- package/src/translator/index.js +237 -0
- package/src/translator/request/antigravity-to-openai.js +217 -0
- package/src/translator/request/claude-to-kiro.js +288 -0
- package/src/translator/request/claude-to-openai.js +199 -0
- package/src/translator/request/gemini-to-openai.js +142 -0
- package/src/translator/request/openai-responses.js +373 -0
- package/src/translator/request/openai-to-claude.js +260 -0
- package/src/translator/request/openai-to-commandcode.js +161 -0
- package/src/translator/request/openai-to-cursor.js +175 -0
- package/src/translator/request/openai-to-gemini.js +422 -0
- package/src/translator/request/openai-to-kiro.js +360 -0
- package/src/translator/request/openai-to-ollama.js +152 -0
- package/src/translator/request/openai-to-vertex.js +36 -0
- package/src/translator/response/claude-to-openai.js +185 -0
- package/src/translator/response/commandcode-to-openai.js +164 -0
- package/src/translator/response/cursor-to-openai.js +18 -0
- package/src/translator/response/gemini-to-openai.js +127 -0
- package/src/translator/response/kiro-to-claude.js +230 -0
- package/src/translator/response/kiro-to-openai.js +136 -0
- package/src/translator/response/ollama-to-openai.js +106 -0
- package/src/translator/response/openai-responses.js +534 -0
- package/src/translator/response/openai-to-antigravity.js +107 -0
- package/src/translator/response/openai-to-claude.js +231 -0
- package/src/translator/schema/blocks.js +40 -0
- package/src/translator/schema/defaults.js +3 -0
- package/src/translator/schema/finishReasons.js +22 -0
- package/src/translator/schema/index.js +7 -0
- package/src/translator/schema/roles.js +12 -0
- package/src/transport/requestBoundary.ts +223 -0
- package/src/transport/routerAdmission.ts +380 -0
- package/src/types/provider.ts +59 -0
- package/src/utils/bypassHandler.js +272 -0
- package/src/utils/claudeCloaking.js +10 -0
- package/src/utils/claudeSignature.js +35 -0
- package/src/utils/clientDetector.js +183 -0
- package/src/utils/cursorChecksum.js +104 -0
- package/src/utils/cursorProtobuf.js +801 -0
- package/src/utils/debugLog.js +12 -0
- package/src/utils/error.js +120 -0
- package/src/utils/inflight.js +127 -0
- package/src/utils/kiroSessionReplay.js +139 -0
- package/src/utils/ollamaTransform.js +83 -0
- package/src/utils/proxyFetch.js +308 -0
- package/src/utils/reasoningContentInjector.js +71 -0
- package/src/utils/requestLogger.js +272 -0
- package/src/utils/responsesStreamHelpers.js +46 -0
- package/src/utils/sessionManager.js +205 -0
- package/src/utils/sse.js +13 -0
- package/src/utils/sseConstants.js +21 -0
- package/src/utils/stream.js +511 -0
- package/src/utils/streamHandler.js +256 -0
- package/src/utils/streamHelpers.js +113 -0
- package/src/utils/toolDeduper.js +44 -0
- package/src/utils/usageTracking.js +329 -0
- package/tsconfig.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="./assets/BannerGithubSway.png" alt="Sway Router banner" />
|
|
3
|
+
<h1 style="margin: 8px 0 0;">Sway Router</h1>
|
|
4
|
+
</div>
|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
<strong>One gateway. Every model.</strong><br />
|
|
8
|
+
Connect once, route anywhere.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="./README.md"><img src="https://img.shields.io/badge/English-README-2563EB?style=for-the-badge" alt="English README" /></a>
|
|
13
|
+
<a href="./README.id.md"><img src="https://img.shields.io/badge/Bahasa_Indonesia-README.id-16A34A?style=for-the-badge" alt="Bahasa Indonesia README" /></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://github.com/envielxyz/SwayRouter/stargazers"><img src="https://img.shields.io/github/stars/envielxyz/SwayRouter?style=flat" alt="GitHub stars" /></a>
|
|
18
|
+
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License" /></a>
|
|
19
|
+
<a href="https://bun.sh"><img src="https://img.shields.io/badge/runtime-Bun-black?logo=bun" alt="Bun" /></a>
|
|
20
|
+
<a href="https://www.typescriptlang.org"><img src="https://img.shields.io/badge/code-TypeScript-3178C6?logo=typescript&logoColor=white" alt="TypeScript" /></a>
|
|
21
|
+
<a href="https://react.dev"><img src="https://img.shields.io/badge/dashboard-React-61DAFB?logo=react&logoColor=111827" alt="React" /></a>
|
|
22
|
+
<a href="https://sqlite.org"><img src="https://img.shields.io/badge/storage-SQLite-003B57?logo=sqlite&logoColor=white" alt="SQLite" /></a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<img src="./docs/media/screenshots/dashboard.png" alt="Sway Router dashboard" width="960" />
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
Sway Router brings all your AI providers into one clean gateway, with a simple
|
|
30
|
+
dashboard to manage models, routing, and usage.
|
|
31
|
+
|
|
32
|
+
## Contents
|
|
33
|
+
|
|
34
|
+
- [Get started](#get-started)
|
|
35
|
+
- [Uninstall](#uninstall)
|
|
36
|
+
- [Requirements](#requirements)
|
|
37
|
+
- [HTTP API](#one-http-api-for-your-whole-stack)
|
|
38
|
+
- [Dashboard](#the-dashboard-you-actually-want-to-use)
|
|
39
|
+
- [Migrate from 9Router](#migrate-from-9router)
|
|
40
|
+
- [Providers](#providers)
|
|
41
|
+
- [Supported CLI Tools](#supported-cli-tools)
|
|
42
|
+
- [Features](#what-sway-router-can-do)
|
|
43
|
+
- [Comparison](#sway-router-vs-9router-vs-omniroute)
|
|
44
|
+
- [Operations and security](#operations-and-security)
|
|
45
|
+
- [Tech stack](#tech-stack)
|
|
46
|
+
- [Configuration](#configuration)
|
|
47
|
+
- [Attribution and license](#attribution)
|
|
48
|
+
|
|
49
|
+
## Get started
|
|
50
|
+
|
|
51
|
+
### Global CLI — the quick way
|
|
52
|
+
|
|
53
|
+
Install it globally and start the router:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
bun install -g swayrouter@latest
|
|
57
|
+
swayrouter
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The CLI can start, stop, restart, and check the router status. It also checks
|
|
61
|
+
for a newer version when starting up, but it will never update itself without
|
|
62
|
+
you saying so.
|
|
63
|
+
|
|
64
|
+
### Windows — local install
|
|
65
|
+
|
|
66
|
+
The easiest Windows setup is a local global install. If Bun is already
|
|
67
|
+
installed, skip the first step.
|
|
68
|
+
|
|
69
|
+
1. Open PowerShell and install Bun:
|
|
70
|
+
|
|
71
|
+
```powershell
|
|
72
|
+
powershell -c "irm bun.sh/install.ps1 | iex"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
2. Close and reopen PowerShell, then verify Bun:
|
|
76
|
+
|
|
77
|
+
```powershell
|
|
78
|
+
bun --version
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
3. Install and start Sway Router:
|
|
82
|
+
|
|
83
|
+
```powershell
|
|
84
|
+
bun install -g swayrouter@latest
|
|
85
|
+
swayrouter start -b
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
4. Open `http://127.0.0.1:14045/dashboard` in your browser and finish the
|
|
89
|
+
first-run setup.
|
|
90
|
+
|
|
91
|
+
5. Check or stop the local instance whenever you need:
|
|
92
|
+
|
|
93
|
+
```powershell
|
|
94
|
+
swayrouter status
|
|
95
|
+
swayrouter stop
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The CLI keeps Sway Router's runtime data under `%APPDATA%\.swayrouter`.
|
|
99
|
+
You do not need to create a `.env` file for a normal local install.
|
|
100
|
+
|
|
101
|
+
### Uninstall
|
|
102
|
+
|
|
103
|
+
Stop the local router before removing the global CLI:
|
|
104
|
+
|
|
105
|
+
```powershell
|
|
106
|
+
swayrouter stop
|
|
107
|
+
bun remove -g swayrouter
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
If you installed it with npm, use `npm uninstall -g swayrouter` instead.
|
|
111
|
+
Uninstalling the package does not remove your provider credentials, settings,
|
|
112
|
+
API keys, or usage data. To remove those as well, export a JSON backup first,
|
|
113
|
+
stop the router, then delete `%APPDATA%\.swayrouter` on Windows or
|
|
114
|
+
`~/.swayrouter` on Linux/macOS.
|
|
115
|
+
|
|
116
|
+
### Windows — run from source
|
|
117
|
+
|
|
118
|
+
For contributors working from a checkout:
|
|
119
|
+
|
|
120
|
+
```powershell
|
|
121
|
+
git clone https://github.com/envielxyz/SwayRouter.git
|
|
122
|
+
cd SwayRouter
|
|
123
|
+
bun install --frozen-lockfile
|
|
124
|
+
Push-Location dashboard
|
|
125
|
+
bun install --frozen-lockfile
|
|
126
|
+
bun run build
|
|
127
|
+
Pop-Location
|
|
128
|
+
bun run dev
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Then open `http://127.0.0.1:14045/dashboard`. Keep the terminal open while
|
|
132
|
+
the development server is running.
|
|
133
|
+
|
|
134
|
+
### Run from source (macOS/Linux)
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
bun install --frozen-lockfile
|
|
138
|
+
cd dashboard
|
|
139
|
+
bun install --frozen-lockfile
|
|
140
|
+
bun run build
|
|
141
|
+
cd ..
|
|
142
|
+
bun run dev
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Then open `http://127.0.0.1:14045/dashboard` and connect your first provider.
|
|
146
|
+
|
|
147
|
+
Want to work on the dashboard? Run `bun run dev` inside `dashboard/` in a
|
|
148
|
+
second terminal.
|
|
149
|
+
|
|
150
|
+
### Docker — isolated and persistent
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
docker build -t swayrouter:latest .
|
|
154
|
+
docker compose up -d
|
|
155
|
+
docker compose ps
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Docker also generates persistent secrets in its data volume. Copy
|
|
159
|
+
`.env.example` to `.env` only when you want explicit deployment overrides.
|
|
160
|
+
|
|
161
|
+
Open `http://127.0.0.1:14045/dashboard`. Follow the logs with:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
docker compose logs -f swayrouter
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
The compose setup keeps the data in the `swayrouter-data` volume, publishes
|
|
168
|
+
the port to localhost only, runs as an unprivileged user, uses a read-only
|
|
169
|
+
root filesystem, and includes a readiness health check. Keep the volume if
|
|
170
|
+
you want to keep your provider connections, keys, settings, and usage data.
|
|
171
|
+
|
|
172
|
+
## Requirements
|
|
173
|
+
|
|
174
|
+
| Deployment | You need | Process manager |
|
|
175
|
+
| --- | --- | --- |
|
|
176
|
+
| Global CLI | Bun `1.3+`, a writable data directory, and provider network access | The CLI for local use; add a supervisor for production |
|
|
177
|
+
| Docker | Docker Engine with the Compose plugin and a persistent volume | Docker Compose handles restart and health checks; PM2 is not needed |
|
|
178
|
+
| Native VPS | Bun `1.3+`, a writable data directory, and provider network access | `systemd` is recommended; PM2 is optional |
|
|
179
|
+
|
|
180
|
+
For a small native VPS, start with **2 vCPU, 2 GB RAM, and 10 GB SSD**. A local
|
|
181
|
+
dev machine can run with less. Put Sway Router behind an HTTPS reverse proxy before
|
|
182
|
+
exposing it outside your private network.
|
|
183
|
+
|
|
184
|
+
### Native VPS with PM2 (optional)
|
|
185
|
+
|
|
186
|
+
PM2 supports Bun, but it is only needed when you run Sway Router directly on the VPS
|
|
187
|
+
instead of using Docker or another supervisor:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
npm install -g pm2
|
|
191
|
+
pm2 start src/server.ts --name swayrouter --interpreter bun
|
|
192
|
+
pm2 save
|
|
193
|
+
pm2 startup
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Run `pm2 startup` exactly as instructed by PM2 so it can restore the process
|
|
197
|
+
after a reboot. Do not run PM2 on top of Docker Compose for the same container.
|
|
198
|
+
|
|
199
|
+
## One HTTP API for your whole stack
|
|
200
|
+
|
|
201
|
+
Use the client format you already know. Sway Router translates requests and
|
|
202
|
+
responses for the provider behind the scenes.
|
|
203
|
+
|
|
204
|
+
| Client / feature | Endpoint |
|
|
205
|
+
| --- | --- |
|
|
206
|
+
| OpenAI Chat Completions | `POST /v1/chat/completions` |
|
|
207
|
+
| OpenAI Responses | `POST /v1/responses` |
|
|
208
|
+
| Compact Responses | `POST /v1/responses/compact` |
|
|
209
|
+
| Anthropic Messages | `POST /v1/messages` |
|
|
210
|
+
| Anthropic token count | `POST /v1/messages/count_tokens` |
|
|
211
|
+
| Ollama-style chat | `POST /v1/api/chat` |
|
|
212
|
+
| Image generation | `POST /v1/images/generations` |
|
|
213
|
+
| Image editing | `POST /v1/images/edits` |
|
|
214
|
+
| Model list | `GET /v1/models` |
|
|
215
|
+
|
|
216
|
+
Streaming and non-streaming requests are supported where the selected provider
|
|
217
|
+
and model support them. `/codex` and `/responses` aliases are included for
|
|
218
|
+
common client setups.
|
|
219
|
+
|
|
220
|
+
### Tiny example
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
export SWAY_API_KEY="swy-your_gateway_key"
|
|
224
|
+
curl http://127.0.0.1:14045/v1/chat/completions \
|
|
225
|
+
--oauth2-bearer "${SWAY_API_KEY}" \
|
|
226
|
+
-H "Content-Type: application/json" \
|
|
227
|
+
-d '{
|
|
228
|
+
"model": "your-active-model-id",
|
|
229
|
+
"messages": [{"role": "user", "content": "Say hello"}]
|
|
230
|
+
}'
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Your Sway Router gateway key is separate from the provider credentials behind it.
|
|
234
|
+
Provider secrets stay on the server.
|
|
235
|
+
|
|
236
|
+
## The dashboard you actually want to use
|
|
237
|
+
|
|
238
|
+
The dashboard is not an afterthought. It is a focused control room for your
|
|
239
|
+
providers, models, accounts, quotas, usage, logs, and routing. Compact cards,
|
|
240
|
+
clear status badges, search and filters, responsive layouts, and smooth
|
|
241
|
+
loading/refresh states keep everything easy to scan and manage on desktop,
|
|
242
|
+
tablet, and mobile.
|
|
243
|
+
|
|
244
|
+
| Dashboard | Providers |
|
|
245
|
+
| --- | --- |
|
|
246
|
+
|  |  |
|
|
247
|
+
| Provider models | Custom provider |
|
|
248
|
+
|  |  |
|
|
249
|
+
| Usage & cost | Quota monitor |
|
|
250
|
+
|  |  |
|
|
251
|
+
| Settings | CLI Tools |
|
|
252
|
+
|  |  |
|
|
253
|
+
|
|
254
|
+
[Browse the full UI showcase](./docs/SHOWCASE.md)
|
|
255
|
+
|
|
256
|
+
### Main menu
|
|
257
|
+
|
|
258
|
+
| Menu | What is inside |
|
|
259
|
+
| --- | --- |
|
|
260
|
+
| **Dashboard** | Request count, token totals, cost, latency, provider activity, and system status |
|
|
261
|
+
| **API Keys** | Create, reveal, copy, rotate, enable, revoke, and delete gateway keys |
|
|
262
|
+
| **Providers** | Add connections, choose auth, test accounts, manage models, and configure routing |
|
|
263
|
+
| **Combos** | Build ordered model/provider fallback combos and choose combo strategies |
|
|
264
|
+
| **Proxy** | Create and test proxy pools, attach connections, and deploy optional relays |
|
|
265
|
+
| **Usage** | Charts, token breakdowns, estimated cost, history, filters, sorting, and request details |
|
|
266
|
+
| **Quota Monitor** | Provider/account availability, quota state, diagnostics, and manual refresh |
|
|
267
|
+
| **CLI Tools** | Configure supported coding tools, select models, and copy generated configs |
|
|
268
|
+
| **Sway Chat** | Chat through the router with model selection and optional built-in tools |
|
|
269
|
+
| **Settings** | Preferences, General, Security, Data controls, and 9Router migration |
|
|
270
|
+
| **Console Logs** | Search, filter, wrap, copy, and inspect runtime/provider diagnostics |
|
|
271
|
+
|
|
272
|
+
### Settings, properly mapped
|
|
273
|
+
|
|
274
|
+
- **Preferences:** profile photo with crop/zoom, profile name, and display
|
|
275
|
+
currency (USD by default, IDR available).
|
|
276
|
+
- **General:** RTK token saver, Caveman, Ponytail, request payload capture,
|
|
277
|
+
and Cloudflare Tunnel settings.
|
|
278
|
+
- **Security:** gateway API-key requirement, dashboard login requirement,
|
|
279
|
+
dashboard password, login protection, and graceful shutdown.
|
|
280
|
+
- **Data:** database location, JSON backup/restore, and 9Router migration.
|
|
281
|
+
|
|
282
|
+
## Migrate from 9Router
|
|
283
|
+
|
|
284
|
+
Moving from 9Router is built into **Settings → Data → Migrate from 9Router**.
|
|
285
|
+
Sway Router supports both migration sources:
|
|
286
|
+
|
|
287
|
+
- **Local installation:** automatically finds a supported 9Router database on
|
|
288
|
+
the same machine.
|
|
289
|
+
- **9Router JSON backup:** import an exported backup from this or another
|
|
290
|
+
device.
|
|
291
|
+
|
|
292
|
+
Before importing, choose exactly what to bring over:
|
|
293
|
+
|
|
294
|
+
- Provider accounts and credentials
|
|
295
|
+
- Custom providers
|
|
296
|
+
- Custom models
|
|
297
|
+
- Combos
|
|
298
|
+
- Routing settings — off by default
|
|
299
|
+
- Activate imported accounts immediately — off by default
|
|
300
|
+
|
|
301
|
+
Sway Router previews the migration first and shows what is ready, already present,
|
|
302
|
+
or skipped. It validates the source, maps provider and model references to
|
|
303
|
+
Sway Router's format, removes duplicates, and reports incompatible or unavailable
|
|
304
|
+
providers instead of importing broken entries. Previewing does not change your
|
|
305
|
+
data.
|
|
306
|
+
|
|
307
|
+
When you confirm with your dashboard password, Sway Router creates a safety backup,
|
|
308
|
+
merges the selected data into the existing database, and refreshes the
|
|
309
|
+
dashboard. Existing Sway Router data is not replaced, and imported accounts remain
|
|
310
|
+
inactive unless you explicitly enable them during migration. Use **Import JSON**
|
|
311
|
+
for Sway Router backups; use **Migrate from 9Router** for 9Router backups.
|
|
312
|
+
|
|
313
|
+
## Providers
|
|
314
|
+
|
|
315
|
+
The built-in catalog currently shows **65 providers**. The list below is
|
|
316
|
+
generated from the providers available in the dashboard, not from a marketing
|
|
317
|
+
list. Provider availability and auth options can change as upstream services
|
|
318
|
+
change.
|
|
319
|
+
|
|
320
|
+
### API key — 44
|
|
321
|
+
|
|
322
|
+
| Provider | ID |
|
|
323
|
+
| --- | --- |
|
|
324
|
+
| Alibaba Coding | `alicode-intl` |
|
|
325
|
+
| Alibaba | `alicode` |
|
|
326
|
+
| Alibaba Studio | `alims-intl` |
|
|
327
|
+
| Anthropic | `anthropic` |
|
|
328
|
+
| Azure OpenAI | `azure` |
|
|
329
|
+
| Baidu Qianfan | `baidu` |
|
|
330
|
+
| Blackbox AI | `blackbox` |
|
|
331
|
+
| BytePlus ModelArk | `byteplus` |
|
|
332
|
+
| Cerebras | `cerebras` |
|
|
333
|
+
| Chutes AI | `chutes` |
|
|
334
|
+
| Cloudflare | `cloudflare-ai` |
|
|
335
|
+
| Command Code | `commandcode` |
|
|
336
|
+
| DeepSeek | `deepseek` |
|
|
337
|
+
| Featherless | `featherless` |
|
|
338
|
+
| Fireworks AI | `fireworks` |
|
|
339
|
+
| Gemini | `gemini` |
|
|
340
|
+
| GLM (China) | `glm-cn` |
|
|
341
|
+
| GLM Coding | `glm` |
|
|
342
|
+
| Groq | `groq` |
|
|
343
|
+
| Kilo Gateway | `kilo-gateway` |
|
|
344
|
+
| Minimax (China) | `minimax-cn` |
|
|
345
|
+
| Minimax Coding | `minimax` |
|
|
346
|
+
| Mistral | `mistral` |
|
|
347
|
+
| Morph | `morph` |
|
|
348
|
+
| Nebius AI | `nebius` |
|
|
349
|
+
| NVIDIA NIM | `nvidia` |
|
|
350
|
+
| Ollama Local | `ollama-local` |
|
|
351
|
+
| Ollama Cloud | `ollama` |
|
|
352
|
+
| OpenAI | `openai` |
|
|
353
|
+
| OpenCode Go | `opencode-go` |
|
|
354
|
+
| OpenRouter | `openrouter` |
|
|
355
|
+
| Perplexity AI | `perplexity` |
|
|
356
|
+
| Poolside | `poolside` |
|
|
357
|
+
| Tencent Hunyuan | `tencent` |
|
|
358
|
+
| Together AI | `together` |
|
|
359
|
+
| Venice AI | `venice` |
|
|
360
|
+
| Vercel AI Gateway | `vercel-ai-gateway` |
|
|
361
|
+
| Vertex Partner | `vertex-partner` |
|
|
362
|
+
| Vertex AI | `vertex` |
|
|
363
|
+
| Xiaomi MiMo | `xiaomi-mimo` |
|
|
364
|
+
| Xiaomi MiMo (Token Plan) | `xiaomi-tokenplan` |
|
|
365
|
+
| Meta AI | `meta` |
|
|
366
|
+
| Agent Router | `agentrouter` |
|
|
367
|
+
| SumoPod | `sumopod` |
|
|
368
|
+
|
|
369
|
+
Perplexity AI uses the official [Perplexity Router API](https://docs.perplexity.ai/docs/router/quickstart): one API key, one connection, and one live model catalog across OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages.
|
|
370
|
+
|
|
371
|
+
### OAuth, device code, or token import — 19
|
|
372
|
+
|
|
373
|
+
| Provider | ID |
|
|
374
|
+
| --- | --- |
|
|
375
|
+
| Antigravity | `antigravity` |
|
|
376
|
+
| Claude Code | `claude` |
|
|
377
|
+
| Cline | `cline` |
|
|
378
|
+
| ClinePass | `clinepass` |
|
|
379
|
+
| CodeBuddy CN | `codebuddy-cn` |
|
|
380
|
+
| CodeBuddy | `codebuddy-intl` |
|
|
381
|
+
| OpenAI Codex | `codex` |
|
|
382
|
+
| Cursor IDE | `cursor` |
|
|
383
|
+
| Gemini CLI | `gemini-cli` |
|
|
384
|
+
| GitHub Copilot | `github` |
|
|
385
|
+
| Grok CLI (Grok Build) | `grok-cli` |
|
|
386
|
+
| Kilo Code | `kilocode` |
|
|
387
|
+
| Kimchi | `kimchi` |
|
|
388
|
+
| Kimi | `kimi` |
|
|
389
|
+
| Kiro AI | `kiro` |
|
|
390
|
+
| Qoder | `qoder` |
|
|
391
|
+
| Trae | `trae` |
|
|
392
|
+
| Windsurf | `windsurf` |
|
|
393
|
+
| xAI (Grok) | `xai` |
|
|
394
|
+
|
|
395
|
+
### Web cookie — 1
|
|
396
|
+
|
|
397
|
+
| Provider | ID |
|
|
398
|
+
| --- | --- |
|
|
399
|
+
| Grok Web (Subscription) | `grok-web` |
|
|
400
|
+
|
|
401
|
+
### No auth — 1
|
|
402
|
+
|
|
403
|
+
| Provider | ID |
|
|
404
|
+
| --- | --- |
|
|
405
|
+
| OpenCode Free | `opencode` |
|
|
406
|
+
|
|
407
|
+
## Supported CLI Tools
|
|
408
|
+
|
|
409
|
+
Sway Router can detect and configure these coding tools to use the gateway:
|
|
410
|
+
|
|
411
|
+
- Claude Code
|
|
412
|
+
- Codex CLI
|
|
413
|
+
- OpenCode
|
|
414
|
+
- Hermes Agent
|
|
415
|
+
- Claude Cowork
|
|
416
|
+
- Kilo Code
|
|
417
|
+
- Grok Build
|
|
418
|
+
- OMP (oh-my-pi)
|
|
419
|
+
|
|
420
|
+
## What Sway Router can do
|
|
421
|
+
|
|
422
|
+
### Providers and accounts
|
|
423
|
+
|
|
424
|
+
- Connect providers with API keys, OAuth, device code, cookies/sessions, or
|
|
425
|
+
access/refresh tokens when that provider supports the flow.
|
|
426
|
+
- Add multiple accounts to one provider and set their priority or enabled state.
|
|
427
|
+
- Test a connection, test individual models, or test a whole provider batch.
|
|
428
|
+
- Import live model catalogs when an upstream endpoint is available.
|
|
429
|
+
- Add custom providers, custom nodes, custom models, aliases, and pricing.
|
|
430
|
+
- Mark model capabilities such as vision, audio, video, search, tools, and
|
|
431
|
+
reasoning.
|
|
432
|
+
- Keep provider-specific IDs, endpoints, headers, and compatibility rules.
|
|
433
|
+
|
|
434
|
+
### Routing and fallbacks
|
|
435
|
+
|
|
436
|
+
- `fill-first` for predictable account usage.
|
|
437
|
+
- `round-robin` for simple rotation.
|
|
438
|
+
- `least-inflight` for spreading active work.
|
|
439
|
+
- `sticky` and `cache-affine` behavior when account stability matters.
|
|
440
|
+
- Per-provider routing overrides and sticky controls.
|
|
441
|
+
- Combos for ordered multi-model or multi-provider fallback.
|
|
442
|
+
- Account cooldowns, locks, endpoint fallback, and bounded retries.
|
|
443
|
+
|
|
444
|
+
### Translation and model support
|
|
445
|
+
|
|
446
|
+
- OpenAI, Anthropic, Responses, and Ollama-style request formats.
|
|
447
|
+
- Provider-specific request and response translation.
|
|
448
|
+
- Streaming conversion over SSE plus normal JSON responses.
|
|
449
|
+
- Tool calls, thinking/reasoning, vision, image input, media, and usage
|
|
450
|
+
handling where supported by the selected model.
|
|
451
|
+
- Compatibility fallbacks for optional parameters that an upstream rejects.
|
|
452
|
+
- Dynamic model discovery, static catalogs, custom models, aliases, disabled
|
|
453
|
+
models, and capability-aware filtering.
|
|
454
|
+
|
|
455
|
+
### Usage, cost, and quota
|
|
456
|
+
|
|
457
|
+
- Request history with provider, model, account, endpoint, status, and latency.
|
|
458
|
+
- Input, output, cached, and total token tracking.
|
|
459
|
+
- Estimated cost with USD as the default display currency and IDR as an option.
|
|
460
|
+
- Provider totals, charts, recent activity, and request detail views.
|
|
461
|
+
- Quota monitor cards with provider/account status and refresh actions.
|
|
462
|
+
- Optional request/response payload capture with retention controls.
|
|
463
|
+
|
|
464
|
+
### Backup and migration
|
|
465
|
+
|
|
466
|
+
- Export and restore Sway Router data as JSON.
|
|
467
|
+
- Migrate from a local 9Router installation or a 9Router JSON backup.
|
|
468
|
+
- Select which accounts, custom providers, models, combos, and routing settings
|
|
469
|
+
to import.
|
|
470
|
+
- Preview compatibility and duplicates before making changes, then create a
|
|
471
|
+
safety backup before the migration is applied.
|
|
472
|
+
|
|
473
|
+
### Performance and reliability
|
|
474
|
+
|
|
475
|
+
- Global request admission control and bounded queues.
|
|
476
|
+
- Per-provider and per-account concurrency limits.
|
|
477
|
+
- Adaptive capacity based on available memory and CPU.
|
|
478
|
+
- Request-body budgets plus upload, connection, stream, and queue timeouts.
|
|
479
|
+
- Upstream retry and endpoint fallback with controlled attempt counts.
|
|
480
|
+
- Automatic OAuth token refresh and refresh de-duplication.
|
|
481
|
+
- Safe handling for disconnects, cancelled streams, failed providers, and 429s.
|
|
482
|
+
- Graceful shutdown so active work can finish cleanly.
|
|
483
|
+
|
|
484
|
+
### Built-in tools
|
|
485
|
+
|
|
486
|
+
- Sway Chat with optional Tavily or Brave web search.
|
|
487
|
+
- Shell, curl, and router-inspection tools with explicit controls.
|
|
488
|
+
- RTK, Caveman, and Ponytail token-saving features.
|
|
489
|
+
- CLI model mappings for supported coding tools.
|
|
490
|
+
|
|
491
|
+
## Sway Router vs. 9Router vs. OmniRoute
|
|
492
|
+
|
|
493
|
+
All three projects solve a similar problem and cover the usual routing,
|
|
494
|
+
account, fallback, and provider workflows. The simple architecture comparison
|
|
495
|
+
is:
|
|
496
|
+
|
|
497
|
+
Sway Router also has multi-account rotation, quota-aware selection, token saving,
|
|
498
|
+
retry, fallback, and provider token refresh; this section is intentionally about
|
|
499
|
+
runtime weight, not a feature scoreboard.
|
|
500
|
+
|
|
501
|
+
- **Sway Router:** Bun + Hono + SQLite, with a React/Vite dashboard. One core
|
|
502
|
+
server designed for local use and small VPS deployments.
|
|
503
|
+
- **[9Router](https://github.com/decolua/9router):** Node + Next.js/React +
|
|
504
|
+
Express + SQLite. More framework layers and a separate CLI runtime.
|
|
505
|
+
- **[OmniRoute](https://github.com/diegosouzapw/OmniRoute):** Node + Next.js/
|
|
506
|
+
React + SQLite/sql.js, with optional Redis, browser, desktop, and PWA layers.
|
|
507
|
+
|
|
508
|
+
### Which one is lighter?
|
|
509
|
+
|
|
510
|
+
For a comparable local or small-VPS gateway setup, **Sway Router is the
|
|
511
|
+
lighter default**. Bun and Hono have less server overhead than a full Next.js
|
|
512
|
+
application, and Sway Router's core does not require extra services to run.
|
|
513
|
+
|
|
514
|
+
That is an architecture comparison, not a fixed RAM promise. Real usage still
|
|
515
|
+
depends on concurrent streams, request size, account count, proxy layers, and
|
|
516
|
+
optional services. Sway Router's documented small-VPS starting point is 2 vCPU and
|
|
517
|
+
2 GB RAM, with bounded queues, concurrency, retries, and request bodies.
|
|
518
|
+
|
|
519
|
+
### Why choose Sway Router?
|
|
520
|
+
|
|
521
|
+
- **Smaller default footprint.** A Bun server and SQLite cover the core use
|
|
522
|
+
case without requiring Redis, a hosted sync service, a desktop shell, or a
|
|
523
|
+
browser pool.
|
|
524
|
+
- **A dashboard built for daily use.** Providers, accounts, models, routing,
|
|
525
|
+
usage, quotas, proxy, logs, and settings stay in one clean control room.
|
|
526
|
+
- **Built-in resource guardrails.** Sway Router detects the host profile and keeps
|
|
527
|
+
concurrency, queues, request bodies, retries, and background work bounded.
|
|
528
|
+
- **Easy to ship and inspect.** Run it locally, on a small VPS, in Docker, or
|
|
529
|
+
as a standalone binary, with SQLite backup/import and an inspectable API.
|
|
530
|
+
|
|
531
|
+
The Sway Router figures and menu map come from the [provider registry](./src/providers/registry/index.js),
|
|
532
|
+
[dashboard navigation](./dashboard/src/components/Sidebar.tsx),
|
|
533
|
+
[route table](./src/routes/table.js), and [package manifest](./package.json).
|
|
534
|
+
|
|
535
|
+
## Operations and security
|
|
536
|
+
|
|
537
|
+
- Dashboard sessions with JWT and bcrypt password hashing.
|
|
538
|
+
- Login limiting and protected admin routes.
|
|
539
|
+
- Gateway authentication through `Authorization: Bearer ...` or `x-api-key`.
|
|
540
|
+
- Localhost-first defaults and server-side provider credentials.
|
|
541
|
+
- Environment-based secrets and SSRF protection.
|
|
542
|
+
- Health, readiness, version, runtime status, and Prometheus-style metrics.
|
|
543
|
+
- SQLite WAL mode, migrations, indexes, backups, export, and import.
|
|
544
|
+
- Docker/Compose, native source runs, Bun CLI, and standalone binaries.
|
|
545
|
+
|
|
546
|
+
Sway Router protects its own process and account pools, but it does not create
|
|
547
|
+
provider quota or promise a fixed RPS. Your real capacity still depends on
|
|
548
|
+
provider limits, account count, network latency, prompt size, and stream
|
|
549
|
+
duration.
|
|
550
|
+
|
|
551
|
+
## Tech stack
|
|
552
|
+
|
|
553
|
+
- **Runtime:** Bun, with Node-compatible fallbacks where practical
|
|
554
|
+
- **Gateway:** TypeScript, Hono, native HTTP, and SSE
|
|
555
|
+
- **Dashboard:** React, Vite, Tailwind CSS, React Router, and TanStack Query
|
|
556
|
+
- **Storage:** SQLite with WAL mode, migrations, backups, and `sql.js` fallback
|
|
557
|
+
- **Auth:** JWT, bcrypt, OAuth/PKCE, provider-specific token refresh
|
|
558
|
+
- **Shipping:** Bun CLI, Docker, standalone binaries, GitHub Actions
|
|
559
|
+
|
|
560
|
+
## Configuration
|
|
561
|
+
|
|
562
|
+
Configuration is optional for a single local or Docker instance. On first
|
|
563
|
+
start, Sway Router creates strong JWT, gateway-key, and machine-salt secrets under
|
|
564
|
+
the persistent data directory. Use `.env` when you need to override the
|
|
565
|
+
defaults, bind another host, or manage secrets externally:
|
|
566
|
+
|
|
567
|
+
```dotenv
|
|
568
|
+
PORT=14045
|
|
569
|
+
HOSTNAME=127.0.0.1
|
|
570
|
+
DATA_DIR=/var/lib/swayrouter
|
|
571
|
+
NODE_ENV=production
|
|
572
|
+
JWT_SECRET=replace-with-a-random-secret-at-least-32-characters
|
|
573
|
+
API_KEY_SECRET=replace-with-a-random-secret-at-least-32-characters
|
|
574
|
+
MACHINE_ID_SALT=replace-with-a-random-private-salt
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
Never point multiple independent Sway Router instances at the same SQLite data
|
|
578
|
+
directory. If a supervisor injects secrets, keep their values stable across
|
|
579
|
+
restarts so dashboard sessions and the instance identity remain stable.
|
|
580
|
+
|
|
581
|
+
Default database paths:
|
|
582
|
+
|
|
583
|
+
```text
|
|
584
|
+
Linux/macOS: ~/.swayrouter/db/data.sqlite
|
|
585
|
+
Windows: %APPDATA%\\.swayrouter\\db\\data.sqlite
|
|
586
|
+
Docker: /app/data/db/data.sqlite
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
Keep the data directory persistent. It contains provider credentials,
|
|
590
|
+
configuration, and usage data. Never commit `.env`, database files, backups,
|
|
591
|
+
OAuth tokens, cookies, or logs.
|
|
592
|
+
|
|
593
|
+
## Why SQLite?
|
|
594
|
+
|
|
595
|
+
SQLite keeps one private Sway Router instance small, portable, and easy to back up.
|
|
596
|
+
PostgreSQL and Redis make more sense for a separate commercial app with
|
|
597
|
+
distributed users, billing, background jobs, or multiple Sway Router instances.
|
|
598
|
+
|
|
599
|
+
## Development checks
|
|
600
|
+
|
|
601
|
+
```bash
|
|
602
|
+
bun run typecheck
|
|
603
|
+
bun test
|
|
604
|
+
bun run routes:check
|
|
605
|
+
bun run package:check
|
|
606
|
+
bun run build:binary
|
|
607
|
+
bun run smoke:binary
|
|
608
|
+
bun run build:dashboard
|
|
609
|
+
bun run test:e2e:install
|
|
610
|
+
bun run test:e2e
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
## Attribution
|
|
614
|
+
|
|
615
|
+
Sway Router is built as a standalone project. It reuses selected OAuth, tunnel, CLI,
|
|
616
|
+
and utility pieces from [9Router](https://github.com/decolua/9router), while the
|
|
617
|
+
gateway, routing, dashboard, storage, API, performance, and release setup are
|
|
618
|
+
built and maintained here.
|
|
619
|
+
|
|
620
|
+
See [`LICENSE`](./LICENSE) for the MIT attribution.
|
|
621
|
+
|
|
622
|
+
## License
|
|
623
|
+
|
|
624
|
+
MIT. See [`LICENSE`](./LICENSE).
|
|
625
|
+
|
|
626
|
+
Sway Router is a gateway and administration tool. You are responsible for
|
|
627
|
+
your provider accounts, credentials, traffic, privacy, compliance, and
|
|
628
|
+
deployment security.
|