← All tool references

Cooking · not_available

Cost per Serving Calculator

Calculate recipe cost and cost per serving from ingredient rows.

Open public tool

Overview

Category
Cooking
API mode
not_available
Processing
client-side
Privacy
no-data-stored

Public descriptor

The descriptor is available without an API key and supplies this tool’s metadata, schemas, modes, and examples.

GET /api/v1/tools/cost-per-serving-calculator

View this descriptor as JSON

Execute availability

This tool is documented as a browser capability. Its execute route does not produce a server-side result; when execution is enabled, it responds with browser_interaction_required and points callers to the public tool page.

POST /api/v1/tools/cost-per-serving-calculator/execute

Authentication is not issued during the preview. A bearer API key is planned for execution after launch.

Input schema

object object; additional properties are not accepted.

ingredients · string · required
Enter ingredients and costs.
servings · number · required
Enter servings.
{
    "type": "object",
    "properties": {
        "ingredients": {
            "type": "string",
            "description": "Enter ingredients and costs."
        },
        "servings": {
            "type": "number",
            "description": "Enter servings."
        }
    },
    "required": [
        "ingredients",
        "servings"
    ],
    "additionalProperties": false
}

Output schema

On a successful execution, schema values appear in data.result.values.

recipe_cost · number
Total recipe cost produced by the tool.
cost_per_serving · number
Cost per serving produced by the tool.
ingredients · array
Ingredient costs produced by the tool.
{
    "type": "object",
    "properties": {
        "recipe_cost": {
            "type": "number",
            "description": "Total recipe cost produced by the tool."
        },
        "cost_per_serving": {
            "type": "number",
            "description": "Cost per serving produced by the tool."
        },
        "ingredients": {
            "type": "array",
            "description": "Ingredient costs produced by the tool."
        }
    },
    "additionalProperties": false
}

Cost per Serving Calculator worked example

The request body follows the published input schema. The response below shows the success-envelope shape returned after execution is available.

curl -X POST "https://utilitypages.org/api/v1/tools/cost-per-serving-calculator/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "ingredients": "Flour|1.25\nCheese|4.80\nTomatoes|2.40\nHerbs|0.95",
    "servings": 8
}'
{
    "ok": true,
    "data": {
        "slug": "cost-per-serving-calculator",
        "result": {
            "values": {
                "recipe_cost": 9.4000000000000003552713678800500929355621337890625,
                "cost_per_serving": 1.1799999999999999378275106209912337362766265869140625,
                "ingredients": [
                    {
                        "ingredient": "Flour",
                        "cost": 1.25
                    },
                    {
                        "ingredient": "Cheese",
                        "cost": 4.79999999999999982236431605997495353221893310546875
                    },
                    {
                        "ingredient": "Tomatoes",
                        "cost": 2.399999999999999911182158029987476766109466552734375
                    },
                    {
                        "ingredient": "Herbs",
                        "cost": 0.9499999999999999555910790149937383830547332763671875
                    }
                ]
            },
            "display": {
                "display": "9.4"
            },
            "warnings": [],
            "assumptions": [],
            "steps": []
        }
    },
    "meta": [],
    "request_id": "req_example_123"
}

Errors

api_not_launched · 503
Returned by the current launch gate for every execute request.
invalid_json · 400
Returned when an enabled execute request does not contain valid JSON.
validation_failed · 422
Returned when a request does not satisfy the input schema.
browser_interaction_required · 422
Returned for browser capability tools instead of inventing a server-side result.
tool_not_found · 404
Returned when a requested descriptor slug does not exist.
execution_failed · 503
Returned when an enabled server-side execution cannot complete.