GPU Compute
Badgr Compute API
One API, three primitives: badgr serve for persistent endpoints, badgr run for one-off jobs, and badgr launch for coding and testing agents on a CPU VM. Fine-tuning, transcription, image generation, embeddings — these are all job types, not separate products. You don't configure compute providers. You run commands.
1. Install and log in
npm install -g badgr-cli
Requires Node.js 20.10+. Installs the badgr command.
badgr login
Prompts for your API key and saves it to ~/.badgr/config.json.
2. Three primitives, many job types
badgr serve <model>Start a persistent OpenAI-compatible endpoint. Stays running until you run badgr down.badgr run <command>Run a one-off GPU job. Streams logs, exits when done. Billing stops automatically.badgr launch <agent> "<task>"Run a coding/testing agent (cline, claude, codex, playwright) on a CPU VM. No --max-cost required.badgr sbatch <job.slurm>Run an existing Slurm batch script — translates #SBATCH directives into a badgr run job, including --array fan-out.badgr job <agent> "<instruction>" --check "<cmd>"Run a coding agent with a pass/fail check attached. Tracked as a job (type: agent) you can poll, cancel, and look up.badgr diagnose "<anything>"Run a Badgr Smoke Test — paste a GitHub issue, Docker image, repo URL, log, workflow, or conversation. Free, no GPU until --approve.badgr down <id>Terminate any deployment. Stops billing immediately.badgr logs <id>Fetch log output from a running or completed deployment.badgr receiptsCost, route, and retry record for every action.3. badgr launch — coding & testing agents
Run a coding agent or a test suite on a CPU VM with one command — no image, source, or --max-cost required for the four built-in workloads. Three separate things are going on here: which agent CLI runs, who pays for model usage, and who provisions the VM (always Badgr).
badgr launch cline "Fix the checkout bug" # Badgr provides model access — no account to connect badgr launch claude "Fix the checkout bug" # runs Claude Code — connect your Anthropic account badgr launch codex "Write tests" # runs the Codex CLI — connect your OpenAI account badgr launch playwright "Test the checkout flow" # no model account involved at all
Authentication model
clineBadgr provides and pays for model accessclaudeRuns Claude Code — your Anthropic account pays for usage, Badgr only provides the VMcodexRuns the Codex CLI — your OpenAI/ChatGPT account pays for usage, Badgr only provides the VMplaywrightNo model account requiredInstalling the claude/codex CLI on a disposable VM doesn't by itself give it model access — the CLI still has to authenticate, and a VM doesn't inherit your laptop's sign-in. badgr launch claude/codex prompt inline the first time to connect your account and remember it; cline and playwright need nothing. Today "connect your account" means securely storing an API key — both CLIs also support signing in via a Claude.ai/ChatGPT account, and a future badgr connect may add that OAuth flow instead of a pasted key. Connect ahead of time with badgr connect anthropic --key sk-ant-....
Retrieve results
badgr pull <deployment-id> # pull a code-editing agent's patch as a local git diff/branch badgr artifacts <deployment-id> # download everything else — test reports, screenshots, traces
Advanced escape hatch — any other command
badgr launch . --max-cost 1 -- npm test badgr launch https://github.com/user/repo --max-cost 1 -- python narrgo.py
Everything before -- is a Badgr flag; everything after is passed to your command verbatim, including anything that looks like a flag.
3b. badgr sbatch — run existing Slurm scripts
Run an existing .slurm batch script without rewriting it. Translates the common #SBATCH directives (--cpus-per-task, --mem, --gres=gpu:..., --time, --array, --export) into the same job Badgr already submits for badgr run — cluster-specific flags like --partition or --qos are parsed but ignored, with a warning.
badgr sbatch job.slurm # parse + submit, stream to completion badgr sbatch job.slurm --dry-run # parse only, print the translated plan, no GPU touched badgr sbatch array_job.slurm --max-concurrency 10 # cap array-task concurrency (default: 5)
--array fans out into one deployment per task index, each with SLURM_ARRAY_TASK_ID/SLURM_ARRAY_JOB_ID set the way a real Slurm array would, monitored independently and summarized as one job.
3c. badgr diagnose — Badgr Smoke Test
Paste anything. Badgr auto-detects the input type, redacts secrets, extracts the workload, runs free static checks, matches verified templates, and shows either missing information, a known-good configuration, or a capped smoke-test plan. No GPU is provisioned during diagnosis.
# Free Badgr Smoke Test — no login required badgr diagnose "https://github.com/org/repo/issues/123" badgr diagnose ajayrajtp/vllm_gemma412b:latest badgr diagnose ./vllm-error.log badgr diagnose "https://github.com/org/repo" badgr diagnose workflow.json # Free mechanical validation of the produced command — still no GPU, no login badgr diagnose "https://github.com/org/repo/issues/123" --smoke # Approve a capped smoke test after diagnosis (login required) badgr diagnose "https://github.com/org/repo/issues/123" --approve # Resume an existing case, e.g. one shared via a case link badgr diagnose repro_xxxxxxxx --approve # Machine-readable output badgr diagnose "https://github.com/org/repo/issues/123" --json
What Badgr accepts
Paste a GitHub issue URL — Badgr fetches it and extracts workload, image, model, command, and error
Pass an image name — static inspection checks architecture, OS, and environment variables without pulling
Pass a repo URL — Badgr inspects the file tree and detects framework, entry points, and missing config
Pass a workflow.json — Badgr extracts node types and detects missing models or incompatible node versions
Paste or point to a vLLM / CUDA / training log — errors and likely causes are extracted and categorised
Paste a Discord / Slack / support thread — Badgr redacts secrets and extracts the workload from the text
Status ladder
Every run prints exactly one of these. VERIFIED is never assigned from static resolution or --smoke — only from an actual successful GPU-provisioned run.
READY/SMOKE CHECKED results also print the canonical badgr run/badgr serve command --approve would run, plus a shareable case link — resume it later with badgr diagnose <case_id_or_url> --approve.
Diagnosis output
Safety model
No GPU launches without --approve. Secrets are redacted before any external call. AI-inferred fields require user confirmation before a case is created. Multi-GPU and large-download workloads require an additional explicit flag. One capped test, no automatic retry.
Full interactive flow (no CLI required): aibadgr.com/run-issue
3d. badgr job — bounded coding-agent jobs with a check
An agent job is a coding-agent run with a pass/fail check attached — one of several job types on the same unified Jobs API (alongside custom.run, model.serve, train.lora, and image/video jobs). You give the agent an instruction and the command that proves it worked; Badgr runs both on a disposable VM, records whether the check passed, and stores a receipt. Unlike badgr launch, a job is a tracked record you can poll, cancel, and look up later.
aibadgr.com/dashboard/jobs/new?type=agentForm — submit and watch it runbadgr job <agent> "<instruction>" --check "<command>"Submits and polls to a resultPOST /v1/jobstype: "agent" — same fields, returns a job_id to poll# Run a job and wait for the check result badgr job cline "Fix the checkout bug" --check "npm test" # Pick the agent and cap spend and runtime badgr job claude-code "Add pagination" --check "pytest tests/" --max-cost 3 --max-runtime 3600 # Run against a remote repo at a specific ref badgr job codex "Refactor auth" --check "pytest tests/" \ --repo https://github.com/org/repo --ref main # Submit and return immediately badgr job cline "Fix the bug" --check "npm test" --detach # Equivalent: badgr launch with --eval-command routes to the same agent job type badgr launch cline "Fix the checkout bug" --eval-command "npm test"
Flags
--check <command>Required (alias: --eval, --eval-command). The command that decides pass/fail. Runs after the agent finishes.--repo <url>Repository to work in. Defaults to the current directory.--ref <ref>Branch, tag, or commit to check out.--provider <name>badgr (hosted, cline/playwright) · openai (cline, codex) · anthropic (claude-code). Defaults per agent.--model <id>Model for the agent to use. Optional.--max-cost <usd>Hard spend cap. Default $2.00 — must be greater than $0.--max-runtime <sec>Hard runtime cap. Default 1800 s — must be greater than 0.--detachReturn as soon as the job is accepted instead of polling.--dry-runPrint the plan and exit without submitting.Provider flag is CLI-limited, not API-limited
The badgr job CLI's --provider flag only accepts badgr, openai, and anthropic, and never sends a base_url. The underlying POST /v1/jobs API is less restrictive: for cline and codex agents it also accepts deepseek, openrouter, glm, or custom as provider, plus an explicit base_url in input (required for custom) — but the credential must already exist as a saved provider credential added at /dashboard, not via badgr connect (which only stores Anthropic/OpenAI keys). To use a BYOK provider on a tracked job today, call the API directly. See Build a coding-agent platform for the full picture.
Web form (no CLI required): aibadgr.com/dashboard/jobs/new
3e. More CLI commands
Diagnostics, fine-tuning, transcription, embeddings, batch workloads, and account management.
badgr doctor — local GPU diagnosis, read-only, no login needed
badgr doctor badgr doctor --model meta-llama/Llama-3.1-8B-Instruct # will this model fit? badgr doctor --logs error.log # diagnose a crashed job's log badgr doctor --url http://localhost:8000/v1/models # a server that's not responding badgr doctor --json # machine-readable output
Endpoint lifecycle — restart, rerun, heartbeat
badgr restart dep-abc123 # relaunch an endpoint with the same config — new ID, same API key badgr rerun dep-abc123 # replay a past job or endpoint with its exact original spec — new ID badgr heartbeat dep-abc123 # reset an endpoint's idle-timeout clock (pairs with badgr serve --idle-timeout)
badgr train / badgr train lora — fine-tuning
badgr train config.yaml --gpu A100 --max-runtime 240 --env HF_TOKEN=$HF_TOKEN badgr train lora --base-model mistralai/Mistral-7B-v0.1 --dataset ./train.jsonl --preset small --max-cost 20
Detects framework from the config file — Axolotl and TRL configs run today, Unsloth is blocked before provisioning. train lora presets: small (RTX 4090, rank 16, 3 epochs), medium (A100, rank 32, 5 epochs).
badgr transcribe / badgr embed
badgr transcribe recording.mp3 --max-cost 2 # Whisper transcription badgr embed BAAI/bge-large-en-v1.5 documents.txt --max-cost 2 # text embeddings, JSONL out
badgr batch — generic containerized batch jobs
badgr batch run workload.yml badgr batch run workload.yml --fan-out ./scenarios --max-concurrency 10 # one deployment per input file badgr batch status dep-abc123 badgr batch compare dep-abc123 dep-def456
badgr workload / badgr workspace — saved configs and cost tracking
badgr run . --cmd "python train.py" --max-cost 10 --save my-training-job badgr workload run my-training-job # rerun a saved config by name badgr workspace create my-project --storage s3://my-bucket/runs badgr run . --cmd "python eval.py" --workspace my-project --max-cost 5
badgr models / badgr template / badgr capacity / badgr billing
badgr models # GPU catalog, cheapest first badgr template list # browse provider-neutral workload templates badgr capacity --gpu A100 --region EU # check live availability before launching badgr billing status # current balance badgr billing add 20 # add funds — $5 minimum top-up
4. API shapes
badgr serve and badgr run expose different API shapes — don't mix them up.
badgr serve — OpenAI-compatible /v1 endpoint
After badgr serve starts, export BADGR_ENDPOINT and point any OpenAI SDK client at it:
from openai import OpenAI
import os
client = OpenAI(
api_key=os.environ["BADGR_API_KEY"],
base_url=os.environ["BADGR_ENDPOINT"],
)
# Chat completions (badgr serve <model>)
resp = client.chat.completions.create(
model="qwen/Qwen2.5-7B-Instruct",
messages=[{"role": "user", "content": "Hello"}],
)
# Embeddings (badgr serve <model> --task embed)
resp = client.embeddings.create(
model="BAAI/bge-large-en-v1.5",
input=["hello world"],
)
# Transcription (badgr serve <model> --task transcribe)
with open("audio.mp3", "rb") as f:
transcript = client.audio.transcriptions.create(
model="large-v3", file=f, response_format="text",
)
# Image generation (badgr serve <model> --task image)
resp = client.images.generate(
model="black-forest-labs/FLUX.1-schnell",
prompt="A futuristic city at sunset",
n=1, size="1024x1024",
)Supported endpoints
POST /v1/chat/completionsChat — badgr serve <model>POST /v1/embeddingsEmbeddings — badgr serve <model> --task embedPOST /v1/audio/transcriptionsTranscription — badgr serve <model> --task transcribePOST /v1/images/generationsImage gen — badgr serve <model> --task imageNot supported
Responses API · Assistants · Realtime · Files · Vector stores · Fine-tuning API · Moderation · Batch API · Video generation · Tool calls / function calling (unless your runtime supports it)
badgr run — Badgr Compute job shape
Not OpenAI-compatible. This is the Badgr job API — for training, batch scripts, ComfyUI, and any workload that should start, run, and exit:
curl -X POST "$BADGR_API_BASE/v1/jobs" \
-H "Authorization: Bearer $BADGR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "custom.run",
"code_uri": "badgr-upload://abc123",
"cmd": "python train.py",
"max_cost": 5
}'5. Job types and recipes
badgr serve— persistent endpoints
LLaMA, Mistral, Qwen, and any Hugging Face model via vLLM
Custom vLLM config, version pinning, extended context
Run TEI or a vLLM embedding model as a persistent API
Serve a Diffusers or ComfyUI container as an endpoint
Persistent Whisper endpoint for audio-to-text workloads
badgr run— jobs that start, run, and exit
Run any Python script or container command on a GPU
Offline scoring, embedding generation, large-scale eval
Adapter training with Axolotl, TRL, or custom scripts
Diffusers, ComfyUI, or video synthesis pipelines
Whisper batch jobs, audio processing pipelines
badgr diagnose— diagnosis and capped smoke tests
Paste a GitHub issue URL — free extraction, static checks, template matching
Architecture, OS, and env-var static check without pulling the image
vLLM / CUDA / training logs classified by error type and likely cause
One-shot verification with a hard cost cap — requires --approve and a credit check
POST /v1/jobs— type: "agent", coding-agent jobs with a pass/fail check
curl -X POST https://aibadgr.com/api/v1/jobs \
-H "Authorization: Bearer $BADGR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "agent",
"input": {
"repository": "https://github.com/org/repo",
"ref": "main",
"agent": "cline",
"instruction": "Fix the checkout bug",
"check": "npm test"
},
"policy": { "max_cost": 2.0, "max_runtime_minutes": 30 }
}'
# => 201 { "job_id": "job_...", "status": "queued" }POST /v1/jobsCreate a job. Validates before provisioning, returns a job_id immediately.GET /v1/jobs/{id}Status, output (exit_code), and charged_usd.GET /v1/jobs/{id}/logsFull logs, credentials redacted.POST /v1/jobs/{id}/cancelCancel execution and begin teardown.Integrations
badgr-run and badgr-serve composite actions for CI/CD pipelines
badgr-mcp exposes GPU tools to Claude, Cursor, and other coding agents
Build a Stripe-Minions-style product on top of the agent Job type
6. How it runs your code
Badgr does not require you to build or push a Docker image. Point it at a folder, a GitHub repo, or a custom image — it handles the rest.
Flow 1 — local project folder (primary)
badgr run . --cmd "python score_leads.py" --max-cost 1
Badgr zips your current directory, uploads it, picks a generic runner, installs deps from requirements.txt or package.json, runs the command, stores outputs for 48 hours, and tears down the GPU. No Docker required.
Flow 2 — public GitHub repo
badgr run https://github.com/user/repo --cmd "python score_leads.py" --max-cost 1
No upload step — the runner clones the repo directly. Good for open-source projects and CI pipelines.
Flow 3 — custom Docker image (advanced)
badgr run . --image myco/lead-env:latest --cmd "python score_leads.py" --max-cost 1
Bring your own container when dependencies are too custom or heavy. Mutually exclusive with automatic runtime detection.
Generic runners (Badgr picks automatically)
badgr-python-runnerPython 3.11 + CUDA. Auto-selected when requirements.txt or pyproject.toml is present.badgr-node-runnerNode.js 20 + CUDA. Auto-selected when package.json is present.badgr-vllm-runnervLLM pre-installed. Used by badgr serve and model.serve jobs.badgr-train-runnerAxolotl + TRL + Unsloth. Used by badgr train.badgr-comfyui-runnerComfyUI pre-installed. Used by badgr comfyui run.7. Quick examples
Run a local project on a GPU
badgr run . --cmd "python train.py" --gpu A100 --max-cost 10
Serve a model
badgr serve Qwen/Qwen2.5-7B-Instruct --max-cost 10
Stop billing
badgr down <deployment-id>
8. How jobs work
Every badgr run or badgr serve call submits a job through the Badgr Jobs API. You can also drive this API directly if you want to integrate GPU workloads into your own systems.
Job lifecycle
queuedJob accepted; waiting for a GPU to become availableprovisioningGPU is being allocated from the provider poolrunningContainer is executing; logs are streamingcompletedJob exited cleanly; billing has stoppedfailedJob exited with an error or the GPU was lostcanceledStopped via badgr down or POST /v1/jobs/{id}/cancelREST API
POST /v1/jobsSubmit a compute job (run, serve, fine-tune, image gen)GET /v1/jobs/{id}Poll status, logs, and results for a jobPOST /v1/jobs/{id}/cancelStop a running job and settle billingJob types
custom.runRun any Python script or container command. Exits when the command exits.model.servePersistent OpenAI-compatible vLLM endpoint. Pass a full HuggingFace model ID or a blessed alias (qwen-7b, llama-8b, qwen-coder-7b). Stays up until canceled.train.loraFine-tune with Axolotl. Pass config_preset: 'small' or 'medium' for zero-config training. Accepts dataset_url, dataset_file_id, or github_dataset_url. Completes when training finishes; adapter available at GET /v1/jobs/{id}/adapter.comfy.batchRun a batch of prompts through ComfyUI. Pass workflow_id: 'sdxl-basic' or 'flux-basic' and a prompts list (up to 20). Returns image_urls pointing to stored images at GET /v1/jobs/{id}/images/{index}.image.generateGenerate images via Lemonfox (provider-managed, fast, cheap).9. Workload examples
Submit a batch script (custom.run)
# Upload your project zip to get a code_uri (multipart POST)
zip -r project.zip . -x "*.git*" "node_modules/*" "__pycache__/*"
curl -X POST https://aibadgr.com/v1/uploads \
-H "Authorization: Bearer $BADGR_API_KEY" \
-F "file=@project.zip" > upload.json
# upload.json → { "code_uri": "https://aibadgr.com/v1/uploads/.../download?token=..." }
# Submit the job
curl https://aibadgr.com/v1/jobs \
-H "Authorization: Bearer $BADGR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "custom.run",
"input": {
"gpu": "A100",
"code_uri": "<code_uri from upload>",
"cmd": "python train.py --epochs 10",
"env": { "HF_TOKEN": "hf_..." }
},
"policy": { "max_cost": 5 }
}'Start a persistent model endpoint (model.serve)
curl https://aibadgr.com/v1/jobs \
-H "Authorization: Bearer $BADGR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "model.serve",
"model": "Qwen/Qwen2.5-7B-Instruct",
"gpu": "RTX_4090"
}'Returns a deployment_url once the model is healthy. Use it as your baseURL with any OpenAI-compatible client.
Poll until complete
curl https://aibadgr.com/v1/jobs/$JOB_ID \ -H "Authorization: Bearer $BADGR_API_KEY" # Response fields: # status: queued | provisioning | running | completed | failed | canceled # logs: recent stdout/stderr lines # result: output data when status=completed
Cancel and stop billing
curl -X POST https://aibadgr.com/v1/jobs/$JOB_ID/cancel \ -H "Authorization: Bearer $BADGR_API_KEY"
10. Productized runner flows
Three zero-config GPU flows. No Docker image selection, no Axolotl YAML, no ComfyUI setup — just a job type and parameters.
model.serve — blessed aliases
Pass a short alias and Badgr resolves the full model ID, GPU type, and vLLM image automatically. Aliases: qwen-7b, llama-8b, qwen-coder-7b.
curl https://aibadgr.com/v1/jobs \
-H "Authorization: Bearer $BADGR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "model.serve",
"input": { "model": "qwen-7b" }
}'
# Response includes endpoint_url and the resolved model_id:
# {
# "output": {
# "endpoint_url": "https://...",
# "model": "Qwen/Qwen2.5-7B-Instruct",
# "alias": "qwen-7b"
# }
# }Or pass a full HuggingFace model ID: "model": "mistralai/Mistral-7B-Instruct-v0.3". Cancel with POST /v1/jobs/{id}/cancel when done.
train.lora — presets + real Axolotl
Use config_preset for zero-config LoRA fine-tuning. Presets: small (RTX 4090, rank 16, 3 epochs) or medium (A100, rank 32, 5 epochs). Dataset from a URL, a Badgr upload ID, or a GitHub URL.
# Option A: dataset from URL
curl https://aibadgr.com/v1/jobs \
-H "Authorization: Bearer $BADGR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "train.lora",
"input": {
"base_model": "Qwen/Qwen2.5-7B-Instruct",
"config_preset": "small",
"dataset_url": "https://huggingface.co/datasets/tatsu-lab/alpaca/resolve/main/data/train-00000-of-00001.parquet"
}
}'
# Option B: dataset from a GitHub repo file
# "github_dataset_url": "https://github.com/user/repo/blob/main/data/train.jsonl"
# Option C: dataset from a Badgr file upload
# "dataset_file_id": "<id from POST /v1/uploads>"
# After completion, download the LoRA adapter:
curl https://aibadgr.com/v1/jobs/$JOB_ID/adapter \
-H "Authorization: Bearer $BADGR_API_KEY" \
-o lora-adapter.tar.gzcomfy.batch — batch image generation
Queue up to 20 prompts through ComfyUI in a single job. Images are downloaded and stored; retrieve them at GET /v1/jobs/{id}/images/{index}. Currently supports workflow_id: "sdxl-basic" (SDXL 1.0, 1024×1024) and "flux-basic" (FLUX.1-schnell, 1024×1024).
curl https://aibadgr.com/v1/jobs \
-H "Authorization: Bearer $BADGR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "comfy.batch",
"input": {
"workflow_id": "sdxl-basic",
"prompts": [
"a red fox in a snowy forest, photorealistic",
"a futuristic city at sunset, digital art",
"an astronaut riding a horse on the moon"
]
}
}'
# After completion, job output contains:
# { "image_urls": ["https://aibadgr.com/v1/jobs/.../images/0", ...] }
# Download each image:
curl https://aibadgr.com/v1/jobs/$JOB_ID/images/0 \
-H "Authorization: Bearer $BADGR_API_KEY" \
-o image_0.pngGPU options
Badgr Auto selects the best eligible GPU for your workload. Use --gpu or --min-vram only when you need more control.
RTX_3090NVIDIA RTX 309024 GBRTX_4090NVIDIA RTX 409024 GBL40SNVIDIA L40S48 GBA100NVIDIA A10040–80 GBH100NVIDIA H10080 GBAvailable GPU types may vary by region and current capacity. Run badgr capacity or use --dry-run to confirm availability and pricing before provisioning.
GPU Capacity
Check available GPUs before launching
Browse updated capacity, pricing, and availability on the Badgr Capacity page. Check what GPUs are ready right now and their hourly rates.
Browse GPU capacity →