# PackPrice — Pack Size & Unit Price Normalizer (`modernistic_syllable/packprice`) Actor

Compare product offers by price per kg, litre or item. Convert multipacks like 6 x 500 mL into 3 L from JSON or Apify datasets. Unclear sizes are flagged; pay only for normalized offers.

- **URL**: https://apify.com/modernistic\_syllable/packprice.md
- **Developed by:** [ColegaMedico](https://apify.com/modernistic_syllable) (community)
- **Categories:** E-commerce, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$20.00 / 1,000 normalized offers

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

## PackPrice — Pack Size & Unit Price Normalizer

Turn package sizes into comparable unit prices. Normalize metric weights, volumes and item counts from structured offers or an existing Apify dataset. No website crawling, API key for AI, or probabilistic quantity guessing.

**Example:** `Water 6 x 500 mL` at $18 is **3 L at $6/L**. `Water 1 L` at $7 is **$7/L**. The cheaper unit price is identified only when you explicitly assign both offers to the same equivalence group.

### Input

```json
{"offers":[
  {"id":"a","title":"Water 6 x 500 mL","price":18,"currency":"USD","groupId":"same-water"},
  {"id":"b","title":"Water 1 L","price":7,"currency":"USD","groupId":"same-water"}
]}
```

Alternatively, use `{"datasetId":"YOUR_DATASET_ID"}`. The run must have permission to read the dataset. Maximum 1,000 rows / 2 MB per run; larger datasets are rejected rather than truncated.

Required per offer: `id`, `title`, numeric `price`, ISO `currency`. Optional: `groupId`, `quantity`, `unit`, `packCount`. Explicit quantity is **per pack**, multiplied by packCount (default 1). It must not contradict quantities in the title. Extra unrecognized fields should be removed before submission.

### Results

Each row includes `status`, `totalQuantity`, `normalizedUnit` (`L`, `kg`, `item`), `unitPrice`, `evidence` and `reason`. Unclear quantities return `ambiguous` or `unsupported`; they never become guessed numbers. Output files in the run's key-value store:

- `OUTPUT`: results, comparisons and run summary.
- `COMPARISONS`: rankings within your group + currency + measurement dimension.
- `SUMMARY`: delivered counts, charged counts and budget skips.
- `results-<batch-key>`: durable arrays of results with `resultKey`, including recovery after an interrupted run. Older builds use individual `result-<key>` receipts.

No currency conversion. No automatic product equivalence or clinical substitution. Price means the price you supply; shipping, taxes, discounts and deposits are not inferred. Imperial sizes, mixed bundles, dosage/nutrition contexts, conflicting identifiers and unrecognized grammar are intentionally rejected.

### Pricing and recovery

Intended paid configuration: **$0.02 per normalized offer**. The Apify Pricing tab is authoritative; a private, unmonetized test is not a sale. No paid event is created for rejected or duplicate input. Set `maxTotalChargeUsd` when starting a paid run. Results beyond your budget are skipped and counted explicitly.

A durable receipt is stored before charging. Each charge uses a stable provider idempotency key. Resurrecting the **same run with unchanged input, build, billing mode and buyer budget** recovers results without charging again. A new run is a new purchase. Internal duplicates use the same receipt; conflicting versions of the same offer ID are rejected. When an interrupted run lacks OUTPUT, saved `results-*` batch receipts remain available. A batch reaches the dataset after its charges complete; a failed batch is safely retried with the original charge keys.

### Integrations and privacy

Use the Apify API, schedules, or an existing automation. Map Google Shopping scraper fields (`title`, `priceNumeric`, `currency`) to offers and supply your own equivalence groups. PackPrice is independent and does not claim a partnership with other Actors.

Inputs are processed inside your Apify run. No customer data is sent to an external language model or arbitrary URL. Data follows your Apify storage retention settings. Support is available through the Actor's Issues tab; include a minimal non-confidential failing example.

# Actor input Schema

## `offers` (type: `array`):

Each offer requires id, title, numeric price and uppercase ISO currency. groupId is your assertion that products are equivalent. Optional quantity is per pack, unit is metric or count, and packCount multiplies it.

## `datasetId` (type: `string`):

Use instead of offers. Grants this run read-only access to the selected dataset. All rows must follow the offer schema.

## Actor input object example

```json
{
  "offers": [
    {
      "id": "six-bottles",
      "title": "Water 6 x 500 mL",
      "price": 18,
      "currency": "USD",
      "groupId": "same-water"
    },
    {
      "id": "one-bottle",
      "title": "Water 1 L",
      "price": 7,
      "currency": "USD",
      "groupId": "same-water"
    }
  ]
}
```

# Actor output Schema

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

Delivered normalized, ambiguous and unsupported offers with stable result keys.

## `comparisons` (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 = {
    "offers": [
        {
            "id": "six-bottles",
            "title": "Water 6 x 500 mL",
            "price": 18,
            "currency": "USD",
            "groupId": "same-water"
        },
        {
            "id": "one-bottle",
            "title": "Water 1 L",
            "price": 7,
            "currency": "USD",
            "groupId": "same-water"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("modernistic_syllable/packprice").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 = { "offers": [
        {
            "id": "six-bottles",
            "title": "Water 6 x 500 mL",
            "price": 18,
            "currency": "USD",
            "groupId": "same-water",
        },
        {
            "id": "one-bottle",
            "title": "Water 1 L",
            "price": 7,
            "currency": "USD",
            "groupId": "same-water",
        },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("modernistic_syllable/packprice").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 '{
  "offers": [
    {
      "id": "six-bottles",
      "title": "Water 6 x 500 mL",
      "price": 18,
      "currency": "USD",
      "groupId": "same-water"
    },
    {
      "id": "one-bottle",
      "title": "Water 1 L",
      "price": 7,
      "currency": "USD",
      "groupId": "same-water"
    }
  ]
}' |
apify call modernistic_syllable/packprice --silent --output-dataset

```

## MCP server setup

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

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/gZaf4Kjua9Z80yu6h/builds/xYxzPXzPN4QLjVgYn/openapi.json
