Documentation
Everything you need to query hardware, dispatch jobs, and monitor execution on the RobinGrid compute grid programmatically, from the official Node.js SDK to the raw REST API.
Overview
RobinGrid exposes a small, stable API surface for finding available GPU nodes and dispatching containerized jobs against them. There are two ways to talk to it:
- @robingrid/sdk: a typed Node.js/TypeScript client, published on npm.
- REST API: plain HTTP + JSON under
/api/v1, usable from curl or any language.
Both talk to the same endpoints, so the reference below applies whichever you use. The SDK is just a thin, typed wrapper around the REST calls.
Installation
Install the SDK from npm:
npm install @robingrid/sdk
Requires Node.js 18+ (uses the global fetch, no extra HTTP dependency). Package page: npmjs.com/package/@robingrid/sdk.
Authentication
Every request (SDK or REST) is authenticated with an API key passed as a bearer token. Generate one from the Console's API Configuration tab.
Authorization: Bearer rg_live_...
Requests with a missing or invalid key receive a 401 with an { "error": "Invalid or missing API key" } body.
Quickstart
Find the cheapest matching node, dispatch a job to it, then poll for its status:
import { RobinGrid } from "@robingrid/sdk";
const client = new RobinGrid({ apiKey: "rg_live_..." });
const node = await client.nodes.findCheapest({
gpu: "RTX 4090",
region: "US-East",
});
const job = await client.jobs.create({
nodeId: node.id,
containerImage: "runpod/stable-diffusion-v1-5",
envVars: { PROMPT: "a robin flying over a server farm" },
});
console.log(job.id, job.status); // "job_abc123" "PENDING_BID"
// Poll until it finishes
const finished = await client.jobs.get(job.id);
console.log(finished.status, finished.logs);SDK Reference
new RobinGrid(options)
Creates a client. apiKey is required; baseUrl defaults to https://api.robingrid.xyz/api/v1 and can be overridden for local development or self-hosted deployments.
const client = new RobinGrid({
apiKey: "rg_live_...",
baseUrl: "http://localhost:3000/api/v1", // optional
});client.nodes.search(filter?)
Lists nodes matching an optional filter: gpu, region, maxPingMs, minReputation. Returns RobinGridNode[].
const nodes = await client.nodes.search({ gpu: "H100", maxPingMs: 20 });client.nodes.findCheapest(filter?)
Same filter as search, but returns a single node: the lowest pricePerHour among matches. Throws if nothing matches.
const node = await client.nodes.findCheapest({ gpu: "RTX 4090" });client.jobs.create(input)
Dispatches a container. containerImage is required. Pass nodeId to pin a specific node (e.g. from findCheapest), or gpuModelPreference to let the scheduler pick one. Returns the created RobinGridJob.
const job = await client.jobs.create({
containerImage: "ollama/ollama:latest",
envVars: { MODEL: "llama3" },
gpuModelPreference: "H100",
});client.jobs.get(jobId)
Fetches the current status and accumulated logs for a job. Call this on an interval to watch a job progress.
const job = await client.jobs.get("job_abc123");REST API
Base URL: https://api.robingrid.xyz/api/v1. Every endpoint requires the Authorization: Bearer header shown above.
/jobsCreate a job. Body: containerImage (required), envVars, nodeId, gpuModelPreference. Returns 201 with the job.
curl -X POST https://api.robingrid.xyz/api/v1/jobs \
-H "Authorization: Bearer rg_live_..." \
-H "Content-Type: application/json" \
-d '{
"containerImage": "ollama/ollama:latest",
"envVars": { "MODEL": "llama3" },
"gpuModelPreference": "H100"
}'/jobs/:idFetch a job's current status and logs.
curl https://api.robingrid.xyz/api/v1/jobs/job_abc123 \ -H "Authorization: Bearer rg_live_..."
/nodesList nodes. Optional query params: gpu, region, maxPingMs, minReputation.
curl "https://api.robingrid.xyz/api/v1/nodes?gpu=4090&maxPingMs=30" \ -H "Authorization: Bearer rg_live_..."
Job Lifecycle
A job moves through the following statuses. Poll jobs.get() until it reaches a terminal state.
PENDING_BIDJob accepted, scheduler is matching it to a node.PROVISIONINGNode matched, sandbox environment is being prepared.RUNNINGContainer is executing on the assigned node.COMPLETEDJob finished successfully. Terminal state.REFUNDEDManually refunded (e.g. by an admin). Terminal state.DISPUTEDFlagged for review. Terminal state until resolved.Errors
Errors are returned as JSON with an error message and a non-2xx status code. The SDK wraps these in a RobinGridApiError with a status property.
400Missing or invalid request body (e.g. no containerImage).401Missing or invalid API key.404Job not found.try {
await client.jobs.get("does_not_exist");
} catch (err) {
if (err instanceof RobinGridApiError) {
console.log(err.status, err.message); // 404 "Job not found"
}
}