new tasks, devnet topup, cli, new model support

This commit is contained in:
Dobromir Popov
2026-07-06 14:17:36 +03:00
parent f841dfaeed
commit b547034741
24 changed files with 1298 additions and 63 deletions

View File

@@ -54,6 +54,7 @@ on the host firewall if other machines will join:
```bash
.venv/bin/meshnet-tracker start --host 0.0.0.0 --port 8080
# --starting-credit 1 --devnet-topup 10
```
Verify from the tracker host:
@@ -514,6 +515,7 @@ Send inference through the tracker (which picks the head node and injects the ro
```bash
curl -s https://ai.neuron.d-popov.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-mesh-<your-key>" \
-d '{
"model": "Qwen/Qwen2.5-0.5B-Instruct",
"messages": [{"role": "user", "content": "What is 7 times 8?"}],
@@ -529,6 +531,47 @@ curl -s http://localhost:7001/v1/chat/completions \
-d '{"model": "Qwen/Qwen2.5-0.5B-Instruct", "messages": [{"role": "user", "content": "Hi"}]}'
```
## Accounts, API keys, and credit (billing-enabled trackers)
Public trackers run with billing on: `/v1/chat/completions` requires a real
API key from a registered account. Unknown bearer strings get `401`; a key
with no balance gets `402 insufficient balance`.
**Dashboard flow (easiest):** open `https://<tracker>/dashboard`, register with
an email + password, then click **+ new key**. The key (`sk-mesh-…`) shows its
balance next to it. If the tracker was started with `--starting-credit`, your
first key arrives pre-funded (Caller Credit, once per account). If it was
started with `--devnet-topup`, every key row has a **+$N (devnet)** button to
refill during testing.
**Curl flow:**
```bash
# 1. Register (once)
curl -s https://<tracker>/v1/auth/register \
-H "Content-Type: application/json" \
-d '{"email": "you@example.com", "password": "hunter22-or-better"}'
# → {"session_token": "...", ...}
# 2. Create an API key (session token from step 1)
curl -s https://<tracker>/v1/account/keys -X POST \
-H "Authorization: Bearer <session_token>"
# → {"api_key": "sk-mesh-...", "caller_credit_granted": true}
# 3. Check balance / usage
curl -s https://<tracker>/v1/account -H "Authorization: Bearer <session_token>"
# 4. (devnet trackers only) top up a key
curl -s https://<tracker>/v1/account/topup -X POST \
-H "Authorization: Bearer <session_token>" \
-H "Content-Type: application/json" \
-d '{"api_key": "sk-mesh-..."}'
```
Operator side: both features default to 1 USDT (`--starting-credit` /
`--devnet-topup`). Set both to 0 on mainnet deployments — real deposits flow
through the on-chain USDT treasury watcher instead.
---
## Step 1 — Start the tracker (Terminal 1)