Ir al contenido
GET /v1/compare

Compare two appliances + payback

Pruébalo en vivo

10 llamadas gratis al día — sin registro, sin clave API. Pasa por el gateway de oanor.

Encabezados personalizados (opcional)
api.oanor.com/energycost-api

Funciona. Consigue una clave API y úsala en tu proyecto.

Obtener una clave API

Fragmentos de código

curl "https://api.oanor.com/energycost-api/v1/compare" \
  -H "x-oanor-key: oanor_test_..."
await fetch("https://api.oanor.com/energycost-api/v1/compare", {
  headers: { "x-oanor-key": "oanor_test_..." }
});
$ch = curl_init("https://api.oanor.com/energycost-api/v1/compare");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["x-oanor-key: oanor_test_..."]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$out = curl_exec($ch);
import requests
requests.get(
    "https://api.oanor.com/energycost-api/v1/compare",
    headers={"x-oanor-key": "oanor_test_..."}
)

Respuesta de ejemplo

Una respuesta real de este endpoint, capturada en la última comprobación de estado.

{
    "data": {
        "note": "Positive annual_saving_with_b means device B costs less to run. Payback uses the extra purchase cost of B ÷ annual saving.",
        "input": {
            "days": 365,
            "extra_cost": 0,
            "rate_per_kwh": 0.3
        },
        "cheaper": "b",
        "device_a": {
            "power_kw": 0.1,
            "annual_kwh": 182.5,
            "annual_cost": 54.75,
            "hours_per_day": 5
        },
        "device_b": {
            "power_kw": 0.06,
            "annual_kwh": 109.5,
            "annual_cost": 32.85,
            "hours_per_day": 5
        },
        "payback_years": null,
        "payback_months": null,
        "annual_saving_with_b": 21.9
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:20.495Z",
        "request_id": "bd09315c-e754-4b95-8118-5b10c1f3009b"
    },
    "status": "ok",
    "message": "Compare appliances",
    "success": true
}