> ## 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 inputs

> Get the weather input data of a model's latest run

## What are model inputs

Every forecasting model is driven by input data, mainly weather variables coming from numerical weather prediction models.
A single forecasting model can combine several weather sources at the same time, so that it does not depend on one weather provider alone.

The [Get Model Input](/api-reference/model/get-model-input) endpoint returns the input data of the model's latest run.
It is useful when you want to inspect the weather that a forecast was based on, for example when investigating a large forecast error.
To get the output which the model produced from these inputs, see [how to get model output](/api-guides/get-model-output).

## How to query the model inputs

The only parameter you need to provide is the model ID, which you can retrieve with the [List Site Models](/api-reference/site/list-site-models) endpoint, as described in [Step 1 of the model output guide](/api-guides/get-model-output).
The endpoint takes no further request parameters. It always returns the inputs of the most recent model run, with the target times in `UTC`.

```python Get model inputs 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}/input"
headers = {"Authorization": api_key, "Content-Type": "application/json"}

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

In the response example below the arrays are truncated to five time steps.

```python Response example theme={null}
{
    "dataframe": {
        "DWDOM_SolarDownwardRadiation": [
            23.0,
            54.0,
            93.0,
            153.0,
            249.0
        ],
        "ECHRESOM_SolarDownwardRadiation": [
            6.0,
            51.0,
            136.0,
            224.0,
            262.0
        ],
        "GFSOM_SolarDownwardRadiation": [
            10.0,
            105.0,
            223.0,
            314.0,
            424.0
        ],
        "HIRESMEPSOM_SolarDownwardRadiation": [
            32.0,
            58.0,
            97.0,
            156.0,
            211.0
        ],
        "valid_time": [
            "2025-10-01T05:00Z",
            "2025-10-01T06:00Z",
            "2025-10-01T07:00Z",
            "2025-10-01T08:00Z",
            "2025-10-01T09:00Z"
        ]
    },
    "metadata": {
        "DWDOM_SolarDownwardRadiation": {
            "type": "numeric"
        },
        "ECHRESOM_SolarDownwardRadiation": {
            "type": "numeric"
        },
        "GFSOM_SolarDownwardRadiation": {
            "type": "numeric"
        },
        "HIRESMEPSOM_SolarDownwardRadiation": {
            "type": "numeric"
        }
    }
}
```

The response contains the following fields:
<br /> `dataframe`: A serialized table with one column per input feature, plus a `valid_time` column which contains the target times, i.e. the periods which are forecasted.
<br /> `metadata`: The data type of every input feature, for example `numeric` for the weather variables.

Each input feature is named after the weather source it comes from and the weather variable it holds, separated by an underscore.
In the example above the model is driven by `SolarDownwardRadiation` from four different weather sources, `DWDOM`, `ECHRESOM`, `GFSOM` and `HIRESMEPSOM`.

## Load the inputs into a DataFrame

The `dataframe` field is column oriented, so it can be handed straight to pandas.

```python Load model inputs into a DataFrame theme={null}
import pandas as pd

df = pd.DataFrame(response["dataframe"])
df["valid_time"] = pd.to_datetime(df["valid_time"])
df = df.set_index("valid_time")
```
