GPU API
Send training jobs to the Liv.Fit GPU server with your own key. You send Python files; the server queues them, runs them on a GPU, and keeps the output for you to read. Live queue: GPU status.
Start in three steps
- Ask an admin to add you. You get two things, each shown once: a key that starts with
lgk_for the API, and a first password for the GPU status page (your name is the sign-in name). Treat both like passwords, and change the password after your first sign-in. - Get the command (one Python file, nothing to install) and save your key:
curl -fsSL https://scan.liv.fit/gpuapi/livgpu.py -o livgpu && chmod +x livgpu ./livgpu login # paste your key; it is kept in ~/.config/livgpu/key, readable only by you ./livgpu me # your limits, credits and what you have used ./livgpu credits # your balance and what each job cost
- Send a job and follow it:
./livgpu submit train.py model.py --gpus 1 --hours 2 --what "ResNet baseline" -- --epochs 30 ./livgpu logs train-1127-1830 -f ./livgpu jobs
What a job is
- Files, not commands. You send up to 40 text files, 2 MB together, with no folders. The server runs
python3 <first file> <your arguments>. Arguments are passed as plain values; no shell reads them. - A time limit. Every job states the most hours it may run (
max_hours, up to 72). At the limit it is stopped. GPU-hours are counted as hours run × GPUs. - Its own folder. The job starts in a folder of its own and may write only there. Put checkpoints in
$LIVJOBS_CKPT. Print what you want to read: the output is kept as the job's log. - Data. Datasets are read-only under
$LIVGPU_DATA, one folder each. You see the ones your key's data label allows. Pretrained torchvision weights already on the server load as usual. - Python. The server's shared environment: Python 3.12, PyTorch with CUDA, torchvision, timm, numpy, pyarrow, OpenCV. You cannot install packages from inside a job.
- GPU. The job sees only the cards it was given (
CUDA_VISIBLE_DEVICES). Usecudaorcuda:0, never a fixed card number of the server.
What a job cannot do
Jobs run boxed in. This protects the other services on the server and everyone else's work.
- It does not run as root. It gets a throwaway user that exists only while the job runs.
- The system is read-only. Home folders, websites, logs, other services and their settings are not visible at all.
- No network, unless an admin turned it on for your key. Downloading a dataset or weights inside a job will fail: ask an admin to add them to the server.
- Memory, CPU and time are capped at what the job asked for.
- It cannot see other people's jobs, files or logs.
Approval and scheduling
| Key setting | What happens when you send a job |
|---|---|
approve | It waits as “Needs approval” until an admin approves or rejects it. New keys start here. |
auto | It joins the queue at once. |
auto_under | Jobs up to a set number of GPU-hours join the queue at once; larger ones wait for approval. |
- Order. Higher priority first, then whoever used the GPU least in the last 24 hours, then the oldest job. One person cannot fill the queue ahead of everyone.
- Timed jobs.
not_beforeholds a job until a time (--at "2026-11-28 22:00", your local time). - Repeating jobs.
repeat_secruns the job again that long after each start (--every 24h, at least 10 minutes). Runs are namedname.r2,name.r3… Cancel the waiting run to end the series. - Chains.
dependslists your own jobs that must finish first (--after other-job). If one of them fails, the job is blocked. - Several GPUs. Ask for the number of cards you need and, if you know it, the memory per card (
gpu_mem_gb). The scheduler gives the job the free cards with most memory, on the server that has most cards free.
Credits and metering
- GPU time costs credits. The price is a number of credits for one GPU-hour, set by an admin and shown by
livgpu me. A job on two cards for one hour is two GPU-hours. - Held when sent, charged for what ran. When you send a job, credits for its full time limit are held. When it ends you are charged only for the time it really ran, to the second, and the rest is free again. A job that never started costs nothing.
- Not enough credits. The job is refused with the amount it could cost and what you have. Ask an admin for more, or lower
max_hours. - Two limits. Credits are your budget. The GPU-hours limit over 30 days is a separate ceiling an admin sets per person.
- What is counted. Every request with your key or one of your tokens, per day, per token and per address, and every sign-in. You see your own numbers on the GPU status page; admins see everyone's.
- Tokens. Besides your first key you can make up to 20 named tokens on the GPU status page, for example one per laptop or script, each with its own end date. Revoke one without touching the others.
Environments: a task with a score
An environment is a task set up for agents and people to improve a model step by step: data you may read, one answer file to write, and a scorer that grades it against answers you never see. Send a run, read the score, change the code, send again.
- Data. A run in an environment sees only that environment's folders under
$LIVGPU_DATA. The test items are there without their answers. - Answer file. Write the file the environment names into
$LIVGPU_OUT. When the job ends, the scorer reads it and the job showsscore. If the file is missing or malformed the job shows why instead. - Two halves. The score you see is measured on one half of the hidden items. Admins also see the other half, so a model tuned to the visible score and nothing else is noticed.
- Limits. Each environment sets the most hours and GPUs a run may use, and how many runs a day one person may send.
- Starter. Every environment ships a small working example. Start from it.
./livgpu envs # the environments your key may use ./livgpu env food-kcal --starter ./food # the task, the ranking, and a working example saved to ./food ./livgpu submit food/starter.py --env food-kcal --what "first try" ./livgpu jobs # the score appears in the job's note when it ends
Any product can add an environment: a folder with env.json, score.py and a starter, described in the GPUswarm repository (docs/ENVIRONMENTS.md).
HTTP reference
Base address https://scan.liv.fit/gpu/api. Every request carries Authorization: Bearer lgk_…. Bodies and answers are JSON. Limits: 120 requests a minute per key, 2.5 MB per request.
| Request | What it does |
|---|---|
GET /me | Your settings, credits, the price of a GPU-hour, GPU-hours and requests used. |
GET /ledger | Your balance and the last 200 charges and top-ups. |
POST /jobs | Send a job. Answer: { ok, name, state } where state is queued or pending. |
GET /jobs | All your jobs. |
GET /jobs/<name> | One job: state, times, exit code, note. |
GET /jobs/<name>/logs?bytes=20000 | The end of the job's output (up to 200,000 bytes). |
POST /jobs/<name>/cancel | Cancel a waiting job, or stop a running one. |
GET /envs | The environments your key may use, with the best score and your own best. |
GET /envs/<name> | One environment: task, data folders, answer file, limits, baselines, starter files, ranking, your runs. |
Fields of POST /jobs
| Field | Type | Default | Meaning |
|---|---|---|---|
name | text | required | Your name for the job: letters, digits, . _ - up to 40. Must be new. |
files | object | required | File name → file text. At most 40 files, 2 MB together, no folders. |
entry | text | main.py | The file to run. Must be one of the files and end in .py. |
args | list | [] | Arguments for your script, at most 60. |
gpus | number | 1 | Cards the job needs, 0 to 8. |
max_hours | number | 1 | The most hours it may run, up to 72. Counts against your limit while it waits. |
gpu_mem_gb | number | – | GPU memory per card the job needs. Lets small jobs share a card. |
mem_gb | number | 16 | Main memory, 0.5 to 56 GB. |
label | text | open | Data the job uses: open, licensed or private. Must be allowed for your key. |
what | text | – | One line shown on the GPU page. |
env | text | – | Run in this environment. It sets the data and the limits; label is ignored and repeat_sec is refused. |
not_before | number | – | Unix time before which the job must not start. |
repeat_sec | number | – | Run again this many seconds after each start, at least 600. |
depends | list | [] | Names of your own jobs that must finish first. |
curl -s https://scan.liv.fit/gpu/api/jobs \
-H "Authorization: Bearer $LIVGPU_KEY" -H "content-type: application/json" \
-d '{"name":"hello","files":{"main.py":"import torch; print(torch.cuda.get_device_name(0))"},"gpus":1,"max_hours":0.1}'
# {"ok": true, "name": "hello", "state": "queued"}
curl -s https://scan.liv.fit/gpu/api/jobs/hello/logs -H "Authorization: Bearer $LIVGPU_KEY"Job states
| State | Meaning |
|---|---|
| pending | Waits for an admin to approve it. |
| queued | Approved and waiting for a free GPU, its start time, or the jobs it depends on. |
| held | An admin paused it in the queue. |
| running | On a GPU now. |
| done | Ended with exit code 0. |
| failed | Ended with another exit code, or its worker stopped answering. The note says which. |
| cancelled | Cancelled by you or an admin, rejected, stopped at its time limit, or its key was revoked. |
| blocked | A job it depends on did not finish. |
When a request is refused
| Code | Why |
|---|---|
| 400 | Something in the request is wrong. The answer's error line says what: a bad name, not enough credits, a job over your GPU-hours limit, data your key may not use, more than 30 jobs waiting. |
| 401 | No key, a malformed key, or a revoked key. |
| 404 | No such job among your own, or an address this API does not have. |
| 413 | The request is larger than 2.5 MB. |
| 429 | More than 120 requests in a minute. Wait a minute. |
| 503 | The scheduler is not answering. Try again shortly. |
For admins
- Sign in on GPU status with your admin name and password. Admins are made on the server only:
livjobs admin-add <name>asks for the password at a prompt. - The “People” panel adds a person (their key and first password are shown once), sets approval, limits and data, adds credits, makes and revokes tokens, gives a new password, and revokes all access. It shows each person's credits, GPU-hours, requests, sign-ins and number of addresses.
- The queue shows Approve and Reject on jobs that wait. The price of a GPU-hour is set at the top of the People panel.
- Revoking a person stops their waiting and running jobs at once. Five wrong passwords lock a name for 15 minutes.
- Every key change, approval and job is written to the scheduler's audit log with who did it.
- On the server itself:
livjobs keys,key-add,key-set,key-revoke,approve,reject,credit,rate,usage,admins,audit.