Beam is serverless, which means your apps will scale-to-zero by default. Billing is based on the lifecycle of your containers. You are only charged when your containers are running.

Usage-Based Pricing

ResourcePer SecondPer Hour
CPU (per core)$0.00002778$0.100008
Memory (per GB)$0.00000069$0.002484
T4$0.00017222$0.62
A10G$0.00046716$1.68
A100-80$0.00177361$6.38

What am I charged for?

You are charged whenever a container is running. This includes:

  • Running any code you’ve defined in a loader
  • Running your application code
  • Any keep_warm_seconds time. By default, REST API containers will stay alive for 60s after the last request. Task Queues, Runs, and Scheduled Jobs are terminated immediately after the task is completed.

You can override the default warm period by setting a keep_warm_seconds of 0 in your function decorator:

app.rest_api(keep_warm_seconds=0)

What am I not charged for?

  • Waiting for a machine to start
  • Pulling your container image

Real-World Example

You’ve deployed a REST API. You’ve added two Python Packages in your Image(), which are loaded when your app first starts.

You’ve also added a keep_warm_seconds=300, which will keep the container alive for 300 seconds (5 minutes) after each request.

app.py
from beam import App, Runtime, Image

app = App(
    name="sentiment-analysis",
    runtime=Runtime(
        cpu=2,
        memory="8Gi",
        image=Image(
            python_version="python3.9",
            python_packages=["transformers", "torch"],
        ),
    ),
)

# This runs once when the container first starts
def load_models():
    return {}

app.rest_api(keep_warm_seconds=300, loader=load_models)
def predict():
    return {}

Let’s pretend you deploy this and call the API. Suppose it takes:

  • 1s to boot your application and run your loader function.
  • 100ms to run your task.
  • 300s to keep the container alive, based on the keep_warm_seconds argument.

You would be billed for a total of 301.1 seconds.