From f051c9cc7182d40861b4ba746e36f281f4d7c153 Mon Sep 17 00:00:00 2001 From: Michael Novak Date: Mon, 9 Mar 2026 13:31:50 +0100 Subject: [PATCH] feat: Max total charge usd for all pricing models --- .../parameters/actor-run-options/maxTotalChargeUsd.yaml | 6 +++--- ...ctor-tasks@{actorTaskId}@run-sync-get-dataset-items.yaml | 2 +- .../actor-tasks/actor-tasks@{actorTaskId}@run-sync.yaml | 2 +- .../programming_interface/environment_variables.md | 2 +- .../platform/actors/publishing/monetize/pay_per_event.mdx | 2 +- sources/platform/actors/running/store.md | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apify-api/openapi/components/parameters/actor-run-options/maxTotalChargeUsd.yaml b/apify-api/openapi/components/parameters/actor-run-options/maxTotalChargeUsd.yaml index cbfa6daba9..1df0910026 100644 --- a/apify-api/openapi/components/parameters/actor-run-options/maxTotalChargeUsd.yaml +++ b/apify-api/openapi/components/parameters/actor-run-options/maxTotalChargeUsd.yaml @@ -2,9 +2,9 @@ name: maxTotalChargeUsd in: query required: false description: | - Specifies the maximum cost of the run. This parameter is - useful for pay-per-event Actors, as it allows you to limit the amount - charged to your subscription. You can access the maximum cost in your Actor + Specifies the maximum total cost of the run. + Use it to cap the total amount charged for all pricing models. + You can access the maximum cost in your Actor by using the `ACTOR_MAX_TOTAL_CHARGE_USD` environment variable. style: form explode: true diff --git a/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@run-sync-get-dataset-items.yaml b/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@run-sync-get-dataset-items.yaml index 20a3d4e6be..4cae30ccf7 100644 --- a/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@run-sync-get-dataset-items.yaml +++ b/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@run-sync-get-dataset-items.yaml @@ -56,7 +56,7 @@ get: format: double example: 256 - $ref: ../../components/parameters/actor-run-options/maxItems.yaml - # XXX: do we support maxTotalChargeUsd for task runs? + - $ref: ../../components/parameters/actor-run-options/maxTotalChargeUsd.yaml - name: build in: query description: | diff --git a/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@run-sync.yaml b/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@run-sync.yaml index 017ed7f6fc..fd2582e116 100644 --- a/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@run-sync.yaml +++ b/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@run-sync.yaml @@ -53,7 +53,7 @@ get: format: double example: 256 - $ref: ../../components/parameters/actor-run-options/maxItems.yaml - # XXX: do we support maxTotalChargeUsd for task runs? + - $ref: ../../components/parameters/actor-run-options/maxTotalChargeUsd.yaml - name: build in: query description: | diff --git a/sources/platform/actors/development/programming_interface/environment_variables.md b/sources/platform/actors/development/programming_interface/environment_variables.md index b295748a64..80a85d2239 100644 --- a/sources/platform/actors/development/programming_interface/environment_variables.md +++ b/sources/platform/actors/development/programming_interface/environment_variables.md @@ -49,7 +49,7 @@ Here's a table of key system environment variables: | `ACTOR_DEFAULT_REQUEST_QUEUE_ID` | Unique identifier for the default request queue associated with the current Actor run. | | `ACTOR_INPUT_KEY` | Key of the record in the default key-value store that holds the [Actor input](/platform/actors/running/input-and-output#input). | | `ACTOR_MAX_PAID_DATASET_ITEMS` | For paid-per-result Actors, the user-set limit on returned results. Do not exceed this limit. | -| `ACTOR_MAX_TOTAL_CHARGE_USD` | For pay-per-event Actors, the user-set limit on run cost. Do not exceed this limit. | +| `ACTOR_MAX_TOTAL_CHARGE_USD` | For all pricing models, the user-set limit on total run cost. Do not exceed this limit. | | `ACTOR_RESTART_ON_ERROR` | If **1**, the Actor run will be restarted if it fails. | | `APIFY_HEADLESS` | If **1**, web browsers inside the Actor should run in headless mode (no windowing system available). | | `APIFY_IS_AT_HOME` | Contains **1** if the Actor is running on Apify servers. | diff --git a/sources/platform/actors/publishing/monetize/pay_per_event.mdx b/sources/platform/actors/publishing/monetize/pay_per_event.mdx index 313f282533..7f2c6c4a58 100644 --- a/sources/platform/actors/publishing/monetize/pay_per_event.mdx +++ b/sources/platform/actors/publishing/monetize/pay_per_event.mdx @@ -83,7 +83,7 @@ The `eventChargeLimitReached` property checks if the user's limit allows for ano :::info ACTOR_MAX_TOTAL_CHARGE_USD environment variable -For pay-per-event Actors, users set a spending limit through the Apify Console. This limit is available in your Actor code as the `ACTOR_MAX_TOTAL_CHARGE_USD` [environment variable](/platform/actors/development/programming-interface/environment-variables), which contains the user's maximum cost. +All pricing models support a spending limit set through the Apify Console or API. This limit is available in your Actor code as the `ACTOR_MAX_TOTAL_CHARGE_USD` [environment variable](/platform/actors/development/programming-interface/environment-variables), which contains the user's maximum total cost for the run. The Apify SDK's `ChargeResult` respects the user set limit already. ::: diff --git a/sources/platform/actors/running/store.md b/sources/platform/actors/running/store.md index a579b3c829..f0ee2bdf8e 100644 --- a/sources/platform/actors/running/store.md +++ b/sources/platform/actors/running/store.md @@ -187,7 +187,7 @@ You can also see the cost of each run on the run detail itself. ![Pay per event Actor - run detail](./images/store/pay_per_event_price_on_run_detail.png) -#### Can I put a cap on a cost of a single Actor run? +#### Can I put a cap on the cost of a single Actor run? Yes, when starting an Actor run, you can define the maximum limit on the cost of that run. When the Actor reaches the defined limit, it should terminate gracefully. Even if it didn't, for any reason, and kept producing results, we make always sure you are never charged more that your defined limit.