Documentation
Overview
Plinth has two halves. The web app (this site) serves the studio and a small HTTP API. The GPU worker runs the 3D model on a rented GPU. The web app talks to the worker over HTTPS with a bearer token. With no worker configured, the web app answers with a built-in demo engine that returns placeholder shapes, so the whole flow works before a GPU is connected.
A job is created, then polled, then its GLB is fetched. Nothing is kept on the web server.
The web API
POST /api/generate starts a job. Text mode needs prompt (up to 500 characters). Image mode needs image, a PNG, JPEG or WebP data URL up to about 8 MB. Optional: quality (fast, balanced, fine), faces (one of 50000, 100000, 300000, 500000, 1000000), textureSize (one of 1024, 2048, 4096), seed, removeBackground.
curl -X POST http://localhost:3000/api/generate \
-H "content-type: application/json" \
-d '{ "mode": "text", "prompt": "a ceramic vase with a blue glaze", "quality": "balanced" }'
# -> { "id": "b3c1e0f2a9d84c7e" }GET /api/jobs/{id} reports the job. Poll about once a second.
curl http://localhost:3000/api/jobs/b3c1e0f2a9d84c7e
# -> {
# "id": "b3c1e0f2a9d84c7e",
# "state": "running", // queued | running | done | failed | cancelled
# "stage": "shape", // queued | prepare | shape | texture | export | done
# "progress": 0.41,
# "queuePosition": 0
# }GET /api/jobs/{id}/model returns the finished GLB. DELETE /api/jobs/{id} cancels. GET /api/health says whether a worker is connected and what it reports.
curl -o vase.glb http://localhost:3000/api/jobs/b3c1e0f2a9d84c7e/modelLimits and errors
| Status | Meaning |
|---|---|
| 400 | The request is not valid. The error field says which part. |
| 404 | Unknown job, or the worker already deleted it (results are kept for an hour). |
| 429 | Over the per-visitor hourly limit. The retry-after header says how long to wait. |
| 502 / 503 / 504 | The GPU worker is busy, answered something unexpected, or did not answer in time. |
The hourly limit is per address and kept in memory, so it resets when the web app restarts. It protects rented GPU time from one noisy client; put accounts or a real rate limiter in front before the site is public.
The worker contract
Any server that answers these four routes can be the GPU side. The reference worker in worker/server.py implements them with TRELLIS.2. Every request carries Authorization: Bearer <token>, and the worker must refuse anything without it.
POST /v1/jobs Authorization: Bearer <WORKER_TOKEN>
{
"mode": "text" | "image",
"prompt": "a ceramic vase", // text mode
"image": "data:image/png;base64,...", // image mode
"resolution": 512 | 1024 | 1536,
"faces": 300000,
"texture_size": 2048,
"seed": 123456,
"remove_background": true
}
-> 200 { "id": "b3c1e0f2a9d84c7e" }
-> 429 or 503 when the queue is fullGET /v1/jobs/{id}
-> {
"id": "b3c1e0f2a9d84c7e",
"state": "queued" | "running" | "done" | "failed" | "cancelled",
"stage": "queued" | "prepare" | "shape" | "texture" | "export" | "done",
"progress": 0.0-1.0,
"queue_position": 0,
"error": "only when failed",
"stats": { "vertices": 152030, "faces": 300000, "seconds": 17.4, "bytes": 8123456 } // when done
}
GET /v1/jobs/{id}/model.glb -> the GLB (model/gltf-binary)
DELETE /v1/jobs/{id} -> cancel a queued or running job
GET /health
-> { "ok": true, "engine": "TRELLIS.2-4B", "gpu": { "name": "NVIDIA A100", "vram_gb": 40 }, "queue": { "waiting": 0, "running": 1 } }Job ids must match [A-Za-z0-9_-]{6,64}; the web app rejects anything else before it reaches the worker. The worker should delete a job's files after an hour.
Settings
| Variable | Where | What it does |
|---|---|---|
| GPU_WORKER_URL | web app | The worker's https address. Empty = built-in demo engine. |
| GPU_WORKER_TOKEN | web app | Sent as the bearer token to the worker. |
| RATE_LIMIT_PER_HOUR | web app | Jobs one address may start per hour (default 20). |
| NEXT_PUBLIC_APP_URL | web app | The public address, used for share cards. |
| WORKER_TOKEN | worker | The token the worker accepts. Must equal GPU_WORKER_TOKEN. |
| JOB_TTL_SECONDS | worker | How long results are kept (default 3600). |