> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rebase.energy/llms.txt
> Use this file to discover all available pages before exploring further.

# How to get model output

> Get the forecast of a specific model for a site

The [Get Site Forecast](/api-reference/site/get-site-forecast) endpoint returns the optimal forecast, constructed from multiple model outputs based on a priority scheme, as described [here](/api-guides/get-forecast-latest#how-the-site-forecasts-are-constructed).
If you need the raw output of a specific model, use the [Get Model Output](/api-reference/model/get-model-output) endpoint instead.

## Step 1: Get the model IDs

Before querying a model's output you need its unique identifier, the model ID. Retrieve it using the [List Site Models](/api-reference/site/list-site-models) endpoint.
You can filter the results to only ML or physical models by setting the `model_type` parameter to `ai` or `physical`, respectively.

```python Get model IDs theme={null}
import requests

api_key = "Your API key" # Set your API key
site_id = "a923653c-26f1-1b29-955d-ffde5d182276" # Set the site ID

url = f"https://api.rebase.energy/platform/v2/sites/{site_id}/models"
headers = {"Authorization": api_key, "Content-Type": "application/json"}

response = requests.get(url, headers=headers)
response.raise_for_status()
response = response.json()
```

```python Response example theme={null}
[
    {   
        'id': '0c456ecb-d245-4569-bc8e-4e67a566dcd72',
        'name': 'SolarForecast_Ensemble_QuantReg',
        'label': 'ML-Acc-Medium',
        'version': 1,
        'display_name': 'ML-Acc-Medium',
        'priority': 3,
        'output_types': [],
        'state': [{'state': 'training', 'timestamp_utc': '2025-09-15T00:32:48.391452Z'}]},
    {
        'id': '1d567fa0-e356-467a-cd9f-5f78b901c345',
        'name': 'SolarForecast_Ensemble_QuantReg',
        'label': 'ML-Acc-Short',
        'version': 2,
        'display_name': 'ML-Acc-Short',
        'priority': 2,
        'output_types': [],
        'state': [{'state': 'training', 'timestamp_utc': '2025-09-15T00:41:51.224815Z'}]}
]
```

The response is a list of models configured for the site, with the following fields:
<br /> `id`: The unique model identifier. Use this as `model_id` in Step 2.
<br /> `name`: The name of the forecasting model.
<br /> `label`: A short label for the model.
<br /> `version`: The version number of the model.
<br /> `display_name`: The name shown for the model in the platform.
<br /> `priority`: The model's priority rank within the site's forecast combination.
<br /> `output_types`: The output types the model produces.
<br /> `state`: The model's training state history.

## Step 2: Get the latest model output

Using the model ID from Step 1, query the latest output for that model with the [Get Model Output](/api-reference/model/get-model-output) endpoint.
If no `start_date` is provided, the output is returned from today 00:00 UTC onwards.

```python Get latest model output theme={null}
import requests

api_key = "Your API key" # Set your API key
model_id = "1d567fa0-e356-467a-cd9f-5f78b901c345" # Set the model ID

url = f"https://api.rebase.energy/platform/v2/models/{model_id}/output"
headers = {"Authorization": api_key, "Content-Type": "application/json"}

response = requests.get(url, headers=headers)
response.raise_for_status()
response = response.json()
```

```python Response example theme={null}
{
    "model_id": "1d567fa0-e356-467a-cd9f-5f78b901c345",
    "model_version": 2,
    "model_name": "SolarForecast_Ensemble_QuantReg",
    "model_label": "ML-Acc-Short",
    "priority": 2,
    "as_of": "2025-10-01T09:40:52.800337Z",
    "forecast": [
        0.0,
        0.0,
        0.0,
        0.0,
        0.0
    ],
    "valid_time": [
        "2025-10-01T00:00:00Z",
        "2025-10-01T00:15:00Z",
        "2025-10-01T00:30:00Z",
        "2025-10-01T00:45:00Z",
        "2025-10-01T01:00:00Z"
    ],
    "capacity": [
        76000.0,
        76000.0,
        76000.0,
        76000.0,
        76000.0
    ]
}
```

The response is a JSON object with the following fields:
<br /> `model_id`: The unique identifier of the model.
<br /> `model_version`: The version number of the model.
<br /> `model_name`: The name of the forecasting model.
<br /> `model_label`: The label of the model, i.e. the `label` field from Step 1.
<br /> `priority`: The model's priority rank within the site's forecast combination.
<br /> `as_of`: The reference time, i.e. the forecasts returned are the most recent ones that were available at this time.
<br /> `forecast`: It contains the forecast values.
<br /> `valid_time`: It contains the target times, i.e. the periods which are forecasted.
<br /> `capacity`: It contains the site capacity in kilowatts \[kW] for each target period.

## Query historical model output

Every model run is archived, so you can retrieve a model's output as it was issued at an earlier point in time.
This is the model level equivalent of the [historical site forecast](/api-guides/get-forecast-historical).
You can provide the following request parameters.

**Start date** `start_date`
<br /> Specify the starting target period of the forecast. If not provided, it defaults to today 00:00 UTC.
<br /> Example: `"2025-08-02 15:00"`

**End date** `end_date`
<br /> Specify the ending target period of the forecast.
<br /> Example: `"2025-08-02 16:00"`

**Reference time** `as_of`
<br /> Specify the reference time. The API will return the most recent model output which was available at the reference time and covers the period between `start_date` and `end_date`.
If not provided, then by default the request time is considered as reference time.
<br /> Example: `"2025-08-01 11:00"`

**Time zone** `tz`
<br /> Specify the time zone. The default time zone is `UTC`.
<br /> Example: `"CET"`

**Output type** `output_type`
<br /> Specify which output of the model to return. The default is `"forecast"`. `"clearky"` can be used for the physical models clearsky output.

**Normalization handling** `normalization_handling`
<br /> Specify if the output is returned in absolute values `"auto"` or normalized by the capacity `"disabled"`. The default is `"auto"`.

In the example below we want to query the output of the model with ID `1d567fa0-e356-467a-cd9f-5f78b901c345` for the period between `2025-08-02 15:00` and `2025-08-02 16:00` which
was available at 11:00 in the morning the previous day, i.e. the day-ahead forecast. All times are in UTC.

```python Get historical model output theme={null}
import requests

api_key = "Your API key" # Set your API key
model_id = "1d567fa0-e356-467a-cd9f-5f78b901c345" # Set the model ID
start_date = "2025-08-02 15:00" # Set the start date
end_date = "2025-08-02 16:00" # Set the end date
as_of = "2025-08-01 11:00" # Set the reference time

url = f"https://api.rebase.energy/platform/v2/models/{model_id}/output"
headers = {"Authorization": api_key, "Content-Type": "application/json"}
params = {
    "start_date": start_date,
    "end_date": end_date,
    "as_of": as_of
}

response = requests.get(url, headers=headers, params=params)
response.raise_for_status()
response = response.json()
```

```python Response example theme={null}
{
    "model_id": "1d567fa0-e356-467a-cd9f-5f78b901c345",
    "model_version": 2,
    "model_name": "SolarForecast_Ensemble_QuantReg",
    "model_label": "ML-Acc-Short",
    "priority": 2,
    "as_of": "2025-08-01T11:00:00Z",
    "forecast": [
        49076.07965239071,
        46358.204584880375,
        43007.28450049107,
        38891.100735672335,
        33866.317940143104
    ],
    "valid_time": [
        "2025-08-02T15:00:00Z",
        "2025-08-02T15:15:00Z",
        "2025-08-02T15:30:00Z",
        "2025-08-02T15:45:00Z",
        "2025-08-02T16:00:00Z"
    ],
    "capacity": [
        76000.0,
        76000.0,
        76000.0,
        76000.0,
        76000.0
    ]
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.