Skip to content

AI infrastructure

Free GPU hours on Modal: what $30 a month really buys

Modal's free Starter plan includes $30 of GPU compute a month. See how many hours each GPU gets you, what quietly eats them, and how to host a coding model.

By TechTipsEasy · · 10 min read

Modal, a serverless GPU cloud, gives every workspace on its free Starter plan $30 of compute every month. GPUs are billed by the second and apps can scale to zero, so that credit turns into real GPU time: about 6.6 hours on an H200, 12 hours on an A100 80 GB or 37 hours on an L4.

A popular way to spend it is to run an open model as your own OpenAI-compatible API and point a coding agent such as OpenCode or Cline at it. Modal publishes a ready-made example that does exactly that. This guide shows what the free credit really buys, the billing details that quietly eat it, and how to run the example without leaving a GPU open to the whole internet.

The short version
  • Free: the Starter plan costs $0 a month and includes $30 of GPU, CPU and memory time.
  • Not free: you need a card on file, usage above $30 is billed, and Modal's per-token Shared Endpoints never use the credit.
  • The trap: you also pay while a model loads and while an idle server waits for its next request.
  • The fix: cap the workspace at $30, require a token, and stop the container when you finish.

How many GPU hours $30 buys

Modal's pricing page lists GPU prices per second. Multiply by 3,600 for the hourly rate, then divide $30 by it:

GPUGPU memoryPrice per hourHours for $30
H200141 GB$4.546.6
H10080 GB$3.957.6
RTX PRO 600096 GB$3.039.9
A100 80 GB80 GB$2.5012.0
A100 40 GB40 GB$2.1014.3
L40S48 GB$1.9515.4
A1024 GB$1.1027.2
L424 GB$0.8037.5
T416 GB$0.5950.8

Treat these as ceilings. CPU cores and memory are metered alongside the GPU, so a real workload gets a little less. Pinning containers to a region multiplies prices by 1.15 to 1.75, so leave placement to Modal unless you need it. One small bonus: according to Modal's GPU guide, a plain gpu="H100" request may run on an H200 at no extra cost.

The fine print

  • A card is required. Modal's billing docs say you must have a payment method on file to use Modal. Anything above the monthly $30 is charged to it.
  • The credit covers compute only. It pays for GPU, CPU and memory time. It does not apply to Shared Endpoints, Modal's per-token model APIs, which are billed from the first request. OpenCode's built-in “Modal” provider is set up for those Shared Endpoints, so it is not the free route.
  • Startup time is billed. Modal bills while your application loads, so every cold start of a large model costs a few minutes of GPU time.
  • Idle time is billed. After the last request, a container stays up for its scaledown_window, and you pay for that wait. Modal's default is 60 seconds. The vLLM example uses 15 minutes.
  • Starter limits. Three workspace seats and up to 10 GPUs at a time, which is plenty for one person.
Cap it at $30 before you deploy

On the Usage & Billing page in Modal's settings, set the Workspace budget to $30. Modal's budget docs describe it as a hard monthly cap on usage before credits, and the default spend limit is that budget minus your credits: $0 in this case. When a limit is reached, Modal stops the workloads that would cost you money.

What Modal's vLLM example sets up

The example is vllm_inference.py in Modal's examples repository. It serves Gemma 4 26B A4B with vLLM behind an OpenAI-style /v1 API. Gemma 4 26B A4B is an Apache 2.0 mixture-of-experts model from Google DeepMind: 25.2 billion parameters in total, 3.8 billion active per token, and a context window of up to 256K tokens. The example also turns on vLLM's tool-call parser, which coding agents need to run commands and edit files.

A handful of its settings decide your bill:

Setting in the exampleValueWhat it means for your credit
gpuOne H200About $4.54 an hour while a container runs
scaledown_window15 minutesUp to $1.13 of idle time after your last request
unauthenticatedTrueAnyone who finds the URL can use your GPU and keep it awake
FAST_BOOTFalseFaster generation, slower cold starts
min_containersNot setScales to zero after the idle window, so no requests means no GPU bill

