Deploy a serverless GPU inference endpoint on Modal with auto-scaling to zero

domain: modal.com/docs · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Install the Modal Python package and authenticate with modal token new to link your CLI to your Modal account
  2. Define a Modal App and an inference class decorated with @app.cls, specifying the GPU type via the gpu parameter in @modal.method or the container configuration
  3. Use @modal.method() to expose inference logic as an endpoint method; use @modal.web_endpoint() to expose it as an HTTP endpoint if you need a public URL
  4. Build your container image within the Modal definition using modal.Image, installing model dependencies and downloading model weights during the build phase so they are cached in the image
  5. Deploy the app with modal deploy; Modal prints the live endpoint URL and the deployment becomes active with scale-to-zero by default when no requests arrive
  6. Test the endpoint by sending HTTP POST requests to the deployed URL; Modal spins up a container on demand and scales back to zero after the idle timeout

Known gotchas

Related routes

Run serverless GPU inference on Modal with auto-scaling to zero for an LLM
modal.com/docs · 6 steps · unrated
Modal: deploy a serverless GPU function
modal.com/docs · 6 steps · unrated
configure scale-to-zero autoscaling for a hugging face inference endpoint
huggingface.co/docs/inference-endpoints · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans