# Lighthouse Audit & Performance Budgets (CI-ready) (`rationalistic_tail/lighthouse-budget-auditor`) Actor

Run real Google Lighthouse on public URLs (no API key, no PageSpeed quota): performance, accessibility, best-practices and SEO scores, Core Web Vitals, top fixes, mobile + desktop, median of up to 3 runs, pass/fail performance budgets for CI, and an AI-ready summary. Failed audits are free.

- **URL**: https://apify.com/rationalistic_tail/lighthouse-budget-auditor.md
- **Developed by:** [Jerry Lin](https://apify.com/rationalistic_tail) (community)
- **Categories:** SEO tools, Developer tools, Agents
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $25.00 / 1,000 lighthouse audit runs

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

### What does Lighthouse Audit & Performance Budgets do?

It runs **real Google Lighthouse** in Chrome on Apify – the same engine behind PageSpeed Insights and Chrome DevTools – for a list of public URLs and returns one clean row per URL and device:

- 📊 **Scores 0–100** for **performance, accessibility, best practices and SEO**
- ⚡ **Core Web Vitals** lab metrics – **LCP, CLS, TBT**, FCP, Speed Index, TTI, server response time – with `good / needs-improvement / poor` ratings
- 🛠️ **Top fixes** with estimated time and byte savings, plus failed accessibility / SEO / best-practice checks
- 📱🖥️ **Mobile and desktop** in the same run
- 🎯 **Median of up to 3 runs** – Lighthouse scores jump between runs; the median run is reported together with the min–max range
- ✅ **Performance budgets for CI/CD** – set *min performance 90*, *max LCP 2500 ms*, *max CLS 0.1*… Each row gets `budgetPassed` + human-readable `budgetFailures`, and the run can **fail on purpose** so your pipeline blocks the deploy
- 🗺️ **Audit a whole site** – optionally pull pages from the site's sitemap
- 🤖 **AI-agent ready** – `OUTPUT_SUMMARY` with averages, worst pages, most common fixes and a one-paragraph `llmSummary`; works through the [Apify MCP server](https://mcp.apify.com)

**No Google API key, no PageSpeed Insights quota.** Pages that cannot be audited (robots.txt disallow, 404, PDFs, errors) return a free row that says why.

### How to use it

1. Add the **URLs to audit**.
2. Pick **devices** (mobile, desktop) and **categories**.
3. Optional: set **budgets** and turn on **Fail the run when a budget fails** for CI.
4. Click **Start**. Open the **Scores** and **Fixes** tables, or `OUTPUT_SUMMARY`.
5. Schedule it daily/weekly or call it from GitHub Actions after each deploy via the Apify API.

#### Example input (CI budget)

```json
{
  "urls": ["https://example.com/", "https://example.com/pricing"],
  "devices": ["mobile", "desktop"],
  "runsPerUrl": 3,
  "minPerformance": 90,
  "maxLcpMs": 2500,
  "maxCls": "0.1",
  "failRunIfBudgetFails": true
}
```

#### Example output row

```json
{
  "url": "https://example.com/",
  "device": "mobile",
  "status": "ok",
  "performance": 86, "accessibility": 98, "bestPractices": 100, "seo": 92,
  "lcpMs": 2890, "tbtMs": 140, "cls": 0.03,
  "ratings": { "lcp": "needs-improvement", "cls": "good", "tbt": "good", "fcp": "good" },
  "budgetPassed": false,
  "budgetFailures": ["performance 86 < 90", "LCP 2890ms > 2500ms"],
  "opportunities": [{ "title": "Eliminate render-blocking resources", "savingsMs": 450 }],
  "runs": 3, "performanceRange": [84, 89]
}
```

### Polite and compliant

- ✅ **robots.txt honored** – disallowed URLs are not audited (and not charged).
- ✅ **One audit at a time**, with a pause between audits (default 3 s, minimum 1 s) – a Lighthouse run loads a page like one normal visitor.
- ✅ **Public pages only** – no login, cookies or CAPTCHA solving.

### How much does it cost?

Pay-per-event pricing – no subscription, no separate compute bill:

| Event | Price |
|---|---|
| `audit-run` – one successful Lighthouse run (one URL × one device × one run) | **$0.025** |
| Actor start (per GB of memory; default 4 GB = 4 events) | **$0.001** |

Examples: 10 URLs on mobile ≈ **$0.25**; 10 URLs on mobile + desktop ≈ **$0.50**. Failed, robots-blocked and non-HTML URLs are free. With `runsPerUrl: 3` you pay for three runs, so keep it at 1 for quick checks. Set a max cost per run and the Actor stops cleanly at the limit.

### Use it from AI agents (MCP)

```
https://mcp.apify.com?tools=rationalistic_tail/lighthouse-budget-auditor
```

An agent can ask "How fast is example.com on mobile and what should I fix first?" and read `OUTPUT_SUMMARY.llmSummary`. Runs with **limited permissions**, so prepaid agent tokens (Apify AGI, x402) work.

### FAQ

**Why do scores differ from PageSpeed Insights?** Both use Lighthouse lab data, but hardware and network location differ. Use the same Actor (and `runsPerUrl: 3`) for consistent trends. Keep the default **4096 MB** memory: on Apify, CPU scales with memory, and less CPU makes mobile performance scores look worse than they are (each row reports Lighthouse's `benchmarkIndex`).

**Does it include real-user (CrUX) data?** No – it measures lab data in Chrome. INP needs real interactions, so TBT is the lab proxy.

**Lighthouse version?** Pinned (currently 12.8.x) and reported in every row as `lighthouseVersion`.

### Other tools by the same developer

- [Broken Link Checker – 404s, Redirects & #Anchors](https://apify.com/rationalistic_tail/broken-link-anchor-checker)
- [Sitemap Extractor, Validator & Generator](https://apify.com/rationalistic_tail/sitemap-validator-generator)
- [Website to RSS / Change Monitor](https://apify.com/rationalistic_tail/website-to-rss-monitor)

# Actor input Schema

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

Public page URLs, e.g. \["https://example.com/"]. Pages disallowed by robots.txt, non-HTML files and error pages are skipped free of charge.

## `devices` (type: `array`):

Lighthouse emulation profiles. mobile = Moto G Power + slow 4G (same as PageSpeed Insights mobile); desktop = desktop preset.

## `categories` (type: `array`):

Lighthouse categories to run. Fewer categories = faster audits.

## `runsPerUrl` (type: `integer`):

Run Lighthouse 1-3 times per URL and device and report the median-performance run, to reduce score noise. Each run is one 'audit-run' event.

## `discoverFromSitemap` (type: `boolean`):

Also audit pages listed in the first URL's sitemap (from robots.txt or /sitemap.xml), up to maxPages.

## `maxPages` (type: `integer`):

Maximum distinct URLs audited per run (1-50).

## `minPerformance` (type: `integer`):

Fail the budget when the performance score (0-100) is lower. 0 = no check.

## `minAccessibility` (type: `integer`):

0-100. 0 = no check.

## `minBestPractices` (type: `integer`):

0-100. 0 = no check.

## `minSeo` (type: `integer`):

0-100. 0 = no check.

## `maxLcpMs` (type: `integer`):

Fail when Largest Contentful Paint is slower, e.g. 2500 (Google 'good'). 0 = no check.

## `maxTbtMs` (type: `integer`):

Fail when Total Blocking Time is higher, e.g. 200. 0 = no check.

## `maxCls` (type: `string`):

Fail when Cumulative Layout Shift is higher, e.g. "0.1". Empty or 0 = no check.

## `failRunIfBudgetFails` (type: `boolean`):

For CI/CD: mark the Actor run as FAILED when any audit misses a budget (results are still saved).

## `maxOpportunities` (type: `integer`):

How many top performance fixes (with estimated savings) to include per row (0-20).

## `saveHtmlReport` (type: `boolean`):

Store the full Lighthouse HTML report per URL and device in the key-value store (REPORT\_\* keys).

## `delayBetweenAuditsMs` (type: `integer`):

Pause between Lighthouse runs (1000-60000 ms). Audits always run one at a time.

## `pageTimeoutSecs` (type: `integer`):

Max wait for page load per audit (20-120 s).

## Actor input object example

```json
{
  "urls": [
    "https://example.com/"
  ],
  "devices": [
    "mobile"
  ],
  "categories": [
    "performance",
    "accessibility",
    "best-practices",
    "seo"
  ],
  "runsPerUrl": 1,
  "discoverFromSitemap": false,
  "maxPages": 10,
  "minPerformance": 0,
  "minAccessibility": 0,
  "minBestPractices": 0,
  "minSeo": 0,
  "maxLcpMs": 0,
  "maxTbtMs": 0,
  "maxCls": "",
  "failRunIfBudgetFails": false,
  "maxOpportunities": 5,
  "saveHtmlReport": false,
  "delayBetweenAuditsMs": 3000,
  "pageTimeoutSecs": 60
}
```

# Actor output Schema

## `audits` (type: `string`):

Scores, Core Web Vitals, budget result and top fixes per URL and device.

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

Averages, budget pass/fail, worst pages and an llmSummary paragraph for AI agents.

## `reports` (type: `string`):

List of stored HTML reports when saveHtmlReport is enabled.

# 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/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("rationalistic_tail/lighthouse-budget-auditor").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/"] }

# Run the Actor and wait for it to finish
run = client.actor("rationalistic_tail/lighthouse-budget-auditor").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/"
  ]
}' |
apify call rationalistic_tail/lighthouse-budget-auditor --silent --output-dataset

```

## MCP server setup

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

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/3AsGrFkwYbq33Wfgc/builds/8pKPvBUfIQ220ruP1/openapi.json
