turbollm 0.1.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/LICENSE.md ADDED
@@ -0,0 +1,105 @@
1
+ # Functional Source License, Version 1.1, ALv2 Future License
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-ALv2
6
+
7
+ ## Notice
8
+
9
+ Copyright 2026 Mohit Soni
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the Apache License, Version 2.0 that is effective on the second anniversary of
91
+ the date we make the Software available. On or after that date, you may use the
92
+ Software under the Apache License, Version 2.0, in which case the following
93
+ will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
+ this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software distributed
103
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
+ specific language governing permissions and limitations under the License.
package/README.md ADDED
@@ -0,0 +1,163 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/mohitsoni48/Turbo-LLM/main/turbollm/web/public/brand/turbollm-icon-512.jpeg" width="96" height="96" alt="TurboLLM" />
3
+ </p>
4
+
5
+ <h1 align="center">TurboLLM</h1>
6
+
7
+ <p align="center">
8
+ <strong>Run any local LLM, auto-tuned to your GPU — with a polished web UI and an
9
+ OpenAI/Anthropic-compatible API.</strong><br/>
10
+ Point Claude Code at your own machine in one command. Fully offline, no cloud key.
11
+ </p>
12
+
13
+ <!-- Brand: shipped app icon web/public/brand/turbollm-icon-512.jpeg · high-res masters web/brand-assets/ (unshipped) · in-app mark web/src/components/Logo.tsx · favicon web/public/favicon.svg -->
14
+
15
+ ---
16
+
17
+ TurboLLM is a single command — `npx turbollm` — that starts a local daemon, opens a
18
+ browser UI, and serves your models over an API any tool can talk to. It manages **any
19
+ bring-your-own inference engine** (stock `llama.cpp`, community forks, or a default it
20
+ provisions for you), **auto-tunes the launch flags to your exact hardware**, and shows you
21
+ **real measured tokens/sec**.
22
+
23
+ It's built for the prosumer/indie-dev who today hand-compiles forks and hunts forums for
24
+ the right flags — not as "another easy chat app," but as the **performance & bleeding-edge
25
+ layer for local LLMs**.
26
+
27
+ ## Why TurboLLM
28
+
29
+ - **Any engine, including forks.** Most tools lock you to one blessed runtime. TurboLLM
30
+ makes any `llama-server`-compatible binary a first-class choice — point it at a build you
31
+ compiled, or let it auto-provision the right prebuilt for your GPU (CUDA / ROCm / Metal /
32
+ SYCL / Vulkan, picked by detected vendor).
33
+ - **Auto-tuned to your hardware.** It benchmarks on load and derives fast defaults (flash
34
+ attention, speculative decoding / NextN, context, offload, KV-cache type, threads) with a
35
+ VRAM-fit verdict *before* you load — no more guessing flags.
36
+ - **Real tokens/sec, never fake.** Speed shown in the model list is measured on your
37
+ machine from actual generation, not a synthetic estimate.
38
+ - **A real chat UI.** Streaming with live t/s, prefill %, TTFT and full stats; markdown +
39
+ code highlighting; collapsible thinking blocks; edit / regenerate / delete / copy;
40
+ persistent searchable conversations; image input for vision models; per-chat system
41
+ prompt and sampling.
42
+ - **Drop-in APIs.** OpenAI **and** Anthropic-compatible endpoints, so existing tools and
43
+ agentic CLIs work unchanged.
44
+ - **Usable from any device.** The web UI runs in the browser and can be shared across your
45
+ LAN (with optional API-key auth), not locked to the machine it runs on.
46
+ - **Bring your own models.** Point it at folders you already have (no re-download), or
47
+ browse and download GGUFs from Hugging Face — or any direct URL — inside the app.
48
+ - **Offline-first & private.** Core local use needs no account, no backend, no internet.
49
+ No analytics are collected.
50
+
51
+ ## Requirements
52
+
53
+ - **Node.js 22 or newer** — the daemon enforces this at startup and exits with a clear
54
+ message if the version is too old. Download: <https://nodejs.org>
55
+ - A GPU is recommended but not required (a CPU build is provisioned as a fallback).
56
+
57
+ ## Quick start
58
+
59
+ ```bash
60
+ # run directly without installing (recommended for first try)
61
+ npx turbollm
62
+
63
+ # or install globally, then run
64
+ npm install -g turbollm
65
+ turbollm
66
+ ```
67
+
68
+ The daemon starts, prints the local URL (default <http://127.0.0.1:6996>), and opens your
69
+ browser. On first run with no engine configured, it downloads a suitable prebuilt
70
+ `llama-server` for your hardware automatically. Stop the daemon with **Ctrl+C**.
71
+
72
+ Then, in the UI: open **Models**, download or pick a GGUF, and load it.
73
+
74
+ ## Use your local model with Claude Code
75
+
76
+ TurboLLM serves an Anthropic-compatible API, so coding CLIs like
77
+ [Claude Code](https://www.npmjs.com/package/@anthropic-ai/claude-code) can run against
78
+ whatever model you have loaded — no cloud key, fully offline. One command wires it up:
79
+
80
+ ```bash
81
+ turbollm launch claude # opens Claude Code on your loaded model
82
+ ```
83
+
84
+ This requires the daemon running with a model loaded. It points Claude Code's
85
+ `ANTHROPIC_BASE_URL` / `ANTHROPIC_MODEL` at TurboLLM and execs `claude`; extra args are
86
+ forwarded (`turbollm launch claude --help`). If `claude` isn't installed, the command tells
87
+ you how (`npm install -g @anthropic-ai/claude-code`). The in-app **Developer** screen also
88
+ shows manual env-var snippets for any OpenAI- or Anthropic-compatible tool.
89
+
90
+ ## Command-line usage
91
+
92
+ ```bash
93
+ turbollm # start on :6996, open browser
94
+ turbollm --port 9000 # listen on a specific port
95
+ turbollm --no-open # start without opening a browser
96
+ turbollm --addr 0.0.0.0:6996 # bind all interfaces (LAN sharing)
97
+ turbollm launch claude # start Claude Code against the loaded model
98
+ ```
99
+
100
+ | Flag | Description |
101
+ |------|-------------|
102
+ | `--port <n>` | Listen on a specific port (default: 6996) |
103
+ | `--addr <host:port>` | Full host:port override, e.g. `0.0.0.0:6996` for LAN sharing |
104
+ | `--no-open` | Start without opening a browser window |
105
+ | `--config <file>` | Path to a custom config file |
106
+ | `--help`, `-h` | Show usage and exit |
107
+
108
+ State (config, database, downloaded engines and models) lives under **`~/.turbollm/`**.
109
+
110
+ ## API
111
+
112
+ With a model loaded, TurboLLM serves two compatible APIs on the same port:
113
+
114
+ ```bash
115
+ # OpenAI-compatible
116
+ curl http://127.0.0.1:6996/v1/chat/completions \
117
+ -H "Content-Type: application/json" \
118
+ -d '{"model":"local","messages":[{"role":"user","content":"hello"}]}'
119
+ ```
120
+
121
+ The Anthropic-compatible endpoint (`/v1/messages`, including tool use and streaming) powers
122
+ the Claude Code integration above. When sharing over a LAN you can require an API key —
123
+ enable it in **Settings → Network**.
124
+
125
+ ## Develop & run from source
126
+
127
+ ```bash
128
+ npm install # daemon deps
129
+ cd web && npm install && cd ..
130
+
131
+ npm run build:web # build the React UI -> src/webdist
132
+ npm run start # run the daemon in dev (hot TS via tsx)
133
+ # open http://127.0.0.1:6996 · curl http://127.0.0.1:6996/api/v1/status
134
+
135
+ npm run build # production bundle -> dist/cli.js (web assets included)
136
+ node dist/cli.js --port 6996
137
+ ```
138
+
139
+ Frontend hot-reload: `cd web && npm run dev` (proxies `/api` and `/v1` to the daemon on
140
+ :6996).
141
+
142
+ ### Layout
143
+
144
+ ```
145
+ turbollm/
146
+ package.json npm package; bin "turbollm" -> bin/turbollm.mjs -> dist/cli.js
147
+ src/
148
+ cli.ts entrypoint: wiring + graceful shutdown
149
+ server.ts Hono app: CORS, API, gateway, embedded SPA
150
+ config/ config schema + load/save/migrate
151
+ engines/ provisioning, probe, registry, lifecycle state machine
152
+ api/routes.ts /api/v1/* handlers
153
+ gateway/ /v1/* OpenAI + Anthropic gateway
154
+ webdist/ built web UI (generated; served by the daemon)
155
+ web/ React 19 + TS + Tailwind v4 + shadcn frontend (own package.json)
156
+ ```
157
+
158
+ ## License
159
+
160
+ Source-available under the **Functional Source License 1.1 (Apache 2.0 future grant)** —
161
+ SPDX `FSL-1.1-ALv2`. Free for personal use, internal business use, education, and research;
162
+ the only restriction is shipping a competing product. Each release converts to Apache-2.0
163
+ two years after it's published. Full text in [LICENSE.md](LICENSE.md).
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ // Hand-written launcher shim — NOT bundled by tsup. It runs before the bundled
3
+ // daemon (dist/cli.js) loads, so it can do two things that must happen before
4
+ // node:sqlite is imported (the bundle hoists that import, emitting an experimental
5
+ // warning that PowerShell renders as a scary red error block on every run):
6
+ // 1. Guard the Node version with a friendly message (node:sqlite needs Node 22+).
7
+ // 2. Register a 'warning' filter that swallows the node:sqlite experimental notice
8
+ // while still printing every other warning.
9
+ // Then it hands off to the real CLI via dynamic import (same process; argv intact).
10
+ const major = Number(process.versions.node.split('.')[0])
11
+ if (major < 22) {
12
+ process.stderr.write(
13
+ `TurboLLM requires Node.js 22 or newer.\n` +
14
+ `You are running Node.js ${process.versions.node}.\n` +
15
+ `Please upgrade: https://nodejs.org\n`,
16
+ )
17
+ process.exit(1)
18
+ }
19
+
20
+ process.on('warning', (w) => {
21
+ if (w.name === 'ExperimentalWarning' && /SQLite/i.test(w.message)) return
22
+ process.stderr.write(`${w.stack ?? `${w.name}: ${w.message}`}\n`)
23
+ })
24
+
25
+ await import('../dist/cli.js')