Modal
Serverless cloud platform for AI enabling infrastructure definition via code for model inference, training, and agent sandboxes.
pip install modalAt a Glance & Reviews
About Modal
Modal is a serverless compute platform that solves the problem of slow self-hosted cluster provisioning and paying for idle capacity when training, inference, and batch jobs need GPUs. Developers write Python code locally, and the platform packages it into containers that run in the cloud, scaling on demand and back to zero when jobs finish, with billing based only on actual runtime.
The official documentation describes it as zero-configuration: container environments, hardware specifications, and more are written in code rather than separate configuration files. Python is the primary language for building applications, and JavaScript and Go clients are also provided for calling deployed functions, running Sandboxes, and managing resources.
Its compute primitives fall into three main categories: Functions turn arbitrary Python code into tasks that run in parallel in the cloud and can be called over network interfaces; Sandboxes provide isolated container environments for untrusted code, created and destroyed programmatically on demand; and Services expose capabilities such as model inference as always-on interfaces. All three primitives share the same image, secret, and storage definitions.
Functions are the most commonly used form: add a decorator to an ordinary function and specify the required CPU, memory, or GPU resources. They can be executed remotely in the cloud one at a time, or many inputs can be mapped across many parallel instances for fan-out processing, with official examples covering everything from simple scripts to large-scale parallel workloads.
Images and dependencies are likewise declared in code: the function definition states which Python packages and system dependencies to install, and the platform builds the container image from that. Existing container image files can also be used directly, while large files such as model weights are generally cached in Volumes to avoid re-downloading them on every startup.
GPU specifications are written directly as model names in function parameters, with the official pricing page listing tiers from T4, L4, and A10 up to A100, H100, H200, B200, and B300: lower-priced cards for lightweight inference and high-end cards for training and large-model inference, while multi-GPU and multi-node jobs must be organized separately following the training guides in the documentation.
Sandboxes suit agents and code interpreters: callers can dynamically create isolated environments in code, write files, run commands, and then reclaim them. The official pricing page specifically notes that Sandboxes are billed at the non-preemptible tier, with CPU and memory priced at 3× the list price, so they should be estimated separately from regular Functions when calculating costs.
Inference deployment offers two paths: one is to write service code yourself and deploy it as a web endpoint that scales automatically with request volume; the other is to call ready-made models through the platform's shared endpoints, billed per token. The pricing documentation reminds users that token charges on shared endpoints begin with the first request and are not covered by the compute credits included in each tier.
On the training side, the official documentation provides multiple paths from quickstarts to full examples, including supervised fine-tuning and reinforcement learning with its open-source training library, and existing training code can also be moved onto the platform. Function timeouts are short by default, so long training jobs must explicitly extend the timeout in their definitions and save checkpoints, a point highlighted in both the official billing and timeout documentation.
Data and configuration have supporting primitives: Volumes provide persistent file storage across runs, priced at $0.09 per GiB per month with the first 1 TiB each month free; Secrets inject credentials for external services into the container environment; Schedules run Functions periodically on a timetable; and Queues and Dicts coordinate tasks and share state.
The getting-started steps in the official quickstart guide are short: first create an account on the official website, then run pip install modal to install the Python package, followed by modal setup to complete login authentication—if that command does not work, use python -m modal setup instead—then save the example code as a Python file, add the decorator to the function, and run modal run plus the file path to execute it in the cloud; deploy it as a long-running Service with the deploy command.
Using GPUs has a prerequisite: both the official documentation and pricing documentation state that accounts must have a valid payment method attached. During local debugging, CPU Functions can first be used to verify the workflow before switching to GPU specifications to validate performance and cost.
Billing rules are the key to understanding its cost structure: the official pricing page states billing is per second, with billable time including both application load time and the time containers spend processing inputs. Containers remain for 60 seconds by default after the last input before shutting down, and this period is also billed, though the duration is configurable; once scaled to zero, no further charges apply. CPU and memory are billed on the higher of requested and actual usage, with each container billed at a minimum of 0.125 physical CPU cores and 128 MiB of memory, and one physical CPU core equals 2 vCPUs.
GPUs are billed per second, and converting to hourly rates makes comparison easier: H100 is about $3.95/hour, H200 about $4.54/hour, B200 about $6.25/hour, A100 80GB about $2.50/hour, A10 about $1.10/hour, L4 about $0.80/hour, and T4 about $0.59/hour; CPU is about $0.047/hour per physical CPU core, and memory is about $0.008/hour per GiB, with actual bills summing the GPU, CPU, and memory components.
Two multipliers can amplify the bill: specifying a run region multiplies prices by 1.15× to 1.75×, and choosing non-preemptible execution multiplies them by 3×. Regular Functions are preemptible by default and automatically retry with the same input if interrupted, so long-running jobs should be designed with idempotency and checkpoints in mind.
Plans are offered in three tiers: Starter is $0/month plus pay-as-you-go usage, including $30/month in compute credits, 3 workspace seats, up to 100 containers and 10 concurrent GPUs, 1 TiB/month of free outbound bandwidth, 1-day log retention, and up to 5 scheduled jobs; Team is $250/month plus pay-as-you-go usage, including $100/month in credits, unlimited seats, up to 5,000 containers and 50 concurrent GPUs, 10 TiB/month of free outbound bandwidth, 30-day log retention, plus custom domains, static IP proxies, deployment rollbacks, and environment-level budgets.
Enterprise features custom pricing with volume discounts, higher GPU concurrency, 100 TiB/month of free outbound bandwidth, and enterprise capabilities such as audit logs, Okta single sign-on, HIPAA-related features, and dedicated support channels, while outbound bandwidth exceeding each tier's free allowance is billed at $0.04 per GiB.
Two official onboarding programs are also available: startups can apply for compute credit grants, and university graduate students and labs can apply for academic credits up to the $10,000 cap listed on the pricing page; enterprise customers can also transact through the AWS and GCP marketplaces to apply committed cloud spend toward Modal, though standard cloud provider promotional credits cannot directly offset Modal usage.
Typical scenarios include building autoscaling batch inference pipelines for speech transcription or document recognition that cost almost nothing during off-peak periods and spin up large numbers of instances during traffic spikes; spinning up batch Sandboxes for coding agents to run untrusted code and destroying them immediately afterward; and running model fine-tuning experiments across parallel GPUs that release immediately upon completion rather than renting dedicated machines long-term for short experiments.
Compared with maintaining self-hosted GPU clusters, Modal differs by absorbing container builds, scheduling, and autoscaling into the platform so local code runs elastically in the cloud—at the trade-off that continuously saturated long-running jobs billed per second can cost more in total than monthly rentals, a point the official pricing FAQ acknowledges by noting its unit prices can sometimes appear higher while its advantage lies in bursty and unpredictable workloads; compared with inference clouds that only expose model endpoints, it executes users' own arbitrary code rather than merely calling pre-hosted models.
Frequently Asked Questions
Is Modal free?
Partly. Modal has a free tier; higher limits or advanced features are paid. Check the official site for current plans and limits.