Developer Reference
gpu.fm API
Launch GPU instances, snapshot them, and run inference on hosted models with plain HTTP calls. Usage is billed from your prepaid credit balance — no subscription, no minimum commitment.
Authentication
Create an API key from your dashboard settings. Keys start with gfm_, are shown once at creation, and are stored hashed — save yours somewhere safe. You can hold up to 5 active keys and revoke any of them at any time.
Send the key as a bearer token (or an x-api-key header) on every request:
Authorization: Bearer gfm_your_key_here
Requests from a signed-in browser session are also accepted, so everything below works from your own frontend code while you are logged in.
Billing & limits
- Each call is billed from your prepaid credits when it completes; the exact charge is returned in the response
pricingobject. - Minimum charge per inference call: $0.01.
- Calls reserve credits up front ($0.05 for
/api/inference, $0.50 for/api/fal/inference) and settle to the actual cost when they complete — unused reservation is refunded immediately, and failed calls are fully refunded. - Requests fail with
402when your balance can't cover the reservation — top up first. - Rate limits (per account, per minute): GPU instance operations 10/min, web terminal sessions 20/min, everything else 100/min.
GPU instances
Launch and manage GPU cloud instances — the same API the launcher and dashboard use. All instance, snapshot, and credit endpoints accept either a signed-in browser session or an API key sent as Authorization: Bearer gfm_.... Instance runtime is metered in ~5-minute windows, only while the GPU runtime is validated as ready, at exactly the advertised hourly rate. The legacy /api/gpu/rent and /api/gpu/status endpoints have been removed — use the endpoints below.
Lists your instances. Add ?id=<instance_id> for a single instance (state is synced from the provider on read), or ?catalog=1 for the GPU catalog with live per-hour pricing plus the full environment template list.
Request body
{
"gpu_type": "h100-80gb", // required — GPU id from ?catalog=1
"environment": "pytorch", // required — environment template id
"disk_space_gb": 100, // optional, 50-2000, default 100
"region": "nyc2", // optional — defaults to the GPU's home region
"auto_shutdown_hours": 8, // optional, 1-168 — server-side destroy deadline
"ssh_public_key": "ssh-ed25519 AAAA... you@laptop", // optional — enables direct `ssh root@<ip>`
"user_snapshot_id": "<uuid>" // optional — boot from one of your snapshots
}Returns 201 with the instance (status starts at provisioning; poll GET ?id= until running). Without ssh_public_key you can still use the browser web terminal — direct SSH requires the key. Returns 503 while rentals are paused for maintenance.
Response (201)
{
"id": "9be2...",
"status": "provisioning",
"gpu_type": "h100-80gb",
"gpu_name": "NVIDIA H100 80GB",
"environment": "pytorch",
"environment_name": "PyTorch + CUDA",
"cost_per_hour": 4.41,
"ip_address": null,
"ssh_command": null,
"region": "nyc2",
"disk_space_gb": 100,
"auto_shutdown_hours": 8,
...
}{ "action": "reboot" } // or "shutdown"rebootpower-cycles the box. The instance drops back toprovisioninguntil the SSH + GPU readiness probe passes again; billing continues through a reboot.shutdownbills the final usage window and then destroys the instance — powered-off GPU droplets still cost money upstream, so shutdown is a destroy-with-final-bill, not a pause. Snapshot first if you want to come back to your disk.
Terminates the instance after final billing. The disk is erased.
{ "id": "9be2...", "status": "terminated", "final_cost": 3.31, "runtime_hours": 0.75 }Snapshots
Snapshot a running instance's disk, then boot a new instance from it later by passing user_snapshot_id to POST /api/do/instances. Up to 10 active snapshots per account; snapshot storage is currently free.
Create a snapshot
curl -X POST https://www.gpu.fm/api/gpu/snapshots \
-H "Authorization: Bearer gfm_your_key_here" \
-H "Content-Type: application/json" \
-d '{"instance_id":"9be2...","name":"my-configured-rig"}'Returns 201 with the snapshot record. GET /api/gpu/snapshots returns { "snapshots": [...] }; DELETE returns { "id": "...", "status": "deleted" }.
Credits
{ "balance": 25.4, "formatted": "$25.40" }Returns { "transactions": [...] } — your latest 100 credit transactions: purchases, instance billing windows, and refunds. Top up on the credits page.
Run a hosted HuggingFace model. Best for text generation, embeddings, and other text-in / text-out tasks.
Request body
{
"modelId": "mistralai/Mistral-7B-Instruct-v0.3", // required, max 200 chars
"inputs": "Explain NVLink in one paragraph.", // required, string, max 10,000 chars
"parameters": { "max_new_tokens": 200 } // optional, model-specific
}Example
curl https://www.gpu.fm/api/inference \
-H "Authorization: Bearer gfm_your_key_here" \
-H "Content-Type: application/json" \
-d '{"modelId":"mistralai/Mistral-7B-Instruct-v0.3","inputs":"Explain NVLink in one paragraph."}'Response
{
"result": [ { "generated_text": "..." } ],
"usage": { "requestCount": 1, "inputTokens": 12, "outputTokens": 96 },
"pricing": { "baseCost": "0.000108", "markup": "0.000032", "total": "0.000140" }
}Run image, video, audio, and 3D generation models served via fal. The input object is passed through to the model, so use the input schema of the model you are calling.
curl https://www.gpu.fm/api/fal/inference \
-H "Authorization: Bearer gfm_your_key_here" \
-H "Content-Type: application/json" \
-d '{"modelId":"fal-ai/flux/schnell","input":{"prompt":"a green datacenter at dusk"}}'Responds with result (model output, including media URLs), requestId, usage, and pricing.
Browse the model catalog. No authentication required. Filter with search and category (a HuggingFace pipeline tag such as text-generation); add featured=1&category=... for the curated set. Returns up to 20 models with id, author, downloads, likes, and per-unit pricing.
Your usage history and totals. Optional query params: type (model type), startDate, endDate (ISO dates), and limit (default 100, max 500). Returns per-request records with cost breakdowns plus account-lifetime totals.
Errors
| Status | Meaning |
|---|---|
| 400 | Invalid request body — check required fields and length limits. |
| 401 | Missing or invalid API key / session. |
| 402 | Insufficient credit balance — add credits. |
| 429 | Rate limit exceeded — see the per-route limits under Billing; retry with backoff. |
| 500 | Model or upstream failure — the error message has details; you are not charged. |
| 503 | GPU rentals temporarily paused for maintenance, or the provider is unreachable. |
Ready to build?
Create a key, add credits, and your first request is one curl away.