# Coordinador Eléctrico Chile – Costo Marginal y Generación (`better-llama/coordinador-electrico-chile`) Actor

Normalized data from the official Coordinador Eléctrico Nacional (Chile) SIP API: marginal costs per bus, real generation, demand, plants, lines and outages, using your own free API key. Not affiliated with the Coordinador.

- **URL**: https://apify.com/better-llama/coordinador-electrico-chile.md
- **Developed by:** [Francisco Rubio](https://apify.com/better-llama) (community)
- **Categories:** Developer tools, AI
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 resultado entregado / delivered results

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

## Coordinador Eléctrico Chile – Costo Marginal y Generación

**ES** · Datos del **Sistema Eléctrico Nacional** de Chile, normalizados para agentes de IA y desarrolladores: **costos marginales por barra**, generación real por central, demanda, catálogo de centrales y líneas, limitaciones y energía no suministrada. Se obtienen de la **API oficial SIP (Sistema de Información Pública) del Coordinador Eléctrico Nacional** usando **tu propia API Key**.
**EN** · Chile's national grid data — **locational marginal prices per bus**, real generation per plant, demand, plant and line catalogs, outages — normalized for AI agents and developers, from the **official Coordinador Eléctrico Nacional SIP API**, using **your own API key**.

> ⚠️ **Se requiere API Key propia / Your own API key is required.** Es gratuita y se activa al instante: regístrate en <https://portal.api.coordinador.cl>, elige el plan **«Sistema de Información Pública»**, confirma tu correo y copia la **Credencial** desde *Aplicaciones*. Este Actor **no incluye, comparte ni revende claves**: cada ejecución usa la tuya.
>
> ⚠️ **No afiliado / Not affiliated.** Proyecto independiente. **No está afiliado, patrocinado ni aprobado por el Coordinador Eléctrico Nacional (CEN)**. El nombre se usa solo para describir la fuente de los datos.
>
> **Fuente / Data source:** Coordinador Eléctrico Nacional, Sistema de Información Pública (<https://www.coordinador.cl>). Cada registro incluye `dataSource` con esta atribución.

### Uso con agentes de IA (MCP)

Agrega el Actor como herramienta MCP en Claude, Cursor, ChatGPT u otro cliente compatible:

```
https://mcp.apify.com/?tools=better-llama/coordinador-electrico-chile
```

Ejemplos de preguntas: *«¿Cuál fue el costo marginal en la barra Crucero 220 ayer a las 15:00?»*, *«¿Cuánta energía solar se generó el lunes?»*, *«¿Qué instalaciones tuvieron limitaciones esta semana?»*.

### Conjuntos de datos / Datasets

| `dataset` | Ruta oficial | Qué entrega | Unidad |
|---|---|---|---|
| `costo_marginal_online` | `/costo-marginal-online/v4/findByDate` | CMg preliminar por barra, cada 15 min | USD/MWh (+ CLP/kWh) |
| `costo_marginal_real` | `/costo-marginal-real/v4/findByDate` | CMg definitivo por barra (se publica con semanas de desfase) | USD/MWh (+ CLP/kWh) |
| `generacion_real` | `/generacion-real/v3/findByDate` | Generación horaria por central, tecnología y propietario | MW |
| `generacion_diaria` | `/generacion-real/v3/getDailySum` | Total diario por tecnología (solar, eólica, hidráulica, térmica…) | MWh |
| `demanda_neta` | `/demanda-neta/v4/findByDate` | Demanda neta, generación bruta y ERV por hora | MWh |
| `demanda_real_estimada` | `/demanda-real-estimada/v4/findByDate` | Retiros estimados por barra y suministrador | kWh |
| `centrales` | `/centrales/v4/findByDate` | Catálogo de centrales (tecnología, potencia, región, comuna) | MW |
| `lineas_transmision` | `/lineas-transmision/v4/findByDate` | Catálogo de líneas | — |
| `limitaciones_transmision` | `/limitaciones-transmision/v4/findByDate` | Limitaciones y perturbaciones con retorno estimado | MW |
| `instrucciones_sscc` | `/instrucciones-operacionales-sscc/v4/findByDate` | Instrucciones de servicios complementarios | MW |
| `energia_no_suministrada` | `/energia-no-suministrada/v4/findByDate` | ENS por interrupción, comunas y empresa afectada | MWh |

- **Fechas:** `startDate` / `endDate` en AAAA-MM-DD (hora de Chile), máximo 31 días por ejecución. Por defecto, **ayer**.
- **Filtro:** la API no filtra por barra; usa `filter` (p. ej. `"crucero"`) y el Actor descarta el resto antes de entregar. Solo se cobra lo entregado.
- **Volumen:** un día de costo marginal son ~145.000 filas (≈1.500 barras × 96 cuartos de hora). Usa `filter` y `maxItems`.
- **Horas:** `localDateTime` es la hora de Chile tal como la publica el CEN; `dateTimeUtc` es el mismo instante en UTC.

### Comportamiento

- Paginación automática (`page` desde 1, `limit`/`pageSize` hasta 5000) con tope `maxPages`.
- Pausa de **1 s** entre solicitudes y reintentos con espera exponencial y *jitter* ante **429** (el gateway limita ráfagas), 5xx y errores de red.
- **Errores claros:** API Key ausente o inválida (HTTP 403 «Authentication failed / parameters missing»), rango sin datos (run vacío con advertencia, no un fallo).
- **Deduplicación** si la ejecución se reanuda. La API Key se marca como **secreto** (cifrada por Apify) y nunca se escribe en logs.
- **Privacidad (Ley 19.628 / 21.719):** se eliminan RUT, correos y direcciones de contacto (p. ej. en demanda real estimada) y se ocultan nombres que podrían ser de **personas naturales** (clientes afectados en ENS y propietarios de pequeños medios de generación sin marca de persona jurídica), también en `raw`. Cada registro trae `redacted` y `personType`.

### Precio / Pricing

Pago por resultado (*pay per event*): solo se cobra el evento `result` por cada registro **entregado** en el dataset. No se cobran páginas filtradas, duplicados ni errores. Puedes fijar un gasto máximo por ejecución; el Actor se detiene al alcanzarlo.

### Input

Costo marginal de una barra ayer:

```json
{
  "apiKey": "TU-CREDENCIAL",
  "dataset": "costo_marginal_online",
  "filter": "crucero 220",
  "maxItems": 200
}
```

Generación diaria por tecnología de una semana:

```json
{
  "apiKey": "TU-CREDENCIAL",
  "dataset": "generacion_diaria",
  "startDate": "2026-11-01",
  "endDate": "2026-11-07"
}
```

Centrales solares de una región:

```json
{
  "apiKey": "TU-CREDENCIAL",
  "dataset": "centrales",
  "filter": "solar",
  "maxItems": 2000
}
```

### Output (diccionario / data dictionary)

| Campo | ES | EN |
|---|---|---|
| `dataset`, `datasetTitle` | Conjunto consultado | Dataset |
| `date`, `localDateTime`, `dateTimeUtc`, `hour` | Fecha y hora (Chile y UTC) | Date and time |
| `name`, `code` | Barra / central / línea / instalación e identificador estable | Entity name and id |
| `value`, `unit` | Valor principal y unidad | Main value and unit |
| `costClpKwh`, `voltageKv`, `version` | CMg en CLP/kWh, tensión de la barra, versión | Marginal cost extras |
| `technology`, `subTechnology`, `owner`, `coordinado`, `maxPowerMw`, `erncMw`, `region`, `comuna`, `status` | Generación y centrales | Generation and plants |
| `grossGenerationMwh`, `variableRenewableMwh`, `ownConsumptionMwh`, `ownConsumptionPct`, `supplier`, `withdrawal` | Demanda | Demand |
| `type`, `instruction`, `startTime`, `endTime`, `reason`, `expectedReturn`, `actualReturn`, `observation`, `affectedCompany`, `clientName` | Operación, limitaciones y ENS | Operations and outages |
| `redacted`, `personType` | Privacidad | Privacy flags |
| `officialUrl`, `dataSource`, `retrievedAt`, `raw` | Atribución, fecha de consulta y fila original | Attribution and raw row |

### Limitaciones conocidas

- El costo marginal **real** (definitivo) se publica con semanas de desfase; para días recientes usa `costo_marginal_online`.
- El histórico disponible en la API no es ilimitado (en pruebas públicas de 2026, fechas de 2025 respondían y fechas de 2022 no).
- El catálogo de rutas sigue la documentación del Coordinador (guía SIP v2.0, 2023) y el *swagger* del portal; si el Coordinador cambia una versión de ruta, el Actor lo reporta como error 404 claro.

### English summary

Official Chilean grid data (Coordinador Eléctrico Nacional SIP API) as clean JSON: marginal costs per bus (USD/MWh and CLP/kWh), real generation, daily generation by technology, demand, plant/line catalogs, transmission limitations, ancillary-service instructions and unserved energy. Bring your own free key from <https://portal.api.coordinador.cl>. Pay only per delivered result. Not affiliated with the Coordinador Eléctrico Nacional.

### Más conectores de Chile / More Chilean data connectors

Este Actor es parte de **Better Llama**, una colección de conectores de datos públicos y empresariales de Chile (licitaciones, UF y dólar, energía, bencina, envíos, bolsa y más) con JSON limpio y pago por resultado. Catálogo completo: <https://betterllama.com>.

Part of **Better Llama**, a collection of Chilean data connectors for developers and AI agents. Full catalog: <https://betterllama.com/en/>.

# Changelog

This Actor's version history is a separate document: https://apify.com/better-llama/coordinador-electrico-chile/changelog.md

# Actor input Schema

## `apiKey` (type: `string`):

Tu credencial del Portal del Desarrollador del Coordinador (https://portal.api.coordinador.cl → Aplicaciones → Credencial). Se guarda cifrada y solo se usa para tus consultas; nunca se registra en logs. / Your developer-portal credential, stored encrypted, never logged.

## `dataset` (type: `string`):

Qué consultar en el Sistema de Información Pública (SIP).

## `startDate` (type: `string`):

AAAA-MM-DD. Por defecto: ayer (hora de Chile). No aplica a los catálogos de centrales y líneas.

## `endDate` (type: `string`):

AAAA-MM-DD (incluido). Por defecto igual a startDate. Máximo 31 días por ejecución.

## `filter` (type: `string`):

Opcional. Texto (sin mayúsculas/minúsculas) que debe aparecer en el nombre: barra en costos marginales (p. ej. «crucero 220», «QUILLOTA»), central o tecnología en generación, instalación o empresa en limitaciones. Se aplica después de descargar cada página (la API no filtra por barra).

## `includeRaw` (type: `boolean`):

Agrega `raw` con la fila original, sin RUT, correos ni direcciones de contacto, ni nombres de personas naturales.

## `maxItems` (type: `integer`):

Tope de registros entregados y cobrados (1-100000). Por defecto 500. Ojo: un día de costo marginal tiene ~145.000 filas (≈1.500 barras × 96 cuartos de hora); usa `filter` para una barra.

## `pageSize` (type: `integer`):

Tamaño de página pedido a la API (10-5000). Por defecto 5000 (menos solicitudes).

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

Tope de páginas por ejecución (1-500). Por defecto 40 (≈ un día completo de costos marginales con páginas de 5000).

## `requestIntervalMs` (type: `integer`):

Pausa mínima entre solicitudes (200-10000). Por defecto 1000. El gateway responde 429 ante ráfagas.

## `maxRetries` (type: `integer`):

Reintentos ante errores transitorios (red, 429, 5xx). Por defecto 5.

## Actor input object example

```json
{
  "dataset": "costo_marginal_online",
  "includeRaw": false,
  "maxItems": 500,
  "pageSize": 5000,
  "maxPages": 40,
  "requestIntervalMs": 1000,
  "maxRetries": 5
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("better-llama/coordinador-electrico-chile").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("better-llama/coordinador-electrico-chile").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 '{}' |
apify call better-llama/coordinador-electrico-chile --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,better-llama/coordinador-electrico-chile"
        }
    }
}
```

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/t9aunc2OE5lhaX3Nw/builds/nVxw96peXYz0kcOjN/openapi.json
