gliana-provider 0.0.0-stage → 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 +21 -0
- package/README.md +69 -2
- package/bin/gliana-provider.mjs +159 -0
- package/lib.mjs +102 -0
- package/package.json +13 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PT Glianalabs Algoritma Desentralisasi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,70 @@
|
|
|
1
|
-
#
|
|
1
|
+
# gliana-provider
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Sell inference from your own GPU on [GlianaAI](https://ai.glianalabs.com). The app opens one outbound connection to
|
|
4
|
+
GlianaAI and serves its chat requests from a model server on your machine. No public IP, no open port.
|
|
5
|
+
|
|
6
|
+
## 1. Start a local model server
|
|
7
|
+
|
|
8
|
+
Any server with the OpenAI `/v1/chat/completions` API works:
|
|
9
|
+
|
|
10
|
+
| Server | Best for | Default address |
|
|
11
|
+
|---|---|---|
|
|
12
|
+
| vLLM | NVIDIA GPUs, many requests at once (fastest) | http://127.0.0.1:8000/v1 |
|
|
13
|
+
| SGLang | NVIDIA GPUs | http://127.0.0.1:30000/v1 |
|
|
14
|
+
| Ollama | Macs, Windows, laptops | http://127.0.0.1:11434/v1 |
|
|
15
|
+
| llama.cpp server | CPU or small GPUs | http://127.0.0.1:8080/v1 |
|
|
16
|
+
| LM Studio | desktop | http://127.0.0.1:1234/v1 |
|
|
17
|
+
|
|
18
|
+
Serve the weights of a model GlianaAI sells (see https://ai.glianalabs.com/models), for example Qwen3.8 27B or
|
|
19
|
+
Gemma 4 26B A4B.
|
|
20
|
+
|
|
21
|
+
## 2. Get a provider token
|
|
22
|
+
|
|
23
|
+
dashboard.glianalabs.com → **Model provider** → **Sell from your own GPU** → **Create token**. It is shown once.
|
|
24
|
+
|
|
25
|
+
## 3. Run
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx gliana-provider start --token gp_... \
|
|
29
|
+
--model qwen3.8-27b=<your server's model name> --save
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- `--model <catalog id>=<local name>[:<input $/1M>:<output $/1M>]`, repeatable. Without prices, half of the model's
|
|
33
|
+
public price is used. A price above GlianaAI's own cost for the model is refused.
|
|
34
|
+
- `--server <url>` if your server is not on a default address; `--concurrency N` (default 8, Ollama 2);
|
|
35
|
+
`--precision bf16|fp8|int4`.
|
|
36
|
+
- `--save` keeps the options in `~/.gliana-provider.json`; next time `npx gliana-provider start` is enough.
|
|
37
|
+
|
|
38
|
+
Requires Node.js 22 or newer.
|
|
39
|
+
|
|
40
|
+
## What happens next
|
|
41
|
+
|
|
42
|
+
Each model goes through GlianaAI's checks before it gets traffic: speed (at least 8 tokens/s), the masking check
|
|
43
|
+
(its tokenizer matches the real model), the env-grabber bait test and the knowledge check (it answers obscure
|
|
44
|
+
questions like the real model, which also catches heavy quantization). Passing models go live; the app prints the
|
|
45
|
+
result. The checks repeat every few days, and their results are public on each model's page.
|
|
46
|
+
|
|
47
|
+
You are paid in USDC for the tokens you serve, at your price; payouts start at $5 from the dashboard. You are bound
|
|
48
|
+
by the seller terms (https://ai.glianalabs.com/terms/provider): prompts may not be stored, logged or used. This app
|
|
49
|
+
never logs prompt text.
|
|
50
|
+
|
|
51
|
+
## How it works
|
|
52
|
+
|
|
53
|
+
The app opens one WebSocket to `wss://api.glianalabs.com/v1/provider/connect` (protocol `gliana-provider.v1`, your
|
|
54
|
+
token as the second subprotocol) and exchanges JSON messages:
|
|
55
|
+
|
|
56
|
+
- app to GlianaAI: `hello` (models, prices, concurrency), `ping`, then for each request `head`, `chunk`... and `end`
|
|
57
|
+
(or `error`);
|
|
58
|
+
- GlianaAI to app: `request` (an OpenAI chat request for your local server), `cancel`, `hello_ok`, `admission`,
|
|
59
|
+
`pong`.
|
|
60
|
+
|
|
61
|
+
Each request is forwarded to your local server as is and the answer is streamed back. Nothing else on your machine
|
|
62
|
+
is touched, and no prompt or answer text is written to disk or to the log. The whole app is `bin/gliana-provider.mjs`
|
|
63
|
+
and `lib.mjs`, with no dependencies.
|
|
64
|
+
|
|
65
|
+
## Development
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npm test # node --test, no dependencies
|
|
69
|
+
node bin/gliana-provider.mjs --help
|
|
70
|
+
```
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// gliana-provider: sell inference from your own GPU on GlianaAI (docs/plans/gliana-provider.md in gliana-ai).
|
|
3
|
+
// Holds one outbound WebSocket to the gateway and serves its requests from a local OpenAI-compatible server
|
|
4
|
+
// (vLLM recommended on NVIDIA; Ollama, llama.cpp, SGLang and LM Studio work too). No public IP, no open port.
|
|
5
|
+
// Prompt text is never logged.
|
|
6
|
+
import { readFileSync, writeFileSync, existsSync } from 'node:fs';
|
|
7
|
+
import { homedir } from 'node:os';
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
import { DEFAULT_GATEWAY, PROTOCOL, backoff, defaultPrice, detectServer, helloMessage, parseArgs } from '../lib.mjs';
|
|
10
|
+
|
|
11
|
+
const VERSION = '0.1.0';
|
|
12
|
+
const CONFIG = join(homedir(), '.gliana-provider.json');
|
|
13
|
+
|
|
14
|
+
const HELP = `gliana-provider ${VERSION}: sell inference from your own GPU on GlianaAI
|
|
15
|
+
|
|
16
|
+
Usage:
|
|
17
|
+
gliana-provider start --token gp_... --model <catalog id>=<local model>[:<in $/1M>:<out $/1M>] [options]
|
|
18
|
+
|
|
19
|
+
Options:
|
|
20
|
+
--token gp_... provider token from the dashboard (Model provider -> Sell from your own GPU)
|
|
21
|
+
--model id=local a catalog model and your server's name for it, e.g.
|
|
22
|
+
--model qwen3.8-27b=Qwen/Qwen3.8-27B:0.30:2.00 (repeatable; prices optional)
|
|
23
|
+
--server URL your local server's /v1 URL (default: find vLLM, SGLang, Ollama, llama.cpp, LM Studio)
|
|
24
|
+
--concurrency N requests at once (default 8, Ollama 2)
|
|
25
|
+
--precision P bf16 | fp8 | int4 ... (shown to GlianaAI; the knowledge check decides)
|
|
26
|
+
--save remember these options in ~/.gliana-provider.json
|
|
27
|
+
|
|
28
|
+
Prices are USD per 1M tokens and must be at most GlianaAI's own cost for the model; without one, half of
|
|
29
|
+
the model's public price is used. Each model must pass GlianaAI's checks (speed, masking, knowledge, bait)
|
|
30
|
+
before it gets traffic.`;
|
|
31
|
+
|
|
32
|
+
const log = (...a) => console.log(new Date().toISOString().slice(11, 19), ...a);
|
|
33
|
+
|
|
34
|
+
async function main() {
|
|
35
|
+
const args = parseArgs(process.argv.slice(2));
|
|
36
|
+
if (args.command !== 'start') {
|
|
37
|
+
console.log(HELP);
|
|
38
|
+
process.exit(args.command === 'help' ? 0 : 1);
|
|
39
|
+
}
|
|
40
|
+
if (typeof WebSocket === 'undefined') {
|
|
41
|
+
console.error('Node 22 or newer is needed (built-in WebSocket).');
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
const saved = existsSync(CONFIG) ? JSON.parse(readFileSync(CONFIG, 'utf8')) : {};
|
|
45
|
+
const opts = { ...saved, ...Object.fromEntries(Object.entries(args).filter(([k, v]) => v !== undefined && !(k === 'models' && !v.length))) };
|
|
46
|
+
if (args.badModel) return fail(`Could not read --model ${args.badModel}. Use id=local or id=local:in:out.`);
|
|
47
|
+
if (!/^gp_[0-9a-f]{40}$/.test(opts.token ?? '')) return fail('Give your provider token: --token gp_... (dashboard -> Model provider).');
|
|
48
|
+
if (!opts.models?.length) return fail('Name at least one model: --model qwen3.8-27b=<your server\'s model name>.');
|
|
49
|
+
|
|
50
|
+
const server = await detectServer(opts.server);
|
|
51
|
+
if (!server) return fail(`No local server answered${opts.server ? ` at ${opts.server}` : ' (tried vLLM :8000, SGLang :30000, Ollama :11434, llama.cpp :8080, LM Studio :1234)'}.`);
|
|
52
|
+
log(`local server: ${server.name} at ${server.url} (${server.models.length} models)`);
|
|
53
|
+
for (const m of opts.models) {
|
|
54
|
+
if (server.models.length && !server.models.includes(m.upstream)) log(`warning: ${server.name} does not list "${m.upstream}" (it lists: ${server.models.slice(0, 6).join(', ')})`);
|
|
55
|
+
}
|
|
56
|
+
// Prices: as given, else half the public price.
|
|
57
|
+
const missing = opts.models.filter((m) => m.input === undefined);
|
|
58
|
+
if (missing.length) {
|
|
59
|
+
const catalog = await fetch('https://api.glianalabs.com/v1/models').then((r) => r.json()).catch(() => null);
|
|
60
|
+
for (const m of missing) {
|
|
61
|
+
const p = defaultPrice(catalog, m.model);
|
|
62
|
+
if (!p) return fail(`${m.model} is not a chat model GlianaAI sells. See https://ai.glianalabs.com/models`);
|
|
63
|
+
Object.assign(m, p);
|
|
64
|
+
log(`${m.model}: price $${p.input} / $${p.output} per 1M (half the public price)`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
opts.serverName = server.name;
|
|
68
|
+
if (args.save) {
|
|
69
|
+
const { save, command, badModel, ...keep } = opts;
|
|
70
|
+
writeFileSync(CONFIG, JSON.stringify(keep, null, 2), { mode: 0o600 });
|
|
71
|
+
log(`saved to ${CONFIG}`);
|
|
72
|
+
}
|
|
73
|
+
run(opts, server.url);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function fail(msg) {
|
|
77
|
+
console.error(msg);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function run(opts, local) {
|
|
82
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY;
|
|
83
|
+
const inflight = new Map(); // id -> AbortController
|
|
84
|
+
let attempt = 0;
|
|
85
|
+
let served = 0;
|
|
86
|
+
let tokensOut = 0;
|
|
87
|
+
|
|
88
|
+
const connect = () => {
|
|
89
|
+
const ws = new WebSocket(gateway, [PROTOCOL, opts.token]);
|
|
90
|
+
let ping;
|
|
91
|
+
ws.onopen = () => {
|
|
92
|
+
attempt = 0;
|
|
93
|
+
log(`connected to ${gateway}`);
|
|
94
|
+
ws.send(JSON.stringify(helloMessage(opts, VERSION)));
|
|
95
|
+
ping = setInterval(() => ws.readyState === 1 && ws.send(JSON.stringify({ type: 'ping' })), 20_000);
|
|
96
|
+
};
|
|
97
|
+
ws.onmessage = async (ev) => {
|
|
98
|
+
let msg;
|
|
99
|
+
try {
|
|
100
|
+
msg = JSON.parse(typeof ev.data === 'string' ? ev.data : Buffer.from(ev.data).toString());
|
|
101
|
+
} catch {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (msg.type === 'hello_ok') {
|
|
105
|
+
log(`serving: ${msg.kept.join(', ') || 'nothing'}`);
|
|
106
|
+
for (const [m, why] of Object.entries(msg.refused ?? {})) log(`refused ${m}: ${why}`);
|
|
107
|
+
log('checks running (speed, masking, bait, knowledge)...');
|
|
108
|
+
} else if (msg.type === 'admission') {
|
|
109
|
+
for (const r of msg.results ?? []) log(`${r.model}: ${r.ok ? `LIVE (${r.tps} tokens/s)` : `not live: ${r.why}`}`);
|
|
110
|
+
} else if (msg.type === 'cancel') {
|
|
111
|
+
inflight.get(msg.id)?.abort();
|
|
112
|
+
} else if (msg.type === 'request') {
|
|
113
|
+
serve(ws, msg);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
ws.onclose = (ev) => {
|
|
117
|
+
clearInterval(ping);
|
|
118
|
+
for (const ac of inflight.values()) ac.abort();
|
|
119
|
+
inflight.clear();
|
|
120
|
+
const wait = backoff(attempt++);
|
|
121
|
+
log(`disconnected (${ev.code}${ev.reason ? ` ${ev.reason}` : ''}); reconnecting in ${Math.round(wait / 1000)} s${attempt > 3 ? '. If this repeats, check your token in the dashboard.' : ''}`);
|
|
122
|
+
setTimeout(connect, wait);
|
|
123
|
+
};
|
|
124
|
+
ws.onerror = () => undefined; // onclose follows
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
async function serve(ws, msg) {
|
|
128
|
+
const ac = new AbortController();
|
|
129
|
+
inflight.set(msg.id, ac);
|
|
130
|
+
const send = (m) => ws.readyState === 1 && ws.send(JSON.stringify({ ...m, id: msg.id }));
|
|
131
|
+
try {
|
|
132
|
+
const res = await fetch(`${local}${msg.path}`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: msg.body, signal: ac.signal });
|
|
133
|
+
send({ type: 'head', status: res.status, contentType: res.headers.get('content-type') ?? 'application/json' });
|
|
134
|
+
const reader = res.body.getReader();
|
|
135
|
+
const dec = new TextDecoder();
|
|
136
|
+
let tail = '';
|
|
137
|
+
for (;;) {
|
|
138
|
+
const { done, value } = await reader.read();
|
|
139
|
+
if (done) break;
|
|
140
|
+
const text = dec.decode(value, { stream: true });
|
|
141
|
+
tail = (tail + text).slice(-2000);
|
|
142
|
+
send({ type: 'chunk', data: text });
|
|
143
|
+
}
|
|
144
|
+
send({ type: 'end' });
|
|
145
|
+
served++;
|
|
146
|
+
const m = tail.match(/"completion_tokens"\s*:\s*(\d+)/g);
|
|
147
|
+
if (m) tokensOut += Number(m.at(-1).replace(/\D/g, ''));
|
|
148
|
+
if (served % 25 === 0) log(`${served} requests served, ~${tokensOut} output tokens`);
|
|
149
|
+
} catch (e) {
|
|
150
|
+
send({ type: 'error', message: ac.signal.aborted ? 'cancelled' : `local server: ${String(e?.message ?? e).slice(0, 60)}` });
|
|
151
|
+
} finally {
|
|
152
|
+
inflight.delete(msg.id);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
connect();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
main();
|
package/lib.mjs
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// gliana-provider: the pure parts (arguments, config, server detection, prices), kept apart from the network loop so
|
|
2
|
+
// they can be tested. No dependencies: Node 22+ has fetch and WebSocket built in.
|
|
3
|
+
|
|
4
|
+
/** Local servers that speak the OpenAI API, tried in this order when --server is not given. */
|
|
5
|
+
export const KNOWN_SERVERS = [
|
|
6
|
+
{ name: 'vllm', url: 'http://127.0.0.1:8000/v1' },
|
|
7
|
+
{ name: 'sglang', url: 'http://127.0.0.1:30000/v1' },
|
|
8
|
+
{ name: 'ollama', url: 'http://127.0.0.1:11434/v1' },
|
|
9
|
+
{ name: 'llama.cpp', url: 'http://127.0.0.1:8080/v1' },
|
|
10
|
+
{ name: 'lm-studio', url: 'http://127.0.0.1:1234/v1' },
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
export const DEFAULT_GATEWAY = 'wss://api.glianalabs.com/v1/provider/connect';
|
|
14
|
+
export const PROTOCOL = 'gliana-provider.v1';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Command line to options. Models: --model <catalog id>=<local name>[:<input $/1M>:<output $/1M>], repeatable.
|
|
18
|
+
* Example: --model qwen3.8-27b=Qwen/Qwen3.8-27B:0.30:2.00
|
|
19
|
+
*/
|
|
20
|
+
export function parseArgs(argv) {
|
|
21
|
+
const out = { command: argv[0] && !argv[0].startsWith('-') ? argv[0] : 'help', models: [] };
|
|
22
|
+
const rest = out.command === 'help' ? argv : argv.slice(1);
|
|
23
|
+
for (let i = 0; i < rest.length; i++) {
|
|
24
|
+
const a = rest[i];
|
|
25
|
+
const next = () => rest[++i];
|
|
26
|
+
if (a === '--token') out.token = next();
|
|
27
|
+
else if (a === '--server') out.server = next();
|
|
28
|
+
else if (a === '--gateway') out.gateway = next();
|
|
29
|
+
else if (a === '--concurrency') out.concurrency = Number(next());
|
|
30
|
+
else if (a === '--precision') out.precision = next();
|
|
31
|
+
else if (a === '--save') out.save = true;
|
|
32
|
+
else if (a === '--model') {
|
|
33
|
+
const m = parseModel(next());
|
|
34
|
+
if (m) out.models.push(m);
|
|
35
|
+
else out.badModel = rest[i];
|
|
36
|
+
} else if (a === '--help' || a === '-h') out.command = 'help';
|
|
37
|
+
}
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** "id=local[:in:out]" to {model, upstream, input?, output?}, or null. */
|
|
42
|
+
export function parseModel(s) {
|
|
43
|
+
if (typeof s !== 'string') return null;
|
|
44
|
+
const eq = s.indexOf('=');
|
|
45
|
+
if (eq <= 0) return null;
|
|
46
|
+
const model = s.slice(0, eq).trim();
|
|
47
|
+
const rest = s.slice(eq + 1);
|
|
48
|
+
// The local name may itself contain ':' (Ollama tags like qwen3:27b), so prices are the LAST two fields if numeric.
|
|
49
|
+
const parts = rest.split(':');
|
|
50
|
+
let input;
|
|
51
|
+
let output;
|
|
52
|
+
if (parts.length >= 3 && isNum(parts.at(-1)) && isNum(parts.at(-2))) {
|
|
53
|
+
output = Number(parts.pop());
|
|
54
|
+
input = Number(parts.pop());
|
|
55
|
+
}
|
|
56
|
+
const upstream = parts.join(':').trim();
|
|
57
|
+
if (!model || !upstream) return null;
|
|
58
|
+
return { model, upstream, ...(input !== undefined ? { input, output } : {}) };
|
|
59
|
+
}
|
|
60
|
+
const isNum = (v) => v !== undefined && v !== '' && Number.isFinite(Number(v));
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* A default price when none was given: half of what GlianaAI charges buyers for the model (its public list price,
|
|
64
|
+
* margin included), which is always under the gateway's cap (our own route's cost). Null when the model is unknown.
|
|
65
|
+
*/
|
|
66
|
+
export function defaultPrice(catalog, modelId) {
|
|
67
|
+
const m = (catalog?.models ?? []).find((x) => x.id === modelId);
|
|
68
|
+
if (!m?.inMicroPerMTok || !m?.outMicroPerMTok) return null;
|
|
69
|
+
const half = (micro) => Math.floor(micro / 2) / 1e6;
|
|
70
|
+
return { input: half(m.inMicroPerMTok), output: half(m.outMicroPerMTok) };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** The hello the app sends after connecting. */
|
|
74
|
+
export function helloMessage(opts, version) {
|
|
75
|
+
return {
|
|
76
|
+
type: 'hello',
|
|
77
|
+
models: opts.models.map((m) => ({ model: m.model, upstream: m.upstream, input: m.input, output: m.output, precision: m.precision ?? opts.precision ?? '' })),
|
|
78
|
+
concurrency: Math.max(1, Math.min(64, Math.floor(opts.concurrency || (opts.serverName === 'ollama' ? 2 : 8)))),
|
|
79
|
+
server: opts.serverName ?? '',
|
|
80
|
+
version,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Find a running local server: the given URL, or the first known one whose /models answers. */
|
|
85
|
+
export async function detectServer(given, fetcher = fetch) {
|
|
86
|
+
const list = given ? [{ name: guessName(given), url: given.replace(/\/$/, '') }] : KNOWN_SERVERS;
|
|
87
|
+
for (const s of list) {
|
|
88
|
+
try {
|
|
89
|
+
const res = await fetcher(`${s.url}/models`, { signal: AbortSignal.timeout(1500) });
|
|
90
|
+
if (!res.ok) continue;
|
|
91
|
+
const j = await res.json();
|
|
92
|
+
return { ...s, models: (j?.data ?? []).map((d) => d.id).filter(Boolean) };
|
|
93
|
+
} catch {
|
|
94
|
+
/* not running */
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
const guessName = (url) => KNOWN_SERVERS.find((s) => url.includes(new URL(s.url).port))?.name ?? 'custom';
|
|
100
|
+
|
|
101
|
+
/** Exponential reconnect delay, 1 s doubling to 30 s. */
|
|
102
|
+
export const backoff = (attempt) => Math.min(30_000, 1000 * 2 ** Math.min(attempt, 5));
|
package/package.json
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gliana-provider",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
}
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Sell inference from your own GPU on GlianaAI: one outbound connection, serves from vLLM, Ollama, llama.cpp, SGLang or LM Studio.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": { "gliana-provider": "bin/gliana-provider.mjs" },
|
|
7
|
+
"files": ["bin", "lib.mjs", "README.md", "LICENSE"],
|
|
8
|
+
"scripts": { "test": "node --test test/*.test.mjs" },
|
|
9
|
+
"engines": { "node": ">=22" },
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"repository": { "type": "git", "url": "git+https://github.com/Gliana-Labs/gliana-provider.git" },
|
|
12
|
+
"homepage": "https://github.com/Gliana-Labs/gliana-provider#readme",
|
|
13
|
+
"bugs": { "url": "https://github.com/Gliana-Labs/gliana-provider/issues" },
|
|
14
|
+
"keywords": ["gliana", "inference", "vllm", "ollama", "gpu", "llm", "provider"]
|
|
15
|
+
}
|