The open endpoint is the setting to fix first. The URL follows a predictable pattern built from your workspace name and the app name, and every request from a stranger can start or extend a billed GPU session.

Run it in six steps

  1. Create an account and install the CLI

    Sign up at modal.com (GitHub login works), add a payment method and set the $30 budget. Then install the Python client and log in:

    pip install modal
    modal setup

    If modal setup doesn't work, try python -m modal setup. The client needs Python 3.10 or newer.

  2. Get the example

    git clone https://github.com/modal-labs/modal-examples
    cd modal-examples/06_gpu_and_ml/llm-serving
  3. Require a token before you deploy

    Open vllm_inference.py, find the @app.server(...) decorator and delete the unauthenticated=True line. Modal Servers require authentication by default, so the proxy will then answer requests without a valid token with a 401 error. Modal says those requests don't count toward autoscaling, so strangers can't wake your GPU. While you're there, consider a shorter idle window:

    vllm_inference.py (excerpt)
    @app.server(
        image=vllm_image,
        gpu=f"H200:{N_GPU}",
        scaledown_window=5 * MINUTES,  # was 15 * MINUTES
        startup_timeout=10 * MINUTES,
        volumes={
            "/root/.cache/huggingface": hf_cache_vol,
            "/root/.cache/vllm": vllm_cache_vol,
        },
        port=VLLM_PORT,
        routing_region=ROUTING_REGION,
        target_concurrency=100,
        # the unauthenticated=True line is gone
    )
  4. Create a proxy token

    modal workspace proxy-tokens create --name coding-agent

    It prints a token ID that starts with wk- and a secret that starts with ws-. Copy the secret now, because Modal shows it only once. You can also create tokens in the dashboard settings. Join the two parts with a period and keep the result in an environment variable, not in a file you might commit:

    export MODAL_LLM_TOKEN="wk-YOUR-ID.ws-YOUR-SECRET"
  5. Deploy

    modal deploy vllm_inference.py

    The command builds the container image and prints your server's URL, which looks like https://your-workspace--example-vllm-inference-server.us-east.modal.direct. Your API base URL is that address plus /v1. The first time the server starts, vLLM also downloads roughly 52 GB of weights into a Modal Volume. That first boot is the slowest, and it's billed like any other. Later boots load from the Volume.

  6. Wake it up and test it

    A server with no running containers answers 503 Service Unavailable and starts booting in the background; Modal doesn't hold requests in a queue. Poll the health check until it answers, then list the models. Replace the placeholder with the URL that modal deploy printed:

    export URL="<your server URL>"
    export AUTH="Authorization: Bearer $MODAL_LLM_TOKEN"
    until curl -sf -H "$AUTH" "$URL/health"; do sleep 10; done; echo ready
    curl -s -H "$AUTH" "$URL/v1/models"

    The list should include llm, the short model name the example registers. If the loop never finishes, run curl -i -H "$AUTH" "$URL/health" once: a 401 means the token is wrong, and a 503 means the server is still starting.

Connect OpenCode or Cline

Any client that takes an OpenAI-compatible base URL and an API key will work. Modal's proxy token docs say the combined wk-….ws-… value can be sent as a normal Authorization: Bearer header, which is exactly how OpenAI-style clients send API keys.

OpenCode

Add a custom provider to opencode.json in your project. Give it your own ID rather than modal, so it stays separate from OpenCode's built-in Modal provider:

opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "modal-gpu": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "My Modal GPU",
      "options": {
        "baseURL": "https://your-workspace--example-vllm-inference-server.us-east.modal.direct/v1",
        "apiKey": "{env:MODAL_LLM_TOKEN}"
      },
      "models": {
        "llm": {
          "name": "Gemma 4 26B A4B",
          "limit": { "context": 131072, "output": 16384 }
        }
      }
    }
  }
}

