# Performance Budget Receipts (`muazah/perf-budget-receipts`) Actor

- **URL**: https://apify.com/muazah/perf-budget-receipts.md
- **Developed by:** [muazah](https://apify.com/muazah) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$80.00 / 1,000 url/device bundle (3 lighthouse runs)s

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Performance Budget Receipts

A release gate, not a speed score: three sequential Lighthouse lab runs per URL, median and min/max evidence, and assertions against the budget you declare.

### What it does

- Runs Lighthouse 3 times sequentially per URL (never concurrent audits on one machine), same cold-cache condition and fixed mobile or desktop emulation every run.
- Reports every raw run plus median and min/max range for LCP, CLS, TBT, FCP, Speed Index, total bytes, request count, script bytes, and the performance category score.
- Budget assertions in metric units (lcpMs, tbtMs, cls, scriptBytes, totalBytes, requestCount...): median vs your limit decides PASS or BUDGET\_EXCEEDED. If the run range crosses your limit, you get a RANGE\_CROSSES\_LIMIT warning, because one threshold is not statistical proof of regression.
- Baselines with an environment fingerprint (tool version, Chrome version, device): comparison is refused as BASELINE\_INCOMPATIBLE unless the fingerprint matches exactly. Deltas are reported in metric units, not score points. A failing run is never auto-promoted to baseline - you save baselines explicitly.
- Raw Lighthouse JSON for every run and an HTML report per URL in your run's key-value store, plus an assertions CSV.
- Missing metrics come back null with an UNVERIFIABLE warning, never zero.

### Honest limits

- Lab metrics under simulated throttling are not field Core Web Vitals. This does not determine whether Google considers your page passing, and TBT is not INP.
- Lighthouse itself is variable: shared CPU and network move numbers. That is why you get the range, not just one run.
- Public HTTPS pages only, up to 5 URLs per run. You must be authorized to test the pages you point it at.

### Input

```json
{
  "urls": ["https://yoursite.com/release-candidate"],
  "device": "mobile",
  "budgets": { "lcpMs": 2500, "tbtMs": 300, "scriptBytes": 300000 },
  "monitorKey": "release-gate",
  "saveBaselineAs": "v42"
}
```

### Output

url\_receipt rows (status SNAPSHOT / PASS / BUDGET\_EXCEEDED / INCOMPLETE / BASELINE\_INCOMPATIBLE), assertion rows, raw Lighthouse JSON/HTML artifacts, assertions.csv and a summary in the run's key-value store.

### Billing

Pay per completed URL/device bundle of three runs. A bundle that could not finish all three runs is INCOMPLETE, uncharged, and its partial raw evidence is kept and marked.

# Actor input Schema

## `urls` (type: `array`):

Up to 5 public HTTPS pages you are authorized to test. Each gets 3 sequential Lighthouse lab runs on one device.

## `device` (type: `string`):

Fixed Lighthouse emulation and throttling preset for the whole run.

## `budgets` (type: `object`):

Declared limits in metric units: lcpMs, tbtMs, cls, fcpMs, speedIndexMs, scriptBytes, totalBytes, requestCount. Median vs limit decides PASS/BUDGET\_EXCEEDED; range overlap adds a warning.

## `monitorKey` (type: `string`):

Namespaces stored baselines.

## `baselineId` (type: `string`):

Compare against a stored baseline. Refused with BASELINE\_INCOMPATIBLE unless tool/device/environment fingerprint matches exactly.

## `saveBaselineAs` (type: `string`):

Store this run's medians under an ID for later comparison. Never automatic: a failing run is never promoted to baseline.

## Actor input object example

```json
{
  "urls": [
    "https://example.com"
  ],
  "device": "mobile",
  "monitorKey": "default"
}
```

# Actor output Schema

## `receiptRows` (type: `string`):

One url\_receipt per URL (3 runs, medians, ranges, status) plus per-budget assertion rows.

## `summary` (type: `string`):

URLs, device, billable bundles, counts by status and the environment fingerprint.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "https://example.com"
    ],
    "device": "mobile",
    "monitorKey": "default"
};

// Run the Actor and wait for it to finish
const run = await client.actor("muazah/perf-budget-receipts").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "urls": ["https://example.com"],
    "device": "mobile",
    "monitorKey": "default",
}

# Run the Actor and wait for it to finish
run = client.actor("muazah/perf-budget-receipts").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "https://example.com"
  ],
  "device": "mobile",
  "monitorKey": "default"
}' |
apify call muazah/perf-budget-receipts --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,muazah/perf-budget-receipts"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/oNC3eIuy8sUHqw3nb/builds/Pmwkv4eYzsqgLGYqL/openapi.json
