# Pack Size & Unit Price Comparator (`cooing_openness/pack-price-comparator`) Actor

Compare pack sizes and unit prices in product pairs. Parse multipacks, normalize units and flag ambiguous comparisons. Bring your own product data.

- **URL**: https://apify.com/cooing\_openness/pack-price-comparator.md
- **Developed by:** [Роман Стружков](https://apify.com/cooing_openness) (community)
- **Categories:** E-commerce
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Pack Size & Unit Price Comparator

Compare pack sizes and unit prices in product pairs you already collected. Use it after an Amazon, Walmart or other retailer export to check quantity-based comparisons before reviewing prices.

Supply `pairs`, a list of objects with a unique `id` and `left`/`right` offers. Each offer needs a positive `price`, a matching three-letter uppercase `currency`, and a separate `packSize` string. Choose the product pairs yourself: this Actor does not establish that two products have the same brand, model, quality or intended use.

Supported pack expressions are unambiguous quantities in grams/kilograms, milliliters/liters, or counts, including multipacks such as `6 x 500 ml`. Put only the pack expression in `packSize`, not a full product title. Ambiguous units, mixed bundles, ranges and missing information require review instead of a guessed conversion.

Each pair produces a status, reason codes and parsed quantities. `SAME_PACK` means equal total quantity in the same dimension; it does not mean identical physical packaging or identical products. `UNIT_COMPARABLE` means different quantities can be compared in the same dimension. `NOT_COMPARABLE` covers incompatible dimensions or currencies. `NEEDS_REVIEW` identifies invalid or ambiguous input.

Prices per canonical unit use grams, milliliters or individual pieces. Multiply a per-gram price by 1000 to obtain a per-kilogram price, or a per-milliliter price by 1000 for a per-liter price. Decimal strings preserve financial precision; repeating divisions are rounded for display. The cheaper-side decision uses exact cross multiplication rather than the displayed rounded value.

The Actor processes at most 1000 pairs in one run. A malformed top-level input or duplicate pair ID fails the run. A malformed offer is reported in its pair's output so the remaining pairs can still be checked.

This is a data-processing Actor, not a website scraper. It does not open product URLs, fetch missing fields, convert currencies, include shipping or tax automatically, or change marketplace listings. Include the same cost components on both sides when supplying prices.

No external AI service or product-data provider is called. Input and output use Apify's run storage; the Actor does not send them to another service. Do not submit secrets or personal customer information. Apify account access and storage-retention settings still apply.

Launch pricing: no additional developer fee. Apify platform usage charges may apply according to your plan; check the Pricing tab before running. This initial release tests usefulness and does not establish future pricing or merchant demand.

If a comparison is wrong or an expression is rejected unexpectedly, open an issue with the pack strings, expected result and a redacted input example. Do not include tokens, private account links or confidential supplier data. Review the output before changing prices; the Actor provides quantity calculations, not pricing advice.

### Try the example

The input form contains these synthetic examples. Replace them with your own pack expressions and prices. Both sides of each pair must already represent products you intend to compare.

```json
{
  "pairs": [
    {
      "id": "detergent-example",
      "left": {
        "price": "12.50",
        "currency": "USD",
        "packSize": "6 x 500 ml"
      },
      "right": {
        "price": "4.20",
        "currency": "USD",
        "packSize": "1 L"
      }
    },
    {
      "id": "paper-example",
      "left": {
        "price": "9.00",
        "currency": "USD",
        "packSize": "12 pcs"
      },
      "right": {
        "price": "4.50",
        "currency": "USD",
        "packSize": "6 pcs"
      }
    },
    {
      "id": "manual-review-example",
      "left": {
        "price": "5.00",
        "currency": "USD",
        "packSize": "12 oz"
      },
      "right": {
        "price": "6.00",
        "currency": "USD",
        "packSize": "500 g"
      }
    }
  ]
}
```

# Actor input Schema

## `pairs` (type: `array`):

Already matched product pairs. Each offer needs price, currency and a separate packSize expression. The prefilled data are synthetic examples.

## Actor input object example

```json
{
  "pairs": [
    {
      "id": "detergent-example",
      "left": {
        "price": "12.50",
        "currency": "USD",
        "packSize": "6 x 500 ml"
      },
      "right": {
        "price": "4.20",
        "currency": "USD",
        "packSize": "1 L"
      }
    },
    {
      "id": "paper-example",
      "left": {
        "price": "9.00",
        "currency": "USD",
        "packSize": "12 pcs"
      },
      "right": {
        "price": "4.50",
        "currency": "USD",
        "packSize": "6 pcs"
      }
    },
    {
      "id": "manual-review-example",
      "left": {
        "price": "5.00",
        "currency": "USD",
        "packSize": "12 oz"
      },
      "right": {
        "price": "6.00",
        "currency": "USD",
        "packSize": "500 g"
      }
    }
  ]
}
```

# Actor output Schema

## `results` (type: `string`):

No description

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

No description

# 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 = {
    "pairs": [
        {
            "id": "detergent-example",
            "left": {
                "price": "12.50",
                "currency": "USD",
                "packSize": "6 x 500 ml"
            },
            "right": {
                "price": "4.20",
                "currency": "USD",
                "packSize": "1 L"
            }
        },
        {
            "id": "paper-example",
            "left": {
                "price": "9.00",
                "currency": "USD",
                "packSize": "12 pcs"
            },
            "right": {
                "price": "4.50",
                "currency": "USD",
                "packSize": "6 pcs"
            }
        },
        {
            "id": "manual-review-example",
            "left": {
                "price": "5.00",
                "currency": "USD",
                "packSize": "12 oz"
            },
            "right": {
                "price": "6.00",
                "currency": "USD",
                "packSize": "500 g"
            }
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("cooing_openness/pack-price-comparator").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 = { "pairs": [
        {
            "id": "detergent-example",
            "left": {
                "price": "12.50",
                "currency": "USD",
                "packSize": "6 x 500 ml",
            },
            "right": {
                "price": "4.20",
                "currency": "USD",
                "packSize": "1 L",
            },
        },
        {
            "id": "paper-example",
            "left": {
                "price": "9.00",
                "currency": "USD",
                "packSize": "12 pcs",
            },
            "right": {
                "price": "4.50",
                "currency": "USD",
                "packSize": "6 pcs",
            },
        },
        {
            "id": "manual-review-example",
            "left": {
                "price": "5.00",
                "currency": "USD",
                "packSize": "12 oz",
            },
            "right": {
                "price": "6.00",
                "currency": "USD",
                "packSize": "500 g",
            },
        },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("cooing_openness/pack-price-comparator").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 '{
  "pairs": [
    {
      "id": "detergent-example",
      "left": {
        "price": "12.50",
        "currency": "USD",
        "packSize": "6 x 500 ml"
      },
      "right": {
        "price": "4.20",
        "currency": "USD",
        "packSize": "1 L"
      }
    },
    {
      "id": "paper-example",
      "left": {
        "price": "9.00",
        "currency": "USD",
        "packSize": "12 pcs"
      },
      "right": {
        "price": "4.50",
        "currency": "USD",
        "packSize": "6 pcs"
      }
    },
    {
      "id": "manual-review-example",
      "left": {
        "price": "5.00",
        "currency": "USD",
        "packSize": "12 oz"
      },
      "right": {
        "price": "6.00",
        "currency": "USD",
        "packSize": "500 g"
      }
    }
  ]
}' |
apify call cooing_openness/pack-price-comparator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,cooing_openness/pack-price-comparator"
        }
    }
}
```

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/uYBS2lrqpRcnEHkVi/builds/GfsC8RmwyIKUAdfrZ/openapi.json