Start OpenCode with MODAL_LLM_TOKEN set, run /models and pick the model. Gemma 4 26B A4B supports up to 256K tokens of context; 128K is a safe starting value for limit.context. Raise it if the maximum model length in vLLM's startup log is higher.

Cline

In Cline's settings, choose the OpenAI Compatible provider and fill in:

  • Base URL: your server URL plus /v1
  • API Key: the combined wk-….ws-… token
  • Model: llm
  • Context Window size (under Model Configuration): 131072 to start
Wake it before each session

Run the health-check loop before you open your agent. A cold start takes minutes, which is longer than most clients keep retrying, so the first prompt to a sleeping server usually fails with a 503.

Make the free hours last

Here's where one evening of coding goes on the example's H200. The five-minute cold start is only an illustration; yours depends on the model and on caching. GPU charges only:

Part of the sessionMinutesCost
Cold start (loading the model)5$0.38
Active coding45$3.40
Idle timer after the last request15$1.13
Total65$4.92

That's about six sessions a month. Drop the idle row and you get closer to eight. These habits stretch the credit further:

  • Stop the container when you're done. Don't wait out the timer. modal container list shows running containers, and modal container stop <container-id> ends one. The app stays deployed, and the next request starts a fresh container.
  • Shorten the idle window. Modal accepts anything from 2 seconds to 20 minutes. Five minutes suits a single developer, at the price of more cold starts.
  • Consider FAST_BOOT = True. The example recommends it for servers that often scale from zero. It skips compilation steps to boot faster, at some cost in generation speed.
  • Try a cheaper GPU. The model's roughly 52 GB of weights also fit on an 80 GB card such as "H100" (7.6 hours) or "A100-80GB" (12 hours), with less room left for long contexts. If vLLM refuses to start, lower its --max-model-len.
  • Watch the usage page in Modal's dashboard after your first few sessions to learn your real burn rate.
  • Finished for good? modal app stop example-vllm-inference removes the app. You can deploy it again later.

Which model should you host first?

Start with the example as written. Modal has already tuned the vLLM flags for Gemma 4 26B A4B, including tool calling, its reasoning parser and speculative decoding. Because only 3.8 billion parameters are active for each token, Google says it runs almost as fast as a 4B model.

When you try other models, size the GPU from the weights first:

Weight formatMemory per billion parametersA 26B model needs about
BF16 or FP162 GB52 GB
FP81 GB26 GB
4-bit0.5 GB13 GB

Then leave headroom for the KV cache, which grows with context length and the number of parallel requests. Coding agents send long prompts, so spare GPU memory matters more for them than for casual chat.

Prefer not to edit Python? Modal's Dedicated Endpoints deploy a supported model with one command, for example modal endpoint create --name qwen-chat --model Qwen/Qwen3.6-27B-FP8. They scale to zero, require a proxy token by default and bill at standard compute rates. Modal picks the serving setup, so open the endpoint's Source view in the dashboard and check the GPU and idle window before relying on the hours above. modal endpoint info qwen-chat shows the URL, and clients send the endpoint's name as the model.

FAQ

Is it really free?

Up to $30 of compute a month, yes. You still need a card on file, and usage beyond the allowance is billed unless a budget stops it first.

Why does my agent get a 503 error?

The server scaled to zero. Your request started a new container, but Modal doesn't hold requests while it boots. Run the wake-up loop, then try again.

Can teammates use it?

Yes. Anyone with a proxy token can call the API, so give each person their own token and delete it when they no longer need access. Everyone draws on the same $30, though.

Does my code go to a model vendor?

Prompts go to a container in your own Modal workspace, not to a hosted model API. Modal still runs the hardware, so check its terms if your code is sensitive.

Can I get more free credit?

Modal lists credit programs for startups and up to $10,000 for academic researchers. The Team plan costs $250 a month and includes $100 of compute.

Sources and further reading

Prices and docs checked November 3, 2026. Modal can change its plans, prices and free credits at any time.