RunPod
Deploy llama.cpp or vLLM to RunPod Serverless endpoints that scale to zero, or always-on pods, with API keys, GPUs, regions, and costs.
- Status
- Supported
- Kind
- Serverless GPU cloud
- Provider id
runpod- Regions and residency
- EU and EEA data centers, plus US, Canada and APAC
Use this provider
resource "hardware_profile" "runpod_l4" {
provider = "runpod"
region = "eu"
accelerator {
kind = "gpu"
model = "l4-24gb"
count = 1
memory = "24GiB"
}
memory = "32GiB"
}RunPod is one of the providers amicu apply and amicu destroy can deploy to. New to RunPod?
Overview
A hardware profile with provider = "runpod" makes apply create a RunPod Serverless load-balancing endpoint, or, with runpod { mode = "pod" }, an always-on pod. Both vllm and llama_cpp runtimes work, using the stock images. The model must come from Hugging Face; the worker downloads it.
A Serverless endpoint scales to zero when idle and is billed per second while workers run. amicu destroy deletes the endpoint and the RunPod secrets amicu created for it.
The stock images need a host CUDA version of at least 13.0 for vLLM and 12.8 for llama.cpp. amicu sets that as the placement floor, so workers and pods land only on hosts that meet it. An image overridden through the environment variables below gets no floor.
By default amicu keeps no warm workers and allows one worker (min 0, max 1). For more throughput, raise max_replicas in the deployment's scaling {} block. Other defaults: scale out at 32 in-flight requests per worker, scale a worker down after 900 s idle (at most 3600 s). A lone min_replicas above 1 raises the ceiling to match.
Setup and credentials
Two kinds of key are involved. On Serverless, keep them apart: RunPod's gateway checks the endpoint key on every request, and amicu will not accept your management key as an endpoint key.
| Variable | Needed for | Notes |
|---|---|---|
RUNPOD_API_KEY | plan/apply refresh, apply, destroy, amicu runpod | The management key. Create it in the RunPod console under Settings, API Keys, with read/write access to the RunPod API. Add api.runpod.ai access as you see fit. |
The deployment's api_key secret, for example CHAT_API_KEY | apply, and every client call | Serverless: a second RunPod API key, used as the endpoint key (see below). Pods: the runtime's own random key (see Pods). |
HF_TOKEN (optional) | Gated or private Hugging Face repos | Stored as a RunPod secret and injected into the worker. |
AMICU_RUNPOD_VLLM_IMAGE, AMICU_RUNPOD_LLAMACPP_IMAGE (optional) | Override the base image | Process-wide. There is no HCL field for the image. |
Export values in your shell. Never write them into HCL (see Secrets).
The endpoint key
RunPod's gateway checks the key and strips the Authorization header before the request reaches the worker, so the runtime never sees it. That is why the deployment's api_key must be a RunPod API key with api.runpod.ai access. Create a second Restricted key in the console with:
api.runpod.io/graphql: Noneapi.runpod.ai: Read/Write, or restricted to the endpoint
Then export it as the deployment's secret:
export RUNPOD_API_KEY=... # management key
export CHAT_API_KEY=... # endpoint keyamicu refuses a deployment whose api_key is the management key. An api_key that RunPod's gateway rejects fails apply with the HTTP status. A runtime --api-key flag or API_KEY variable cannot be set on RunPod, because the runtime would reject every request.
Example
resource "model" "qwen" {
source {
registry = "hugging_face"
reference = "unsloth/Qwen3.5-9B-GGUF"
}
architecture = "qwen3"
modalities = ["text"]
artifact {
format = "gguf"
quantization = "q6_k"
}
context_length = 32768
variant {
quantization = "q6_k"
file = "Qwen3.5-9B-UD-Q6_K_XL.gguf"
size = "8350MiB"
}
}
resource "hardware_profile" "runpod_l4" {
provider = "runpod"
region = "eu"
accelerator {
kind = "gpu"
model = "l4-24gb"
count = 1
memory = "24GiB"
}
memory = "32GiB"
}
resource "deployment" "chat" {
model = model.qwen.id
hardware = hardware_profile.runpod_l4.id
runtime = "llama_cpp"
api_key = secret("CHAT_API_KEY")
llama_cpp {
context_length = 32768
port = 8080
n_gpu_layers = -1
}
}Run amicu validate, amicu plan, then amicu apply. apply waits for the endpoint's health check, which includes the first cold start and model download, and prints the endpoint URL. A vllm deployment works the same way: set runtime = "vllm" and a vllm {} block as in the Modal example.
Calling the endpoint
This section covers Serverless; for a pod see Pods.
The endpoint URL has the form https://<endpoint id>.api.runpod.ai. Send the endpoint key as a bearer token, with a capital B:
curl "$URL/v1/chat/completions" \
-H "Authorization: Bearer $CHAT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "unsloth/Qwen3.5-9B-GGUF", "messages": [{"role": "user", "content": "Hello"}]}'With the OpenAI Python SDK, api_key=os.environ["CHAT_API_KEY"] and base_url=f"{url}/v1" are enough; the SDK sends Authorization: Bearer. There are no extra gateway headers.
Pods
Set runpod { mode = "pod" } on the hardware profile for an always-on GPU pod instead of a Serverless endpoint. A pod is billed while it exists, whether or not it serves traffic, until you destroy it.
resource "hardware_profile" "runpod_pod" {
provider = "runpod"
region = "eu"
runpod {
mode = "pod"
cloud = "secure"
}
accelerator {
kind = "gpu"
model = "l4-24gb"
count = 1
memory = "24GiB"
}
memory = "32GiB"
}- Key. The deployment's
api_keyis the runtime's own key, not a RunPod key. Generate a random one, for exampleopenssl rand -hex 32, and export it. The pod proxy adds no authentication and the URL is public, so the runtime's key is the only guard. amicu refuses a key equal toRUNPOD_API_KEY.applychecks that the pod rejects unauthenticated requests and accepts the key. - Calling. The URL is
https://<pod id>-<port>.proxy.runpod.net. Send the key asAuthorization: Bearer <key>. - vLLM routes. vLLM's own
--api-keyguards only its/v1routes, so on a pod amicu also loads a small middleware through vLLM's--middlewareoption. Every route, including/invocations,/tokenize,/metricsand/docs, then requires the key, exceptGET /health. CORS preflight (OPTIONS) requests need the key too.applychecks that anonymous requests to/v1/chat/completions,/invocationsand/docsget401. Serverless does not need this, because RunPod's gateway authenticates every request. - One replica.
scaling {}may only setmin_replicas = 1andmax_replicas = 1, or be left out. Anything else failsamicu validatewithAMICU-CAP-015. - Replacement. Changing the GPU, its count, the cloud or the
network_volumereplaces the pod, and so does a region change when the running pod's data center is outside the new region's data centers. The old pod is terminated, then the new one starts. A new spec that fails a pre-write check leaves the old pod in place. - Cloud.
secureby default, orcommunity.cloudis an error on Serverless. - Destroy.
amicu destroyandamicu runpod stopterminate the pod and delete the secrets amicu created for it. The deployment stays in state until the termination is confirmed. - Cost.
amicu planshows how each mode is billed, for examplebilling: always on · ~$0.59/hrfor a pod andbilling: scale to zero · ~$0.69/hr while activefor Serverless. The figure is an estimate from amicu's bundled prices, not a live quote.
Model cache
Without a volume, every new worker downloads the model onto its container disk. Point runpod { network_volume = "<volume id>" } at an existing network volume and the model is downloaded once, then read from the volume by later workers.
runpod {
network_volume = "agv6w2qcg7"
flashboot = true
}- Bring your own. Create the volume in the RunPod console. amicu reads it but never creates, resizes or deletes it, and
amicu destroyleaves it and its contents in place. The volume bills for its storage until you delete it. - Placement. A volume lives in one data center, so workers are placed only there. Before anything is recorded or started,
applyreads the volume and refuses it if its data center is outside the profile'sregionor the project'sdata_classresidency. It notes when RunPod lists no stock of the GPU in that data center right now; workers then wait for capacity there. - Where. The volume is mounted at
/runpod-volume, andHF_HOMEis set to/runpod-volume/huggingfacefor vLLM and llama.cpp (llama.cpp also getsLLAMA_CACHE=/runpod-volume/huggingface/hub). AnHF_HOMEyou set in the deployment'senvblock wins, and llama.cpp then gets noLLAMA_CACHEeither; anLLAMA_CACHEyou set wins too. - Changes. On Serverless, switching to another volume or removing it updates the endpoint in place. A pod's volume is fixed when the pod is created, so changing it replaces the pod.
- Plan.
amicu planshowsvolume:with the mount and cache variables (placement is pinned to the volume's data center at apply) and, when on,flashboot: on.
Large models can take a long time to load. On Serverless, amicu raises RunPod's worker startup timeout from 7 to 30 minutes, and apply waits for it. To change it, add env { RUNPOD_INIT_TIMEOUT = "<seconds>" } to the vllm or llamacpp block (secret(...) works there too). A network_volume caches the download, so only the first start pays for it.
Configuration reference
| Argument | Type | Default | Required | Notes |
|---|---|---|---|---|
provider | string | none | yes | "runpod". |
region | string | none | no | eu, us, ca, apac, or an exact data center id from Regions. Unset lets RunPod place workers anywhere, unless a data_class residency narrows it to the allowed data centers. |
accelerator.kind | string | none | yes | Must be gpu. |
accelerator.model | string | none | yes | A GPU id from GPUs, or a name that resolves to exactly one of them (see GPU names). |
accelerator.count | number | none | yes | GPUs per worker. |
accelerator.memory | size | none | yes | VRAM, for the fit check. Required unless model is an exact GPU id. |
memory | size | none | yes | Host RAM. |
runpod.mode | string | "serverless" | no | "serverless": a load-balancing endpoint that scales to zero. "pod": an always-on GPU pod, billed while it exists. |
runpod.cloud | string | "secure" | no | Pod mode only: "secure" or "community". |
runpod.network_volume | string | none | no | Id of an existing RunPod network volume to hold the model cache. See Model cache. |
runpod.flashboot | bool | false | no | Serverless only: turns on RunPod FlashBoot, which keeps worker state around for faster cold starts. An error on pods. |
deployment api_key | secret(...) | none | yes | Serverless: a RunPod API key with api.runpod.ai access. Pod: the runtime's own key. |
GPUs
Use an exact catalog id such as a100-sxm4-80gb or l4-24gb, or a family name that accelerator.memory makes unique: l4 always names l4-24gb, and h100 with 94GiB names h100-nvl-94gb. A name that still matches several cards (a100 with 80GiB fits both the SXM4 and the PCIe card) fails amicu validate with AMICU-CAP-012, and an id the catalog does not know with AMICU-CAP-013. Both are errors on RunPod. AMICU-CAP-014 warns when memory is outside the named card's VRAM. See GPU names.
On Serverless, amicu places the deployment in the card's RunPod GPU group and excludes the group's other cards, so only the card you named is used.
| Group | Cards (ids) | VRAM |
|---|---|---|
| 16 GB | rtx-a4000-16gb, rtx-a4500-20gb, rtx-4000-ada-20gb, rtx-2000-ada-16gb | 16 to 20 GB |
| 24 GB | l4-24gb, rtx-a5000-24gb, rtx-3090-24gb | 24 GB |
| 24 GB (Ada) | rtx-4090-24gb | 24 GB |
| 32 GB | rtx-5090-32gb | 32 GB |
| 32 GB (Blackwell) | rtx-pro-4500-32gb | 32 GB |
| 48 GB (Ampere) | a40-48gb, rtx-a6000-48gb | 48 GB |
| 48 GB (Ada) | l40-48gb, l40s-48gb, rtx-6000-ada-48gb | 48 GB |
| 80 GB (Ampere) | a100-sxm4-80gb, a100-pcie-80gb | 80 GB |
| 80 GB (Ada) | h100-sxm-80gb, h100-pcie-80gb, h100-nvl-94gb | 80 to 94 GB |
| 141 GB | h200-sxm-141gb | 141 GB |
| 96 GB | rtx-pro-6000-96gb, rtx-pro-6000-maxq-96gb, rtx-pro-6000-server-96gb | 96 GB |
| 180 GB | b200-180gb | 180 GB |
| 288 GB | b300-288gb | 288 GB |
The rtx-pro-6000-mig-24gb and rtx-pro-6000-mig-48gb slices share the 24 GB and 48 GB (Ada) groups, so they are excluded when you name a whole card there. The H200 NVL (h200-nvl-141gb) is offered only as a pod, not on Serverless. Using it without runpod { mode = "pod" } fails amicu validate with AMICU-CAP-015.
Regions
region = "eu" restricts placement to RunPod's EU data centers: EU-CZ, EU-FR, EU-NL, EU-RO and EU-SE, plus Iceland (EUR-IS) and Norway (EUR-NO). The other groups are us, ca and apac. An exact data center id (case-insensitive) pins one site. A region outside the residency your data_class requires is rejected, and an unknown region is an error, not "anywhere". See Residency.
| Data center | Location | Group |
|---|---|---|
EU-CZ-1, EU-FR-1, EU-NL-1, EU-RO-1, EU-SE-1 | Czechia, France, Netherlands, Romania, Sweden | eu |
EUR-IS-1 to EUR-IS-5, EUR-NO-1, EUR-NO-2 | Iceland, Norway (EEA) | eu |
US-CA-2, US-CO-1, US-GA-2, US-IL-1, US-KS-2, US-MD-1, US-MO-1, US-MO-2, US-NC-1, US-NC-2, US-NE-1, US-PA-1, US-TX-3, US-TX-4, US-WA-1, US-WA-2 | United States | us |
CA-MTL-1, CA-MTL-3, CA-MTL-4 | Montreal | ca |
AP-IN-1, AP-JP-1, OC-AU-1 | India, Japan, Australia | apac |
Costs
Only running workers are billed, per second, from start until the worker stops. That includes the cold start, during which the model downloads, and the idle timeout (900 s by default) before scale-down: the worker shows as Running in the console and is billed. A scaled-down worker (console status Idle) is not billed. With no traffic and none kept warm, nothing runs and nothing is billed. The 24 GB group (L4, RTX A5000, RTX 3090) is about $0.69 per hour per worker; see the RunPod price list for current rates, which vary by GPU and change over time. amicu plan shows indicative estimates from amicu's bundled catalog, not live quotes.
To keep spend bounded, remember the defaults: one worker at most, none kept warm. Run amicu destroy when you are done. A pod is billed for as long as it exists; see Pods.
Limits
- A single request is capped at about 5.5 minutes. Keep generations short enough to finish inside it.
- Cold starts take time: a new worker pulls the image and downloads the model onto its disk (unless a model cache volume holds it), so the first request after idle is slow, and a
503or a wait is normal. - Logs are available only from live workers. A scaled-to-zero endpoint has none to read; use the RunPod console while a worker is up.
- Only GPU accelerators are valid.
- The model must come from Hugging Face.
- Flags that refer to local files and secret-bearing flags are rejected before any RunPod call.
Troubleshooting
Source
Backend: crates/amicu-runpod. Dispatch: apply.rs. Status of every provider: Providers.
Last updated