# This file was auto-generated by Fern from our API Definition.

import typing
import urllib.parse
from json.decoder import JSONDecodeError

import httpx

from .core.api_error import ApiError
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .core.jsonable_encoder import jsonable_encoder
from .core.pydantic_utilities import pydantic_v1
from .core.remove_none_from_dict import remove_none_from_dict
from .core.request_options import RequestOptions
from .errors.unprocessable_entity_error import UnprocessableEntityError
from .types.anomaly_detection_output import AnomalyDetectionOutput
from .types.cross_validation_input_finetune_loss import CrossValidationInputFinetuneLoss
from .types.cross_validation_input_level_item import CrossValidationInputLevelItem
from .types.cross_validation_output import CrossValidationOutput
from .types.forecast_input_finetune_loss import ForecastInputFinetuneLoss
from .types.forecast_input_level_item import ForecastInputLevelItem
from .types.forecast_output import ForecastOutput
from .types.http_validation_error import HttpValidationError
from .types.in_sample_input_level_item import InSampleInputLevelItem
from .types.in_sample_output import InSampleOutput
from .types.level import Level
from .types.model import Model
from .types.multi_series_anomaly import MultiSeriesAnomaly
from .types.multi_series_cross_validation import MultiSeriesCrossValidation
from .types.multi_series_forecast import MultiSeriesForecast
from .types.multi_series_insample_forecast import MultiSeriesInsampleForecast
from .types.series import Series
from .types.series_with_future_exogenous import SeriesWithFutureExogenous
from .types.single_series_forecast import SingleSeriesForecast
from .types.single_series_insample_forecast import SingleSeriesInsampleForecast

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class Nixtla:
    """
    Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.

    Parameters:
        - base_url: str. The base url to use for requests from the client.

        - token: typing.Union[str, typing.Callable[[], str]].

        - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.

        - follow_redirects: typing.Optional[bool]. Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.

        - httpx_client: typing.Optional[httpx.Client]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
    ---
    from nixtla.client import Nixtla

    client = Nixtla(
        token="YOUR_TOKEN",
        base_url="https://yourhost.com/path/to/api",
    )
    """

    def __init__(
        self,
        *,
        base_url: str,
        token: typing.Union[str, typing.Callable[[], str]],
        timeout: typing.Optional[float] = None,
        follow_redirects: typing.Optional[bool] = None,
        httpx_client: typing.Optional[httpx.Client] = None,
    ):
        _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
        self._client_wrapper = SyncClientWrapper(
            base_url=base_url,
            token=token,
            httpx_client=httpx_client
            if httpx_client is not None
            else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
            if follow_redirects is not None
            else httpx.Client(timeout=_defaulted_timeout),
            timeout=_defaulted_timeout,
        )

    def validate_token(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
        """
        Parameters:
            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.validate_token()
        """
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "validate_token"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))
            if request_options is not None
            else None,
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def validate_token_front(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
        """
        Parameters:
            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.validate_token_front()
        """
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "validate_token_front"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))
            if request_options is not None
            else None,
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def health_health_get(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
        """
        Check if server is healthy. Used by the readiness probe to check server is healthy.

        Parameters:
            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.health_health_get()
        """
        _response = self._client_wrapper.httpx_client.request(
            "GET",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "health"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def forecast(
        self, *, request: SingleSeriesForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        This endpoint predicts the future values of a single time series based on the provided data. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values based on the input arguments. Get your token for private beta at https://dashboard.nixtla.io

        Parameters:
            - request: SingleSeriesForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import SingleSeriesForecast
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.forecast(
            request=SingleSeriesForecast(
                model="timegpt-1",
                freq="D",
                level=[90],
                fh=7,
                y={
                    "2015-12-02": 8.71177264560569,
                    "2015-12-03": 8.05610965954506,
                    "2015-12-04": 8.08147504013705,
                    "2015-12-05": 7.45876269238096,
                    "2015-12-06": 8.01400499477946,
                    "2015-12-07": 8.49678638163858,
                    "2015-12-08": 7.98104975966596,
                    "2015-12-09": 7.77779262633883,
                    "2015-12-10": 8.2602342916073,
                    "2015-12-11": 7.86633892304654,
                    "2015-12-12": 7.31055015853442,
                    "2015-12-13": 7.71824095195932,
                    "2015-12-14": 8.31947369244219,
                    "2015-12-15": 8.23668532271246,
                    "2015-12-16": 7.80751004221619,
                    "2015-12-17": 7.59186171488993,
                    "2015-12-18": 7.52886925664225,
                    "2015-12-19": 7.17165682276851,
                    "2015-12-20": 7.89133075766189,
                    "2015-12-21": 8.36007143564403,
                    "2015-12-22": 8.11042723757502,
                    "2015-12-23": 7.77527584648686,
                    "2015-12-24": 7.34729970074316,
                    "2015-12-25": 7.30182234213793,
                    "2015-12-26": 7.12044437239249,
                    "2015-12-27": 8.87877607170755,
                    "2015-12-28": 9.25061821847475,
                    "2015-12-29": 9.24792513230345,
                    "2015-12-30": 8.39140318535794,
                    "2015-12-31": 8.00469951054955,
                    "2016-01-01": 7.58933582317062,
                    "2016-01-02": 7.82524529143177,
                    "2016-01-03": 8.24931374626064,
                    "2016-01-04": 9.29514097366865,
                    "2016-01-05": 8.56826646160024,
                    "2016-01-06": 8.35255436947459,
                    "2016-01-07": 8.29579811063615,
                    "2016-01-08": 8.29029259122431,
                    "2016-01-09": 7.78572089653462,
                    "2016-01-10": 8.28172399041139,
                    "2016-01-11": 8.4707303170059,
                    "2016-01-12": 8.13505390861157,
                    "2016-01-13": 8.06714903991011,
                },
                x={
                    "2015-12-02": [0.5488135039273248, 0.5701967704178796],
                    "2015-12-03": [0.7151893663724195, 0.43860151346232035],
                    "2015-12-04": [0.6027633760716439, 0.9883738380592262],
                    "2015-12-05": [0.5448831829968969, 0.10204481074802807],
                    "2015-12-06": [0.4236547993389047, 0.2088767560948347],
                    "2015-12-07": [0.6458941130666561, 0.16130951788499626],
                    "2015-12-08": [0.4375872112626925, 0.6531083254653984],
                    "2015-12-09": [0.8917730007820798, 0.2532916025397821],
                    "2015-12-10": [0.9636627605010293, 0.4663107728563063],
                    "2015-12-11": [0.3834415188257777, 0.24442559200160274],
                    "2015-12-12": [0.7917250380826646, 0.15896958364551972],
                    "2015-12-13": [0.5288949197529045, 0.11037514116430513],
                    "2015-12-14": [0.5680445610939323, 0.6563295894652734],
                    "2015-12-15": [0.925596638292661, 0.1381829513486138],
                    "2015-12-16": [0.07103605819788694, 0.1965823616800535],
                    "2015-12-17": [0.08712929970154071, 0.3687251706609641],
                    "2015-12-18": [0.02021839744032572, 0.8209932298479351],
                    "2015-12-19": [0.832619845547938, 0.09710127579306127],
                    "2015-12-20": [0.7781567509498505, 0.8379449074988039],
                    "2015-12-21": [0.8700121482468192, 0.09609840789396307],
                    "2015-12-22": [0.978618342232764, 0.9764594650133958],
                    "2015-12-23": [0.7991585642167236, 0.4686512016477016],
                    "2015-12-24": [0.46147936225293185, 0.9767610881903371],
                    "2015-12-25": [0.7805291762864555, 0.604845519745046],
                    "2015-12-26": [0.11827442586893322, 0.7392635793983017],
                    "2015-12-27": [0.6399210213275238, 0.039187792254320675],
                    "2015-12-28": [0.1433532874090464, 0.2828069625764096],
                    "2015-12-29": [0.9446689170495839, 0.1201965612131689],
                    "2015-12-30": [0.5218483217500717, 0.29614019752214493],
                    "2015-12-31": [0.4146619399905236, 0.11872771895424405],
                    "2016-01-01": [0.26455561210462697, 0.317983179393976],
                    "2016-01-02": [0.7742336894342167, 0.41426299451466997],
                    "2016-01-03": [0.45615033221654855, 0.06414749634878436],
                    "2016-01-04": [0.5684339488686485, 0.6924721193700198],
                    "2016-01-05": [0.018789800436355142, 0.5666014542065752],
                    "2016-01-06": [0.6176354970758771, 0.2653894909394454],
                    "2016-01-07": [0.6120957227224214, 0.5232480534666997],
                    "2016-01-08": [0.6169339968747569, 0.09394051075844168],
                    "2016-01-09": [0.9437480785146242, 0.5759464955561793],
                    "2016-01-10": [0.6818202991034834, 0.9292961975762141],
                    "2016-01-11": [0.359507900573786, 0.31856895245132366],
                    "2016-01-12": [0.43703195379934145, 0.6674103799636817],
                    "2016-01-13": [0.6976311959272649, 0.13179786240439217],
                    "2016-01-14": [0.06022547162926983, 0.7163272041185655],
                    "2016-01-15": [0.6667667154456677, 0.2894060929472011],
                    "2016-01-16": [0.6706378696181594, 0.18319136200711683],
                    "2016-01-17": [0.2103825610738409, 0.5865129348100832],
                    "2016-01-18": [0.1289262976548533, 0.020107546187493552],
                    "2016-01-19": [0.31542835092418386, 0.8289400292173631],
                    "2016-01-20": [0.3637107709426226, 0.004695476192547066],
                },
                clean_ex_first=True,
                finetune_steps=0,
            ),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "forecast"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def historic_forecast(
        self, *, request: SingleSeriesInsampleForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Based on the provided data, this endpoint predicts time series data for the in-sample period (historical period). It takes a JSON as an input, including information like the series frequency and the historical data. (See below for a full description of the parameters.) The response contains the predicted values for the historical period. Usually useful for anomaly detection. Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - request: SingleSeriesInsampleForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import SingleSeriesInsampleForecast
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.historic_forecast(
            request=SingleSeriesInsampleForecast(
                model="timegpt-1",
                freq="D",
                level=[90],
                y={
                    "2015-12-02": 8.71177264560569,
                    "2015-12-03": 8.05610965954506,
                    "2015-12-04": 8.08147504013705,
                    "2015-12-05": 7.45876269238096,
                    "2015-12-06": 8.01400499477946,
                    "2015-12-07": 8.49678638163858,
                    "2015-12-08": 7.98104975966596,
                    "2015-12-09": 7.77779262633883,
                    "2015-12-10": 8.2602342916073,
                    "2015-12-11": 7.86633892304654,
                    "2015-12-12": 7.31055015853442,
                    "2015-12-13": 7.71824095195932,
                    "2015-12-14": 8.31947369244219,
                    "2015-12-15": 8.23668532271246,
                    "2015-12-16": 7.80751004221619,
                    "2015-12-17": 7.59186171488993,
                    "2015-12-18": 7.52886925664225,
                    "2015-12-19": 7.17165682276851,
                    "2015-12-20": 7.89133075766189,
                    "2015-12-21": 8.36007143564403,
                    "2015-12-22": 8.11042723757502,
                    "2015-12-23": 7.77527584648686,
                    "2015-12-24": 7.34729970074316,
                    "2015-12-25": 7.30182234213793,
                    "2015-12-26": 7.12044437239249,
                    "2015-12-27": 8.87877607170755,
                    "2015-12-28": 9.25061821847475,
                    "2015-12-29": 9.24792513230345,
                    "2015-12-30": 8.39140318535794,
                    "2015-12-31": 8.00469951054955,
                    "2016-01-01": 7.58933582317062,
                    "2016-01-02": 7.82524529143177,
                    "2016-01-03": 8.24931374626064,
                    "2016-01-04": 9.29514097366865,
                    "2016-01-05": 8.56826646160024,
                    "2016-01-06": 8.35255436947459,
                    "2016-01-07": 8.29579811063615,
                    "2016-01-08": 8.29029259122431,
                    "2016-01-09": 7.78572089653462,
                    "2016-01-10": 8.28172399041139,
                    "2016-01-11": 8.4707303170059,
                    "2016-01-12": 8.13505390861157,
                    "2016-01-13": 8.06714903991011,
                },
                clean_ex_first=True,
            ),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "historic_forecast"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def forecast_multi_series(
        self, *, request: MultiSeriesForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Based on the provided data, this endpoint predicts the future values of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values for each series based on the input arguments. Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - request: MultiSeriesForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import MultiSeriesForecast
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.forecast_multi_series(
            request=MultiSeriesForecast(),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "forecast_multi_series"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def historic_forecast_multi_series(
        self, *, request: MultiSeriesInsampleForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Based on the provided data, this endpoint predicts the in-sample period (historical period) values of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values for the historical period. Usually useful for anomaly detection. Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - request: MultiSeriesInsampleForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import MultiSeriesInsampleForecast
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.historic_forecast_multi_series(
            request=MultiSeriesInsampleForecast(
                model="timegpt-1",
                freq="D",
                level=[90],
                y={
                    "columns": {"0": "unique_id", "1": "ds", "2": "y"},
                    "data": {
                        "0": {
                            "0": "PeytonManning",
                            "1": "2015-12-02",
                            "2": 8.71177264560569,
                        },
                        "1": {
                            "0": "PeytonManning",
                            "1": "2015-12-03",
                            "2": 8.05610965954506,
                        },
                        "2": {
                            "0": "PeytonManning",
                            "1": "2015-12-04",
                            "2": 8.08147504013705,
                        },
                        "3": {
                            "0": "PeytonManning",
                            "1": "2015-12-05",
                            "2": 7.45876269238096,
                        },
                        "4": {
                            "0": "PeytonManning",
                            "1": "2015-12-06",
                            "2": 8.01400499477946,
                        },
                        "5": {
                            "0": "PeytonManning",
                            "1": "2015-12-07",
                            "2": 8.49678638163858,
                        },
                        "6": {
                            "0": "PeytonManning",
                            "1": "2015-12-08",
                            "2": 7.98104975966596,
                        },
                        "7": {
                            "0": "PeytonManning",
                            "1": "2015-12-09",
                            "2": 7.77779262633883,
                        },
                        "8": {
                            "0": "PeytonManning",
                            "1": "2015-12-10",
                            "2": 8.2602342916073,
                        },
                        "9": {
                            "0": "PeytonManning",
                            "1": "2015-12-11",
                            "2": 7.86633892304654,
                        },
                        "10": {
                            "0": "PeytonManning",
                            "1": "2015-12-12",
                            "2": 7.31055015853442,
                        },
                        "11": {
                            "0": "PeytonManning",
                            "1": "2015-12-13",
                            "2": 7.71824095195932,
                        },
                        "12": {
                            "0": "PeytonManning",
                            "1": "2015-12-14",
                            "2": 8.31947369244219,
                        },
                        "13": {
                            "0": "PeytonManning",
                            "1": "2015-12-15",
                            "2": 8.23668532271246,
                        },
                        "14": {
                            "0": "PeytonManning",
                            "1": "2015-12-16",
                            "2": 7.80751004221619,
                        },
                        "15": {
                            "0": "PeytonManning",
                            "1": "2015-12-17",
                            "2": 7.59186171488993,
                        },
                        "16": {
                            "0": "PeytonManning",
                            "1": "2015-12-18",
                            "2": 7.52886925664225,
                        },
                        "17": {
                            "0": "PeytonManning",
                            "1": "2015-12-19",
                            "2": 7.17165682276851,
                        },
                        "18": {
                            "0": "PeytonManning",
                            "1": "2015-12-20",
                            "2": 7.89133075766189,
                        },
                        "19": {
                            "0": "PeytonManning",
                            "1": "2015-12-21",
                            "2": 8.36007143564403,
                        },
                        "20": {
                            "0": "PeytonManning",
                            "1": "2015-12-22",
                            "2": 8.11042723757502,
                        },
                        "21": {
                            "0": "PeytonManning",
                            "1": "2015-12-23",
                            "2": 7.77527584648686,
                        },
                        "22": {
                            "0": "PeytonManning",
                            "1": "2015-12-24",
                            "2": 7.34729970074316,
                        },
                        "23": {
                            "0": "PeytonManning",
                            "1": "2015-12-25",
                            "2": 7.30182234213793,
                        },
                        "24": {
                            "0": "PeytonManning",
                            "1": "2015-12-26",
                            "2": 7.12044437239249,
                        },
                        "25": {
                            "0": "PeytonManning",
                            "1": "2015-12-27",
                            "2": 8.87877607170755,
                        },
                        "26": {
                            "0": "PeytonManning",
                            "1": "2015-12-28",
                            "2": 9.25061821847475,
                        },
                        "27": {
                            "0": "PeytonManning",
                            "1": "2015-12-29",
                            "2": 9.24792513230345,
                        },
                        "28": {
                            "0": "PeytonManning",
                            "1": "2015-12-30",
                            "2": 8.39140318535794,
                        },
                        "29": {
                            "0": "PeytonManning",
                            "1": "2015-12-31",
                            "2": 8.00469951054955,
                        },
                        "30": {
                            "0": "PeytonManning",
                            "1": "2016-01-01",
                            "2": 7.58933582317062,
                        },
                        "31": {
                            "0": "PeytonManning",
                            "1": "2016-01-02",
                            "2": 7.82524529143177,
                        },
                        "32": {
                            "0": "PeytonManning",
                            "1": "2016-01-03",
                            "2": 8.24931374626064,
                        },
                        "33": {
                            "0": "PeytonManning",
                            "1": "2016-01-04",
                            "2": 9.29514097366865,
                        },
                        "34": {
                            "0": "PeytonManning",
                            "1": "2016-01-05",
                            "2": 8.56826646160024,
                        },
                        "35": {
                            "0": "PeytonManning",
                            "1": "2016-01-06",
                            "2": 8.35255436947459,
                        },
                        "36": {
                            "0": "PeytonManning",
                            "1": "2016-01-07",
                            "2": 8.29579811063615,
                        },
                        "37": {
                            "0": "PeytonManning",
                            "1": "2016-01-08",
                            "2": 8.29029259122431,
                        },
                        "38": {
                            "0": "PeytonManning",
                            "1": "2016-01-09",
                            "2": 7.78572089653462,
                        },
                        "39": {
                            "0": "PeytonManning",
                            "1": "2016-01-10",
                            "2": 8.28172399041139,
                        },
                        "40": {
                            "0": "PeytonManning",
                            "1": "2016-01-11",
                            "2": 8.4707303170059,
                        },
                        "41": {
                            "0": "PeytonManning",
                            "1": "2016-01-12",
                            "2": 8.13505390861157,
                        },
                        "42": {
                            "0": "PeytonManning",
                            "1": "2016-01-13",
                            "2": 8.06714903991011,
                        },
                        "43": {
                            "0": "TomBrady",
                            "1": "2015-12-02",
                            "2": 8.71177264560569,
                        },
                        "44": {
                            "0": "TomBrady",
                            "1": "2015-12-03",
                            "2": 8.05610965954506,
                        },
                        "45": {
                            "0": "TomBrady",
                            "1": "2015-12-04",
                            "2": 8.08147504013705,
                        },
                        "46": {
                            "0": "TomBrady",
                            "1": "2015-12-05",
                            "2": 7.45876269238096,
                        },
                        "47": {
                            "0": "TomBrady",
                            "1": "2015-12-06",
                            "2": 8.01400499477946,
                        },
                        "48": {
                            "0": "TomBrady",
                            "1": "2015-12-07",
                            "2": 8.49678638163858,
                        },
                        "49": {
                            "0": "TomBrady",
                            "1": "2015-12-08",
                            "2": 7.98104975966596,
                        },
                        "50": {
                            "0": "TomBrady",
                            "1": "2015-12-09",
                            "2": 7.77779262633883,
                        },
                        "51": {
                            "0": "TomBrady",
                            "1": "2015-12-10",
                            "2": 8.2602342916073,
                        },
                        "52": {
                            "0": "TomBrady",
                            "1": "2015-12-11",
                            "2": 7.86633892304654,
                        },
                        "53": {
                            "0": "TomBrady",
                            "1": "2015-12-12",
                            "2": 7.31055015853442,
                        },
                        "54": {
                            "0": "TomBrady",
                            "1": "2015-12-13",
                            "2": 7.71824095195932,
                        },
                        "55": {
                            "0": "TomBrady",
                            "1": "2015-12-14",
                            "2": 8.31947369244219,
                        },
                        "56": {
                            "0": "TomBrady",
                            "1": "2015-12-15",
                            "2": 8.23668532271246,
                        },
                        "57": {
                            "0": "TomBrady",
                            "1": "2015-12-16",
                            "2": 7.80751004221619,
                        },
                        "58": {
                            "0": "TomBrady",
                            "1": "2015-12-17",
                            "2": 7.59186171488993,
                        },
                        "59": {
                            "0": "TomBrady",
                            "1": "2015-12-18",
                            "2": 7.52886925664225,
                        },
                        "60": {
                            "0": "TomBrady",
                            "1": "2015-12-19",
                            "2": 7.17165682276851,
                        },
                        "61": {
                            "0": "TomBrady",
                            "1": "2015-12-20",
                            "2": 7.89133075766189,
                        },
                        "62": {
                            "0": "TomBrady",
                            "1": "2015-12-21",
                            "2": 8.36007143564403,
                        },
                        "63": {
                            "0": "TomBrady",
                            "1": "2015-12-22",
                            "2": 8.11042723757502,
                        },
                        "64": {
                            "0": "TomBrady",
                            "1": "2015-12-23",
                            "2": 7.77527584648686,
                        },
                        "65": {
                            "0": "TomBrady",
                            "1": "2015-12-24",
                            "2": 7.34729970074316,
                        },
                        "66": {
                            "0": "TomBrady",
                            "1": "2015-12-25",
                            "2": 7.30182234213793,
                        },
                        "67": {
                            "0": "TomBrady",
                            "1": "2015-12-26",
                            "2": 7.12044437239249,
                        },
                        "68": {
                            "0": "TomBrady",
                            "1": "2015-12-27",
                            "2": 8.87877607170755,
                        },
                        "69": {
                            "0": "TomBrady",
                            "1": "2015-12-28",
                            "2": 9.25061821847475,
                        },
                        "70": {
                            "0": "TomBrady",
                            "1": "2015-12-29",
                            "2": 9.24792513230345,
                        },
                        "71": {
                            "0": "TomBrady",
                            "1": "2015-12-30",
                            "2": 8.39140318535794,
                        },
                        "72": {
                            "0": "TomBrady",
                            "1": "2015-12-31",
                            "2": 8.00469951054955,
                        },
                        "73": {
                            "0": "TomBrady",
                            "1": "2016-01-01",
                            "2": 7.58933582317062,
                        },
                        "74": {
                            "0": "TomBrady",
                            "1": "2016-01-02",
                            "2": 7.82524529143177,
                        },
                        "75": {
                            "0": "TomBrady",
                            "1": "2016-01-03",
                            "2": 8.24931374626064,
                        },
                        "76": {
                            "0": "TomBrady",
                            "1": "2016-01-04",
                            "2": 9.29514097366865,
                        },
                        "77": {
                            "0": "TomBrady",
                            "1": "2016-01-05",
                            "2": 8.56826646160024,
                        },
                        "78": {
                            "0": "TomBrady",
                            "1": "2016-01-06",
                            "2": 8.35255436947459,
                        },
                        "79": {
                            "0": "TomBrady",
                            "1": "2016-01-07",
                            "2": 8.29579811063615,
                        },
                        "80": {
                            "0": "TomBrady",
                            "1": "2016-01-08",
                            "2": 8.29029259122431,
                        },
                        "81": {
                            "0": "TomBrady",
                            "1": "2016-01-09",
                            "2": 7.78572089653462,
                        },
                        "82": {
                            "0": "TomBrady",
                            "1": "2016-01-10",
                            "2": 8.28172399041139,
                        },
                        "83": {
                            "0": "TomBrady",
                            "1": "2016-01-11",
                            "2": 8.4707303170059,
                        },
                        "84": {
                            "0": "TomBrady",
                            "1": "2016-01-12",
                            "2": 8.13505390861157,
                        },
                        "85": {
                            "0": "TomBrady",
                            "1": "2016-01-13",
                            "2": 8.06714903991011,
                        },
                    },
                },
            ),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "historic_forecast_multi_series"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def anomaly_detection_multi_series(
        self, *, request: MultiSeriesAnomaly, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Based on the provided data, this endpoint detects the anomalies in the historical perdiod of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains a flag indicating if the date has a anomaly and also provides the prediction interval used to define if an observation is an anomaly.Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - request: MultiSeriesAnomaly.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import MultiSeriesAnomaly
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.anomaly_detection_multi_series(
            request=MultiSeriesAnomaly(),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "anomaly_detection_multi_series"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def cross_validation_multi_series(
        self, *, request: MultiSeriesCrossValidation, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Perform Cross Validation for multiple series

        Parameters:
            - request: MultiSeriesCrossValidation.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import MultiSeriesCrossValidation, MultiSeriesInput
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.cross_validation_multi_series(
            request=MultiSeriesCrossValidation(
                model="timegpt-1",
                freq="D",
                level=[99],
                y={
                    "columns": {"0": "unique_id", "1": "ds", "2": "y"},
                    "data": {
                        "0": {
                            "0": "PeytonManning",
                            "1": "2015-12-02",
                            "2": 8.71177264560569,
                        },
                        "1": {
                            "0": "PeytonManning",
                            "1": "2015-12-03",
                            "2": 8.05610965954506,
                        },
                        "2": {
                            "0": "PeytonManning",
                            "1": "2015-12-04",
                            "2": 8.08147504013705,
                        },
                        "3": {
                            "0": "PeytonManning",
                            "1": "2015-12-05",
                            "2": 7.45876269238096,
                        },
                        "4": {
                            "0": "PeytonManning",
                            "1": "2015-12-06",
                            "2": 8.01400499477946,
                        },
                        "5": {
                            "0": "PeytonManning",
                            "1": "2015-12-07",
                            "2": 8.49678638163858,
                        },
                        "6": {
                            "0": "PeytonManning",
                            "1": "2015-12-08",
                            "2": 7.98104975966596,
                        },
                        "7": {
                            "0": "PeytonManning",
                            "1": "2015-12-09",
                            "2": 7.77779262633883,
                        },
                        "8": {
                            "0": "PeytonManning",
                            "1": "2015-12-10",
                            "2": 8.2602342916073,
                        },
                        "9": {
                            "0": "PeytonManning",
                            "1": "2015-12-11",
                            "2": 7.86633892304654,
                        },
                        "10": {
                            "0": "PeytonManning",
                            "1": "2015-12-12",
                            "2": 7.31055015853442,
                        },
                        "11": {
                            "0": "PeytonManning",
                            "1": "2015-12-13",
                            "2": 7.71824095195932,
                        },
                        "12": {
                            "0": "PeytonManning",
                            "1": "2015-12-14",
                            "2": 8.31947369244219,
                        },
                        "13": {
                            "0": "PeytonManning",
                            "1": "2015-12-15",
                            "2": 8.23668532271246,
                        },
                        "14": {
                            "0": "PeytonManning",
                            "1": "2015-12-16",
                            "2": 7.80751004221619,
                        },
                        "15": {
                            "0": "PeytonManning",
                            "1": "2015-12-17",
                            "2": 7.59186171488993,
                        },
                        "16": {
                            "0": "PeytonManning",
                            "1": "2015-12-18",
                            "2": 7.52886925664225,
                        },
                        "17": {
                            "0": "PeytonManning",
                            "1": "2015-12-19",
                            "2": 7.17165682276851,
                        },
                        "18": {
                            "0": "PeytonManning",
                            "1": "2015-12-20",
                            "2": 7.89133075766189,
                        },
                        "19": {
                            "0": "PeytonManning",
                            "1": "2015-12-21",
                            "2": 8.36007143564403,
                        },
                        "20": {
                            "0": "PeytonManning",
                            "1": "2015-12-22",
                            "2": 8.11042723757502,
                        },
                        "21": {
                            "0": "PeytonManning",
                            "1": "2015-12-23",
                            "2": 7.77527584648686,
                        },
                        "22": {
                            "0": "PeytonManning",
                            "1": "2015-12-24",
                            "2": 7.34729970074316,
                        },
                        "23": {
                            "0": "PeytonManning",
                            "1": "2015-12-25",
                            "2": 7.30182234213793,
                        },
                        "24": {
                            "0": "PeytonManning",
                            "1": "2015-12-26",
                            "2": 7.12044437239249,
                        },
                        "25": {
                            "0": "PeytonManning",
                            "1": "2015-12-27",
                            "2": 8.87877607170755,
                        },
                        "26": {
                            "0": "PeytonManning",
                            "1": "2015-12-28",
                            "2": 9.25061821847475,
                        },
                        "27": {
                            "0": "PeytonManning",
                            "1": "2015-12-29",
                            "2": 9.24792513230345,
                        },
                        "28": {
                            "0": "PeytonManning",
                            "1": "2015-12-30",
                            "2": 8.39140318535794,
                        },
                        "29": {
                            "0": "PeytonManning",
                            "1": "2015-12-31",
                            "2": 8.00469951054955,
                        },
                        "30": {
                            "0": "PeytonManning",
                            "1": "2016-01-01",
                            "2": 7.58933582317062,
                        },
                        "31": {
                            "0": "PeytonManning",
                            "1": "2016-01-02",
                            "2": 7.82524529143177,
                        },
                        "32": {
                            "0": "PeytonManning",
                            "1": "2016-01-03",
                            "2": 8.24931374626064,
                        },
                        "33": {
                            "0": "PeytonManning",
                            "1": "2016-01-04",
                            "2": 9.29514097366865,
                        },
                        "34": {
                            "0": "PeytonManning",
                            "1": "2016-01-05",
                            "2": 8.56826646160024,
                        },
                        "35": {
                            "0": "PeytonManning",
                            "1": "2016-01-06",
                            "2": 8.35255436947459,
                        },
                        "36": {
                            "0": "PeytonManning",
                            "1": "2016-01-07",
                            "2": 8.29579811063615,
                        },
                        "37": {
                            "0": "PeytonManning",
                            "1": "2016-01-08",
                            "2": 8.29029259122431,
                        },
                        "38": {
                            "0": "PeytonManning",
                            "1": "2016-01-09",
                            "2": 7.78572089653462,
                        },
                        "39": {
                            "0": "PeytonManning",
                            "1": "2016-01-10",
                            "2": 8.28172399041139,
                        },
                        "40": {
                            "0": "PeytonManning",
                            "1": "2016-01-11",
                            "2": 8.4707303170059,
                        },
                        "41": {
                            "0": "PeytonManning",
                            "1": "2016-01-12",
                            "2": 8.13505390861157,
                        },
                        "42": {
                            "0": "PeytonManning",
                            "1": "2016-01-13",
                            "2": 8.06714903991011,
                        },
                        "43": {
                            "0": "TomBrady",
                            "1": "2015-12-02",
                            "2": 8.71177264560569,
                        },
                        "44": {
                            "0": "TomBrady",
                            "1": "2015-12-03",
                            "2": 8.05610965954506,
                        },
                        "45": {
                            "0": "TomBrady",
                            "1": "2015-12-04",
                            "2": 8.08147504013705,
                        },
                        "46": {
                            "0": "TomBrady",
                            "1": "2015-12-05",
                            "2": 7.45876269238096,
                        },
                        "47": {
                            "0": "TomBrady",
                            "1": "2015-12-06",
                            "2": 8.01400499477946,
                        },
                        "48": {
                            "0": "TomBrady",
                            "1": "2015-12-07",
                            "2": 8.49678638163858,
                        },
                        "49": {
                            "0": "TomBrady",
                            "1": "2015-12-08",
                            "2": 7.98104975966596,
                        },
                        "50": {
                            "0": "TomBrady",
                            "1": "2015-12-09",
                            "2": 7.77779262633883,
                        },
                        "51": {
                            "0": "TomBrady",
                            "1": "2015-12-10",
                            "2": 8.2602342916073,
                        },
                        "52": {
                            "0": "TomBrady",
                            "1": "2015-12-11",
                            "2": 7.86633892304654,
                        },
                        "53": {
                            "0": "TomBrady",
                            "1": "2015-12-12",
                            "2": 7.31055015853442,
                        },
                        "54": {
                            "0": "TomBrady",
                            "1": "2015-12-13",
                            "2": 7.71824095195932,
                        },
                        "55": {
                            "0": "TomBrady",
                            "1": "2015-12-14",
                            "2": 8.31947369244219,
                        },
                        "56": {
                            "0": "TomBrady",
                            "1": "2015-12-15",
                            "2": 8.23668532271246,
                        },
                        "57": {
                            "0": "TomBrady",
                            "1": "2015-12-16",
                            "2": 7.80751004221619,
                        },
                        "58": {
                            "0": "TomBrady",
                            "1": "2015-12-17",
                            "2": 7.59186171488993,
                        },
                        "59": {
                            "0": "TomBrady",
                            "1": "2015-12-18",
                            "2": 7.52886925664225,
                        },
                        "60": {
                            "0": "TomBrady",
                            "1": "2015-12-19",
                            "2": 7.17165682276851,
                        },
                        "61": {
                            "0": "TomBrady",
                            "1": "2015-12-20",
                            "2": 7.89133075766189,
                        },
                        "62": {
                            "0": "TomBrady",
                            "1": "2015-12-21",
                            "2": 8.36007143564403,
                        },
                        "63": {
                            "0": "TomBrady",
                            "1": "2015-12-22",
                            "2": 8.11042723757502,
                        },
                        "64": {
                            "0": "TomBrady",
                            "1": "2015-12-23",
                            "2": 7.77527584648686,
                        },
                        "65": {
                            "0": "TomBrady",
                            "1": "2015-12-24",
                            "2": 7.34729970074316,
                        },
                        "66": {
                            "0": "TomBrady",
                            "1": "2015-12-25",
                            "2": 7.30182234213793,
                        },
                        "67": {
                            "0": "TomBrady",
                            "1": "2015-12-26",
                            "2": 7.12044437239249,
                        },
                        "68": {
                            "0": "TomBrady",
                            "1": "2015-12-27",
                            "2": 8.87877607170755,
                        },
                        "69": {
                            "0": "TomBrady",
                            "1": "2015-12-28",
                            "2": 9.25061821847475,
                        },
                        "70": {
                            "0": "TomBrady",
                            "1": "2015-12-29",
                            "2": 9.24792513230345,
                        },
                        "71": {
                            "0": "TomBrady",
                            "1": "2015-12-30",
                            "2": 8.39140318535794,
                        },
                        "72": {
                            "0": "TomBrady",
                            "1": "2015-12-31",
                            "2": 8.00469951054955,
                        },
                        "73": {
                            "0": "TomBrady",
                            "1": "2016-01-01",
                            "2": 7.58933582317062,
                        },
                        "74": {
                            "0": "TomBrady",
                            "1": "2016-01-02",
                            "2": 7.82524529143177,
                        },
                        "75": {
                            "0": "TomBrady",
                            "1": "2016-01-03",
                            "2": 8.24931374626064,
                        },
                        "76": {
                            "0": "TomBrady",
                            "1": "2016-01-04",
                            "2": 9.29514097366865,
                        },
                        "77": {
                            "0": "TomBrady",
                            "1": "2016-01-05",
                            "2": 8.56826646160024,
                        },
                        "78": {
                            "0": "TomBrady",
                            "1": "2016-01-06",
                            "2": 8.35255436947459,
                        },
                        "79": {
                            "0": "TomBrady",
                            "1": "2016-01-07",
                            "2": 8.29579811063615,
                        },
                        "80": {
                            "0": "TomBrady",
                            "1": "2016-01-08",
                            "2": 8.29029259122431,
                        },
                        "81": {
                            "0": "TomBrady",
                            "1": "2016-01-09",
                            "2": 7.78572089653462,
                        },
                        "82": {
                            "0": "TomBrady",
                            "1": "2016-01-10",
                            "2": 8.28172399041139,
                        },
                        "83": {
                            "0": "TomBrady",
                            "1": "2016-01-11",
                            "2": 8.4707303170059,
                        },
                        "84": {
                            "0": "TomBrady",
                            "1": "2016-01-12",
                            "2": 8.13505390861157,
                        },
                        "85": {
                            "0": "TomBrady",
                            "1": "2016-01-13",
                            "2": 8.06714903991011,
                        },
                    },
                },
                x=MultiSeriesInput(
                    columns=[
                        "unique_id",
                        "ds",
                        "normalized_fb_marketing_spend",
                        "normalized_google_marketing_spend",
                    ],
                    data=[
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-02",
                            "2": 0.5488135039273248,
                            "3": 0.5701967704178796,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-03",
                            "2": 0.7151893663724195,
                            "3": 0.43860151346232035,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-04",
                            "2": 0.6027633760716439,
                            "3": 0.9883738380592262,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-05",
                            "2": 0.5448831829968969,
                            "3": 0.10204481074802807,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-06",
                            "2": 0.4236547993389047,
                            "3": 0.2088767560948347,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-07",
                            "2": 0.6458941130666561,
                            "3": 0.16130951788499626,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-08",
                            "2": 0.4375872112626925,
                            "3": 0.6531083254653984,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-09",
                            "2": 0.8917730007820798,
                            "3": 0.2532916025397821,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-10",
                            "2": 0.9636627605010293,
                            "3": 0.4663107728563063,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-11",
                            "2": 0.3834415188257777,
                            "3": 0.24442559200160274,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-12",
                            "2": 0.7917250380826646,
                            "3": 0.15896958364551972,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-13",
                            "2": 0.5288949197529045,
                            "3": 0.11037514116430513,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-14",
                            "2": 0.5680445610939323,
                            "3": 0.6563295894652734,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-15",
                            "2": 0.925596638292661,
                            "3": 0.1381829513486138,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-16",
                            "2": 0.07103605819788694,
                            "3": 0.1965823616800535,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-17",
                            "2": 0.08712929970154071,
                            "3": 0.3687251706609641,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-18",
                            "2": 0.02021839744032572,
                            "3": 0.8209932298479351,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-19",
                            "2": 0.832619845547938,
                            "3": 0.09710127579306127,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-20",
                            "2": 0.7781567509498505,
                            "3": 0.8379449074988039,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-21",
                            "2": 0.8700121482468192,
                            "3": 0.09609840789396307,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-22",
                            "2": 0.978618342232764,
                            "3": 0.9764594650133958,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-23",
                            "2": 0.7991585642167236,
                            "3": 0.4686512016477016,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-24",
                            "2": 0.46147936225293185,
                            "3": 0.9767610881903371,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-25",
                            "2": 0.7805291762864555,
                            "3": 0.604845519745046,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-26",
                            "2": 0.11827442586893322,
                            "3": 0.7392635793983017,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-27",
                            "2": 0.6399210213275238,
                            "3": 0.039187792254320675,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-28",
                            "2": 0.1433532874090464,
                            "3": 0.2828069625764096,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-29",
                            "2": 0.9446689170495839,
                            "3": 0.1201965612131689,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-30",
                            "2": 0.5218483217500717,
                            "3": 0.29614019752214493,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-31",
                            "2": 0.4146619399905236,
                            "3": 0.11872771895424405,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-01",
                            "2": 0.26455561210462697,
                            "3": 0.317983179393976,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-02",
                            "2": 0.7742336894342167,
                            "3": 0.41426299451466997,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-03",
                            "2": 0.45615033221654855,
                            "3": 0.06414749634878436,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-04",
                            "2": 0.5684339488686485,
                            "3": 0.6924721193700198,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-05",
                            "2": 0.018789800436355142,
                            "3": 0.5666014542065752,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-06",
                            "2": 0.6176354970758771,
                            "3": 0.2653894909394454,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-07",
                            "2": 0.6120957227224214,
                            "3": 0.5232480534666997,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-08",
                            "2": 0.6169339968747569,
                            "3": 0.09394051075844168,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-09",
                            "2": 0.9437480785146242,
                            "3": 0.5759464955561793,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-10",
                            "2": 0.6818202991034834,
                            "3": 0.9292961975762141,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-11",
                            "2": 0.359507900573786,
                            "3": 0.31856895245132366,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-12",
                            "2": 0.43703195379934145,
                            "3": 0.6674103799636817,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-13",
                            "2": 0.6976311959272649,
                            "3": 0.13179786240439217,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-14",
                            "2": 0.06022547162926983,
                            "3": 0.7163272041185655,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-15",
                            "2": 0.6667667154456677,
                            "3": 0.2894060929472011,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-16",
                            "2": 0.6706378696181594,
                            "3": 0.18319136200711683,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-17",
                            "2": 0.2103825610738409,
                            "3": 0.5865129348100832,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-18",
                            "2": 0.1289262976548533,
                            "3": 0.020107546187493552,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-19",
                            "2": 0.31542835092418386,
                            "3": 0.8289400292173631,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-20",
                            "2": 0.3637107709426226,
                            "3": 0.004695476192547066,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-02",
                            "2": 0.5488135039273248,
                            "3": 0.5701967704178796,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-03",
                            "2": 0.7151893663724195,
                            "3": 0.43860151346232035,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-04",
                            "2": 0.6027633760716439,
                            "3": 0.9883738380592262,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-05",
                            "2": 0.5448831829968969,
                            "3": 0.10204481074802807,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-06",
                            "2": 0.4236547993389047,
                            "3": 0.2088767560948347,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-07",
                            "2": 0.6458941130666561,
                            "3": 0.16130951788499626,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-08",
                            "2": 0.4375872112626925,
                            "3": 0.6531083254653984,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-09",
                            "2": 0.8917730007820798,
                            "3": 0.2532916025397821,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-10",
                            "2": 0.9636627605010293,
                            "3": 0.4663107728563063,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-11",
                            "2": 0.3834415188257777,
                            "3": 0.24442559200160274,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-12",
                            "2": 0.7917250380826646,
                            "3": 0.15896958364551972,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-13",
                            "2": 0.5288949197529045,
                            "3": 0.11037514116430513,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-14",
                            "2": 0.5680445610939323,
                            "3": 0.6563295894652734,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-15",
                            "2": 0.925596638292661,
                            "3": 0.1381829513486138,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-16",
                            "2": 0.07103605819788694,
                            "3": 0.1965823616800535,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-17",
                            "2": 0.08712929970154071,
                            "3": 0.3687251706609641,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-18",
                            "2": 0.02021839744032572,
                            "3": 0.8209932298479351,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-19",
                            "2": 0.832619845547938,
                            "3": 0.09710127579306127,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-20",
                            "2": 0.7781567509498505,
                            "3": 0.8379449074988039,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-21",
                            "2": 0.8700121482468192,
                            "3": 0.09609840789396307,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-22",
                            "2": 0.978618342232764,
                            "3": 0.9764594650133958,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-23",
                            "2": 0.7991585642167236,
                            "3": 0.4686512016477016,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-24",
                            "2": 0.46147936225293185,
                            "3": 0.9767610881903371,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-25",
                            "2": 0.7805291762864555,
                            "3": 0.604845519745046,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-26",
                            "2": 0.11827442586893322,
                            "3": 0.7392635793983017,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-27",
                            "2": 0.6399210213275238,
                            "3": 0.039187792254320675,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-28",
                            "2": 0.1433532874090464,
                            "3": 0.2828069625764096,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-29",
                            "2": 0.9446689170495839,
                            "3": 0.1201965612131689,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-30",
                            "2": 0.5218483217500717,
                            "3": 0.29614019752214493,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-31",
                            "2": 0.4146619399905236,
                            "3": 0.11872771895424405,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-01",
                            "2": 0.26455561210462697,
                            "3": 0.317983179393976,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-02",
                            "2": 0.7742336894342167,
                            "3": 0.41426299451466997,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-03",
                            "2": 0.45615033221654855,
                            "3": 0.06414749634878436,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-04",
                            "2": 0.5684339488686485,
                            "3": 0.6924721193700198,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-05",
                            "2": 0.018789800436355142,
                            "3": 0.5666014542065752,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-06",
                            "2": 0.6176354970758771,
                            "3": 0.2653894909394454,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-07",
                            "2": 0.6120957227224214,
                            "3": 0.5232480534666997,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-08",
                            "2": 0.6169339968747569,
                            "3": 0.09394051075844168,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-09",
                            "2": 0.9437480785146242,
                            "3": 0.5759464955561793,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-10",
                            "2": 0.6818202991034834,
                            "3": 0.9292961975762141,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-11",
                            "2": 0.359507900573786,
                            "3": 0.31856895245132366,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-12",
                            "2": 0.43703195379934145,
                            "3": 0.6674103799636817,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-13",
                            "2": 0.6976311959272649,
                            "3": 0.13179786240439217,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-14",
                            "2": 0.06022547162926983,
                            "3": 0.7163272041185655,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-15",
                            "2": 0.6667667154456677,
                            "3": 0.2894060929472011,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-16",
                            "2": 0.6706378696181594,
                            "3": 0.18319136200711683,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-17",
                            "2": 0.2103825610738409,
                            "3": 0.5865129348100832,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-18",
                            "2": 0.1289262976548533,
                            "3": 0.020107546187493552,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-19",
                            "2": 0.31542835092418386,
                            "3": 0.8289400292173631,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-20",
                            "2": 0.3637107709426226,
                            "3": 0.004695476192547066,
                        },
                    ],
                ),
            ),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "cross_validation_multi_series"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def model_input_size(
        self, *, request: SingleSeriesForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Parameters:
            - request: SingleSeriesForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import SingleSeriesForecast
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.model_input_size(
            request=SingleSeriesForecast(),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "model_input_size"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def model_params(
        self, *, request: SingleSeriesForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Parameters:
            - request: SingleSeriesForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import SingleSeriesForecast
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.model_params(
            request=SingleSeriesForecast(),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "model_params"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def timegpt(
        self, *, request: SingleSeriesForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        This endpoint predicts the future values of a single time series based on the provided data. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values based on the input arguments. Get your token for private beta at https://dashboard.nixtla.io

        Parameters:
            - request: SingleSeriesForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import SingleSeriesForecast
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.timegpt(
            request=SingleSeriesForecast(
                model="timegpt-1",
                freq="D",
                level=[90],
                fh=7,
                y={
                    "2015-12-02": 8.71177264560569,
                    "2015-12-03": 8.05610965954506,
                    "2015-12-04": 8.08147504013705,
                    "2015-12-05": 7.45876269238096,
                    "2015-12-06": 8.01400499477946,
                    "2015-12-07": 8.49678638163858,
                    "2015-12-08": 7.98104975966596,
                    "2015-12-09": 7.77779262633883,
                    "2015-12-10": 8.2602342916073,
                    "2015-12-11": 7.86633892304654,
                    "2015-12-12": 7.31055015853442,
                    "2015-12-13": 7.71824095195932,
                    "2015-12-14": 8.31947369244219,
                    "2015-12-15": 8.23668532271246,
                    "2015-12-16": 7.80751004221619,
                    "2015-12-17": 7.59186171488993,
                    "2015-12-18": 7.52886925664225,
                    "2015-12-19": 7.17165682276851,
                    "2015-12-20": 7.89133075766189,
                    "2015-12-21": 8.36007143564403,
                    "2015-12-22": 8.11042723757502,
                    "2015-12-23": 7.77527584648686,
                    "2015-12-24": 7.34729970074316,
                    "2015-12-25": 7.30182234213793,
                    "2015-12-26": 7.12044437239249,
                    "2015-12-27": 8.87877607170755,
                    "2015-12-28": 9.25061821847475,
                    "2015-12-29": 9.24792513230345,
                    "2015-12-30": 8.39140318535794,
                    "2015-12-31": 8.00469951054955,
                    "2016-01-01": 7.58933582317062,
                    "2016-01-02": 7.82524529143177,
                    "2016-01-03": 8.24931374626064,
                    "2016-01-04": 9.29514097366865,
                    "2016-01-05": 8.56826646160024,
                    "2016-01-06": 8.35255436947459,
                    "2016-01-07": 8.29579811063615,
                    "2016-01-08": 8.29029259122431,
                    "2016-01-09": 7.78572089653462,
                    "2016-01-10": 8.28172399041139,
                    "2016-01-11": 8.4707303170059,
                    "2016-01-12": 8.13505390861157,
                    "2016-01-13": 8.06714903991011,
                },
                x={
                    "2015-12-02": [0.5488135039273248, 0.5701967704178796],
                    "2015-12-03": [0.7151893663724195, 0.43860151346232035],
                    "2015-12-04": [0.6027633760716439, 0.9883738380592262],
                    "2015-12-05": [0.5448831829968969, 0.10204481074802807],
                    "2015-12-06": [0.4236547993389047, 0.2088767560948347],
                    "2015-12-07": [0.6458941130666561, 0.16130951788499626],
                    "2015-12-08": [0.4375872112626925, 0.6531083254653984],
                    "2015-12-09": [0.8917730007820798, 0.2532916025397821],
                    "2015-12-10": [0.9636627605010293, 0.4663107728563063],
                    "2015-12-11": [0.3834415188257777, 0.24442559200160274],
                    "2015-12-12": [0.7917250380826646, 0.15896958364551972],
                    "2015-12-13": [0.5288949197529045, 0.11037514116430513],
                    "2015-12-14": [0.5680445610939323, 0.6563295894652734],
                    "2015-12-15": [0.925596638292661, 0.1381829513486138],
                    "2015-12-16": [0.07103605819788694, 0.1965823616800535],
                    "2015-12-17": [0.08712929970154071, 0.3687251706609641],
                    "2015-12-18": [0.02021839744032572, 0.8209932298479351],
                    "2015-12-19": [0.832619845547938, 0.09710127579306127],
                    "2015-12-20": [0.7781567509498505, 0.8379449074988039],
                    "2015-12-21": [0.8700121482468192, 0.09609840789396307],
                    "2015-12-22": [0.978618342232764, 0.9764594650133958],
                    "2015-12-23": [0.7991585642167236, 0.4686512016477016],
                    "2015-12-24": [0.46147936225293185, 0.9767610881903371],
                    "2015-12-25": [0.7805291762864555, 0.604845519745046],
                    "2015-12-26": [0.11827442586893322, 0.7392635793983017],
                    "2015-12-27": [0.6399210213275238, 0.039187792254320675],
                    "2015-12-28": [0.1433532874090464, 0.2828069625764096],
                    "2015-12-29": [0.9446689170495839, 0.1201965612131689],
                    "2015-12-30": [0.5218483217500717, 0.29614019752214493],
                    "2015-12-31": [0.4146619399905236, 0.11872771895424405],
                    "2016-01-01": [0.26455561210462697, 0.317983179393976],
                    "2016-01-02": [0.7742336894342167, 0.41426299451466997],
                    "2016-01-03": [0.45615033221654855, 0.06414749634878436],
                    "2016-01-04": [0.5684339488686485, 0.6924721193700198],
                    "2016-01-05": [0.018789800436355142, 0.5666014542065752],
                    "2016-01-06": [0.6176354970758771, 0.2653894909394454],
                    "2016-01-07": [0.6120957227224214, 0.5232480534666997],
                    "2016-01-08": [0.6169339968747569, 0.09394051075844168],
                    "2016-01-09": [0.9437480785146242, 0.5759464955561793],
                    "2016-01-10": [0.6818202991034834, 0.9292961975762141],
                    "2016-01-11": [0.359507900573786, 0.31856895245132366],
                    "2016-01-12": [0.43703195379934145, 0.6674103799636817],
                    "2016-01-13": [0.6976311959272649, 0.13179786240439217],
                    "2016-01-14": [0.06022547162926983, 0.7163272041185655],
                    "2016-01-15": [0.6667667154456677, 0.2894060929472011],
                    "2016-01-16": [0.6706378696181594, 0.18319136200711683],
                    "2016-01-17": [0.2103825610738409, 0.5865129348100832],
                    "2016-01-18": [0.1289262976548533, 0.020107546187493552],
                    "2016-01-19": [0.31542835092418386, 0.8289400292173631],
                    "2016-01-20": [0.3637107709426226, 0.004695476192547066],
                },
                clean_ex_first=True,
                finetune_steps=0,
            ),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "timegpt"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def timegpt_historic(
        self, *, request: SingleSeriesInsampleForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Based on the provided data, this endpoint predicts time series data for the in-sample period (historical period). It takes a JSON as an input, including information like the series frequency and the historical data. (See below for a full description of the parameters.) The response contains the predicted values for the historical period. Usually useful for anomaly detection. Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - request: SingleSeriesInsampleForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import SingleSeriesInsampleForecast
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.timegpt_historic(
            request=SingleSeriesInsampleForecast(
                model="timegpt-1",
                freq="D",
                level=[90],
                y={
                    "2015-12-02": 8.71177264560569,
                    "2015-12-03": 8.05610965954506,
                    "2015-12-04": 8.08147504013705,
                    "2015-12-05": 7.45876269238096,
                    "2015-12-06": 8.01400499477946,
                    "2015-12-07": 8.49678638163858,
                    "2015-12-08": 7.98104975966596,
                    "2015-12-09": 7.77779262633883,
                    "2015-12-10": 8.2602342916073,
                    "2015-12-11": 7.86633892304654,
                    "2015-12-12": 7.31055015853442,
                    "2015-12-13": 7.71824095195932,
                    "2015-12-14": 8.31947369244219,
                    "2015-12-15": 8.23668532271246,
                    "2015-12-16": 7.80751004221619,
                    "2015-12-17": 7.59186171488993,
                    "2015-12-18": 7.52886925664225,
                    "2015-12-19": 7.17165682276851,
                    "2015-12-20": 7.89133075766189,
                    "2015-12-21": 8.36007143564403,
                    "2015-12-22": 8.11042723757502,
                    "2015-12-23": 7.77527584648686,
                    "2015-12-24": 7.34729970074316,
                    "2015-12-25": 7.30182234213793,
                    "2015-12-26": 7.12044437239249,
                    "2015-12-27": 8.87877607170755,
                    "2015-12-28": 9.25061821847475,
                    "2015-12-29": 9.24792513230345,
                    "2015-12-30": 8.39140318535794,
                    "2015-12-31": 8.00469951054955,
                    "2016-01-01": 7.58933582317062,
                    "2016-01-02": 7.82524529143177,
                    "2016-01-03": 8.24931374626064,
                    "2016-01-04": 9.29514097366865,
                    "2016-01-05": 8.56826646160024,
                    "2016-01-06": 8.35255436947459,
                    "2016-01-07": 8.29579811063615,
                    "2016-01-08": 8.29029259122431,
                    "2016-01-09": 7.78572089653462,
                    "2016-01-10": 8.28172399041139,
                    "2016-01-11": 8.4707303170059,
                    "2016-01-12": 8.13505390861157,
                    "2016-01-13": 8.06714903991011,
                },
                clean_ex_first=True,
            ),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "timegpt_historic"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def timegpt_multi_series(
        self, *, request: MultiSeriesForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Based on the provided data, this endpoint predicts the future values of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values for each series based on the input arguments. Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - request: MultiSeriesForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import MultiSeriesForecast
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.timegpt_multi_series(
            request=MultiSeriesForecast(),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "timegpt_multi_series"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def timegpt_multi_series_historic(
        self, *, request: MultiSeriesInsampleForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Based on the provided data, this endpoint predicts the in-sample period (historical period) values of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values for the historical period. Usually useful for anomaly detection. Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - request: MultiSeriesInsampleForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import MultiSeriesInsampleForecast
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.timegpt_multi_series_historic(
            request=MultiSeriesInsampleForecast(
                model="timegpt-1",
                freq="D",
                level=[90],
                y={
                    "columns": {"0": "unique_id", "1": "ds", "2": "y"},
                    "data": {
                        "0": {
                            "0": "PeytonManning",
                            "1": "2015-12-02",
                            "2": 8.71177264560569,
                        },
                        "1": {
                            "0": "PeytonManning",
                            "1": "2015-12-03",
                            "2": 8.05610965954506,
                        },
                        "2": {
                            "0": "PeytonManning",
                            "1": "2015-12-04",
                            "2": 8.08147504013705,
                        },
                        "3": {
                            "0": "PeytonManning",
                            "1": "2015-12-05",
                            "2": 7.45876269238096,
                        },
                        "4": {
                            "0": "PeytonManning",
                            "1": "2015-12-06",
                            "2": 8.01400499477946,
                        },
                        "5": {
                            "0": "PeytonManning",
                            "1": "2015-12-07",
                            "2": 8.49678638163858,
                        },
                        "6": {
                            "0": "PeytonManning",
                            "1": "2015-12-08",
                            "2": 7.98104975966596,
                        },
                        "7": {
                            "0": "PeytonManning",
                            "1": "2015-12-09",
                            "2": 7.77779262633883,
                        },
                        "8": {
                            "0": "PeytonManning",
                            "1": "2015-12-10",
                            "2": 8.2602342916073,
                        },
                        "9": {
                            "0": "PeytonManning",
                            "1": "2015-12-11",
                            "2": 7.86633892304654,
                        },
                        "10": {
                            "0": "PeytonManning",
                            "1": "2015-12-12",
                            "2": 7.31055015853442,
                        },
                        "11": {
                            "0": "PeytonManning",
                            "1": "2015-12-13",
                            "2": 7.71824095195932,
                        },
                        "12": {
                            "0": "PeytonManning",
                            "1": "2015-12-14",
                            "2": 8.31947369244219,
                        },
                        "13": {
                            "0": "PeytonManning",
                            "1": "2015-12-15",
                            "2": 8.23668532271246,
                        },
                        "14": {
                            "0": "PeytonManning",
                            "1": "2015-12-16",
                            "2": 7.80751004221619,
                        },
                        "15": {
                            "0": "PeytonManning",
                            "1": "2015-12-17",
                            "2": 7.59186171488993,
                        },
                        "16": {
                            "0": "PeytonManning",
                            "1": "2015-12-18",
                            "2": 7.52886925664225,
                        },
                        "17": {
                            "0": "PeytonManning",
                            "1": "2015-12-19",
                            "2": 7.17165682276851,
                        },
                        "18": {
                            "0": "PeytonManning",
                            "1": "2015-12-20",
                            "2": 7.89133075766189,
                        },
                        "19": {
                            "0": "PeytonManning",
                            "1": "2015-12-21",
                            "2": 8.36007143564403,
                        },
                        "20": {
                            "0": "PeytonManning",
                            "1": "2015-12-22",
                            "2": 8.11042723757502,
                        },
                        "21": {
                            "0": "PeytonManning",
                            "1": "2015-12-23",
                            "2": 7.77527584648686,
                        },
                        "22": {
                            "0": "PeytonManning",
                            "1": "2015-12-24",
                            "2": 7.34729970074316,
                        },
                        "23": {
                            "0": "PeytonManning",
                            "1": "2015-12-25",
                            "2": 7.30182234213793,
                        },
                        "24": {
                            "0": "PeytonManning",
                            "1": "2015-12-26",
                            "2": 7.12044437239249,
                        },
                        "25": {
                            "0": "PeytonManning",
                            "1": "2015-12-27",
                            "2": 8.87877607170755,
                        },
                        "26": {
                            "0": "PeytonManning",
                            "1": "2015-12-28",
                            "2": 9.25061821847475,
                        },
                        "27": {
                            "0": "PeytonManning",
                            "1": "2015-12-29",
                            "2": 9.24792513230345,
                        },
                        "28": {
                            "0": "PeytonManning",
                            "1": "2015-12-30",
                            "2": 8.39140318535794,
                        },
                        "29": {
                            "0": "PeytonManning",
                            "1": "2015-12-31",
                            "2": 8.00469951054955,
                        },
                        "30": {
                            "0": "PeytonManning",
                            "1": "2016-01-01",
                            "2": 7.58933582317062,
                        },
                        "31": {
                            "0": "PeytonManning",
                            "1": "2016-01-02",
                            "2": 7.82524529143177,
                        },
                        "32": {
                            "0": "PeytonManning",
                            "1": "2016-01-03",
                            "2": 8.24931374626064,
                        },
                        "33": {
                            "0": "PeytonManning",
                            "1": "2016-01-04",
                            "2": 9.29514097366865,
                        },
                        "34": {
                            "0": "PeytonManning",
                            "1": "2016-01-05",
                            "2": 8.56826646160024,
                        },
                        "35": {
                            "0": "PeytonManning",
                            "1": "2016-01-06",
                            "2": 8.35255436947459,
                        },
                        "36": {
                            "0": "PeytonManning",
                            "1": "2016-01-07",
                            "2": 8.29579811063615,
                        },
                        "37": {
                            "0": "PeytonManning",
                            "1": "2016-01-08",
                            "2": 8.29029259122431,
                        },
                        "38": {
                            "0": "PeytonManning",
                            "1": "2016-01-09",
                            "2": 7.78572089653462,
                        },
                        "39": {
                            "0": "PeytonManning",
                            "1": "2016-01-10",
                            "2": 8.28172399041139,
                        },
                        "40": {
                            "0": "PeytonManning",
                            "1": "2016-01-11",
                            "2": 8.4707303170059,
                        },
                        "41": {
                            "0": "PeytonManning",
                            "1": "2016-01-12",
                            "2": 8.13505390861157,
                        },
                        "42": {
                            "0": "PeytonManning",
                            "1": "2016-01-13",
                            "2": 8.06714903991011,
                        },
                        "43": {
                            "0": "TomBrady",
                            "1": "2015-12-02",
                            "2": 8.71177264560569,
                        },
                        "44": {
                            "0": "TomBrady",
                            "1": "2015-12-03",
                            "2": 8.05610965954506,
                        },
                        "45": {
                            "0": "TomBrady",
                            "1": "2015-12-04",
                            "2": 8.08147504013705,
                        },
                        "46": {
                            "0": "TomBrady",
                            "1": "2015-12-05",
                            "2": 7.45876269238096,
                        },
                        "47": {
                            "0": "TomBrady",
                            "1": "2015-12-06",
                            "2": 8.01400499477946,
                        },
                        "48": {
                            "0": "TomBrady",
                            "1": "2015-12-07",
                            "2": 8.49678638163858,
                        },
                        "49": {
                            "0": "TomBrady",
                            "1": "2015-12-08",
                            "2": 7.98104975966596,
                        },
                        "50": {
                            "0": "TomBrady",
                            "1": "2015-12-09",
                            "2": 7.77779262633883,
                        },
                        "51": {
                            "0": "TomBrady",
                            "1": "2015-12-10",
                            "2": 8.2602342916073,
                        },
                        "52": {
                            "0": "TomBrady",
                            "1": "2015-12-11",
                            "2": 7.86633892304654,
                        },
                        "53": {
                            "0": "TomBrady",
                            "1": "2015-12-12",
                            "2": 7.31055015853442,
                        },
                        "54": {
                            "0": "TomBrady",
                            "1": "2015-12-13",
                            "2": 7.71824095195932,
                        },
                        "55": {
                            "0": "TomBrady",
                            "1": "2015-12-14",
                            "2": 8.31947369244219,
                        },
                        "56": {
                            "0": "TomBrady",
                            "1": "2015-12-15",
                            "2": 8.23668532271246,
                        },
                        "57": {
                            "0": "TomBrady",
                            "1": "2015-12-16",
                            "2": 7.80751004221619,
                        },
                        "58": {
                            "0": "TomBrady",
                            "1": "2015-12-17",
                            "2": 7.59186171488993,
                        },
                        "59": {
                            "0": "TomBrady",
                            "1": "2015-12-18",
                            "2": 7.52886925664225,
                        },
                        "60": {
                            "0": "TomBrady",
                            "1": "2015-12-19",
                            "2": 7.17165682276851,
                        },
                        "61": {
                            "0": "TomBrady",
                            "1": "2015-12-20",
                            "2": 7.89133075766189,
                        },
                        "62": {
                            "0": "TomBrady",
                            "1": "2015-12-21",
                            "2": 8.36007143564403,
                        },
                        "63": {
                            "0": "TomBrady",
                            "1": "2015-12-22",
                            "2": 8.11042723757502,
                        },
                        "64": {
                            "0": "TomBrady",
                            "1": "2015-12-23",
                            "2": 7.77527584648686,
                        },
                        "65": {
                            "0": "TomBrady",
                            "1": "2015-12-24",
                            "2": 7.34729970074316,
                        },
                        "66": {
                            "0": "TomBrady",
                            "1": "2015-12-25",
                            "2": 7.30182234213793,
                        },
                        "67": {
                            "0": "TomBrady",
                            "1": "2015-12-26",
                            "2": 7.12044437239249,
                        },
                        "68": {
                            "0": "TomBrady",
                            "1": "2015-12-27",
                            "2": 8.87877607170755,
                        },
                        "69": {
                            "0": "TomBrady",
                            "1": "2015-12-28",
                            "2": 9.25061821847475,
                        },
                        "70": {
                            "0": "TomBrady",
                            "1": "2015-12-29",
                            "2": 9.24792513230345,
                        },
                        "71": {
                            "0": "TomBrady",
                            "1": "2015-12-30",
                            "2": 8.39140318535794,
                        },
                        "72": {
                            "0": "TomBrady",
                            "1": "2015-12-31",
                            "2": 8.00469951054955,
                        },
                        "73": {
                            "0": "TomBrady",
                            "1": "2016-01-01",
                            "2": 7.58933582317062,
                        },
                        "74": {
                            "0": "TomBrady",
                            "1": "2016-01-02",
                            "2": 7.82524529143177,
                        },
                        "75": {
                            "0": "TomBrady",
                            "1": "2016-01-03",
                            "2": 8.24931374626064,
                        },
                        "76": {
                            "0": "TomBrady",
                            "1": "2016-01-04",
                            "2": 9.29514097366865,
                        },
                        "77": {
                            "0": "TomBrady",
                            "1": "2016-01-05",
                            "2": 8.56826646160024,
                        },
                        "78": {
                            "0": "TomBrady",
                            "1": "2016-01-06",
                            "2": 8.35255436947459,
                        },
                        "79": {
                            "0": "TomBrady",
                            "1": "2016-01-07",
                            "2": 8.29579811063615,
                        },
                        "80": {
                            "0": "TomBrady",
                            "1": "2016-01-08",
                            "2": 8.29029259122431,
                        },
                        "81": {
                            "0": "TomBrady",
                            "1": "2016-01-09",
                            "2": 7.78572089653462,
                        },
                        "82": {
                            "0": "TomBrady",
                            "1": "2016-01-10",
                            "2": 8.28172399041139,
                        },
                        "83": {
                            "0": "TomBrady",
                            "1": "2016-01-11",
                            "2": 8.4707303170059,
                        },
                        "84": {
                            "0": "TomBrady",
                            "1": "2016-01-12",
                            "2": 8.13505390861157,
                        },
                        "85": {
                            "0": "TomBrady",
                            "1": "2016-01-13",
                            "2": 8.06714903991011,
                        },
                    },
                },
            ),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "timegpt_multi_series_historic"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def timegpt_multi_series_anomalies(
        self, *, request: MultiSeriesAnomaly, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Based on the provided data, this endpoint detects the anomalies in the historical perdiod of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains a flag indicating if the date has a anomaly and also provides the prediction interval used to define if an observation is an anomaly.Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - request: MultiSeriesAnomaly.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import MultiSeriesAnomaly
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.timegpt_multi_series_anomalies(
            request=MultiSeriesAnomaly(),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "timegpt_multi_series_anomalies"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def timegpt_multi_series_cross_validation(
        self, *, request: MultiSeriesCrossValidation, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Perform Cross Validation for multiple series

        Parameters:
            - request: MultiSeriesCrossValidation.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import MultiSeriesCrossValidation
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.timegpt_multi_series_cross_validation(
            request=MultiSeriesCrossValidation(),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "timegpt_multi_series_cross_validation"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def timegpt_input_size(
        self, *, request: SingleSeriesForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Parameters:
            - request: SingleSeriesForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import SingleSeriesForecast
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.timegpt_input_size(
            request=SingleSeriesForecast(),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "timegpt_input_size"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def timegpt_model_params(
        self, *, request: SingleSeriesForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Parameters:
            - request: SingleSeriesForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import SingleSeriesForecast
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.timegpt_model_params(
            request=SingleSeriesForecast(),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "timegpt_model_params"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def v_2_forecast(
        self,
        *,
        series: SeriesWithFutureExogenous,
        freq: str,
        h: int,
        model: typing.Optional[Model] = OMIT,
        clean_ex_first: typing.Optional[bool] = OMIT,
        level: typing.Optional[typing.Sequence[ForecastInputLevelItem]] = OMIT,
        finetune_steps: typing.Optional[int] = OMIT,
        finetune_loss: typing.Optional[ForecastInputFinetuneLoss] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ForecastOutput:
        """
        Based on the provided data, this endpoint predicts the future values of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values for each series based on the input arguments. Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - series: SeriesWithFutureExogenous.

            - freq: str. The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available.

            - h: int. The forecasting horizon. This represents the number of time steps into the future that the forecast should predict.

            - model: typing.Optional[Model]. Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data.

            - clean_ex_first: typing.Optional[bool]. A boolean flag that indicates whether the API should preprocess (clean) the exogenous signal before applying the large time model. If True, the exogenous signal is cleaned; if False, the exogenous variables are applied after the large time model.

            - level: typing.Optional[typing.Sequence[ForecastInputLevelItem]].

            - finetune_steps: typing.Optional[int]. The number of tuning steps used to train the large time model on the data. Set this value to 0 for zero-shot inference, i.e., to make predictions without any further model tuning.

            - finetune_loss: typing.Optional[ForecastInputFinetuneLoss]. The loss used to train the large time model on the data. Select from ['default', 'mae', 'mse', 'rmse', 'mape', 'smape']. It will only be used if finetune_steps larger than 0. Default is a robust loss function that is less sensitive to outliers.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import SeriesWithFutureExogenous
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.v_2_forecast(
            series=SeriesWithFutureExogenous(
                y=[1.1],
                sizes=[1],
            ),
            freq="freq",
            h=1,
        )
        """
        _request: typing.Dict[str, typing.Any] = {"series": series, "freq": freq, "h": h}
        if model is not OMIT:
            _request["model"] = model
        if clean_ex_first is not OMIT:
            _request["clean_ex_first"] = clean_ex_first
        if level is not OMIT:
            _request["level"] = level
        if finetune_steps is not OMIT:
            _request["finetune_steps"] = finetune_steps
        if finetune_loss is not OMIT:
            _request["finetune_loss"] = finetune_loss
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v2/forecast"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(ForecastOutput, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def v_2_cross_validation(
        self,
        *,
        series: Series,
        freq: str,
        n_windows: int,
        h: int,
        model: typing.Optional[Model] = OMIT,
        clean_ex_first: typing.Optional[bool] = OMIT,
        level: typing.Optional[typing.Sequence[CrossValidationInputLevelItem]] = OMIT,
        finetune_steps: typing.Optional[int] = OMIT,
        finetune_loss: typing.Optional[CrossValidationInputFinetuneLoss] = OMIT,
        step_size: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CrossValidationOutput:
        """
        Perform Cross Validation for multiple series

        Parameters:
            - series: Series.

            - freq: str. The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available.

            - n_windows: int. Number of windows to evaluate.

            - h: int. The forecasting horizon. This represents the number of time steps into the future that the forecast should predict.

            - model: typing.Optional[Model]. Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data.

            - clean_ex_first: typing.Optional[bool]. A boolean flag that indicates whether the API should preprocess (clean) the exogenous signal before applying the large time model. If True, the exogenous signal is cleaned; if False, the exogenous variables are applied after the large time model.

            - level: typing.Optional[typing.Sequence[CrossValidationInputLevelItem]].

            - finetune_steps: typing.Optional[int]. The number of tuning steps used to train the large time model on the data. Set this value to 0 for zero-shot inference, i.e., to make predictions without any further model tuning.

            - finetune_loss: typing.Optional[CrossValidationInputFinetuneLoss]. The loss used to train the large time model on the data. Select from ['default', 'mae', 'mse', 'rmse', 'mape', 'smape']. It will only be used if finetune_steps larger than 0. Default is a robust loss function that is less sensitive to outliers.

            - step_size: typing.Optional[int].

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import Series
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.v_2_cross_validation(
            series=Series(
                y=[1.1],
                sizes=[1],
            ),
            freq="freq",
            n_windows=1,
            h=1,
        )
        """
        _request: typing.Dict[str, typing.Any] = {"series": series, "freq": freq, "n_windows": n_windows, "h": h}
        if model is not OMIT:
            _request["model"] = model
        if clean_ex_first is not OMIT:
            _request["clean_ex_first"] = clean_ex_first
        if level is not OMIT:
            _request["level"] = level
        if finetune_steps is not OMIT:
            _request["finetune_steps"] = finetune_steps
        if finetune_loss is not OMIT:
            _request["finetune_loss"] = finetune_loss
        if step_size is not OMIT:
            _request["step_size"] = step_size
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v2/cross_validation"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(CrossValidationOutput, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def v_2_historic_forecast(
        self,
        *,
        series: Series,
        freq: str,
        model: typing.Optional[Model] = OMIT,
        clean_ex_first: typing.Optional[bool] = OMIT,
        level: typing.Optional[typing.Sequence[InSampleInputLevelItem]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> InSampleOutput:
        """
        Based on the provided data, this endpoint predicts the in-sample period (historical period) values of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values for the historical period. Usually useful for anomaly detection. Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - series: Series.

            - freq: str. The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available.

            - model: typing.Optional[Model]. Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data.

            - clean_ex_first: typing.Optional[bool]. A boolean flag that indicates whether the API should preprocess (clean) the exogenous signal before applying the large time model. If True, the exogenous signal is cleaned; if False, the exogenous variables are applied after the large time model.

            - level: typing.Optional[typing.Sequence[InSampleInputLevelItem]].

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import Series
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.v_2_historic_forecast(
            series=Series(
                y=[1.1],
                sizes=[1],
            ),
            freq="freq",
        )
        """
        _request: typing.Dict[str, typing.Any] = {"series": series, "freq": freq}
        if model is not OMIT:
            _request["model"] = model
        if clean_ex_first is not OMIT:
            _request["clean_ex_first"] = clean_ex_first
        if level is not OMIT:
            _request["level"] = level
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v2/historic_forecast"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(InSampleOutput, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def v_2_anomaly_detection(
        self,
        *,
        series: Series,
        freq: str,
        model: typing.Optional[Model] = OMIT,
        clean_ex_first: typing.Optional[bool] = OMIT,
        level: typing.Optional[Level] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AnomalyDetectionOutput:
        """
        Based on the provided data, this endpoint detects the anomalies in the historical perdiod of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains a flag indicating if the date has a anomaly and also provides the prediction interval used to define if an observation is an anomaly.Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - series: Series.

            - freq: str. The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available.

            - model: typing.Optional[Model]. Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data.

            - clean_ex_first: typing.Optional[bool]. A boolean flag that indicates whether the API should preprocess (clean) the exogenous signal before applying the large time model. If True, the exogenous signal is cleaned; if False, the exogenous variables are applied after the large time model.

            - level: typing.Optional[Level]. Specifies the confidence level for the prediction interval used in anomaly detection. It is represented as a percentage between 0 and 100. For instance, a level of 95 indicates that the generated prediction interval captures the true future observation 95% of the time. Any observed values outside of this interval would be considered anomalies. A higher level leads to wider prediction intervals and potentially fewer detected anomalies, whereas a lower level results in narrower intervals and potentially more detected anomalies. Default: 99.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import Series
        from nixtla.client import Nixtla

        client = Nixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.v_2_anomaly_detection(
            series=Series(
                y=[1.1],
                sizes=[1],
            ),
            freq="freq",
        )
        """
        _request: typing.Dict[str, typing.Any] = {"series": series, "freq": freq}
        if model is not OMIT:
            _request["model"] = model
        if clean_ex_first is not OMIT:
            _request["clean_ex_first"] = clean_ex_first
        if level is not OMIT:
            _request["level"] = level
        _response = self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v2/anomaly_detection"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(AnomalyDetectionOutput, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)


class AsyncNixtla:
    """
    Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.

    Parameters:
        - base_url: str. The base url to use for requests from the client.

        - token: typing.Union[str, typing.Callable[[], str]].

        - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.

        - follow_redirects: typing.Optional[bool]. Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.

        - httpx_client: typing.Optional[httpx.AsyncClient]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
    ---
    from nixtla.client import AsyncNixtla

    client = AsyncNixtla(
        token="YOUR_TOKEN",
        base_url="https://yourhost.com/path/to/api",
    )
    """

    def __init__(
        self,
        *,
        base_url: str,
        token: typing.Union[str, typing.Callable[[], str]],
        timeout: typing.Optional[float] = None,
        follow_redirects: typing.Optional[bool] = None,
        httpx_client: typing.Optional[httpx.AsyncClient] = None,
    ):
        _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
        self._client_wrapper = AsyncClientWrapper(
            base_url=base_url,
            token=token,
            httpx_client=httpx_client
            if httpx_client is not None
            else httpx.AsyncClient(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
            if follow_redirects is not None
            else httpx.AsyncClient(timeout=_defaulted_timeout),
            timeout=_defaulted_timeout,
        )

    async def validate_token(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
        """
        Parameters:
            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.validate_token()
        """
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "validate_token"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))
            if request_options is not None
            else None,
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def validate_token_front(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
        """
        Parameters:
            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.validate_token_front()
        """
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "validate_token_front"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))
            if request_options is not None
            else None,
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def health_health_get(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
        """
        Check if server is healthy. Used by the readiness probe to check server is healthy.

        Parameters:
            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.health_health_get()
        """
        _response = await self._client_wrapper.httpx_client.request(
            "GET",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "health"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def forecast(
        self, *, request: SingleSeriesForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        This endpoint predicts the future values of a single time series based on the provided data. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values based on the input arguments. Get your token for private beta at https://dashboard.nixtla.io

        Parameters:
            - request: SingleSeriesForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import SingleSeriesForecast
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.forecast(
            request=SingleSeriesForecast(
                model="timegpt-1",
                freq="D",
                level=[90],
                fh=7,
                y={
                    "2015-12-02": 8.71177264560569,
                    "2015-12-03": 8.05610965954506,
                    "2015-12-04": 8.08147504013705,
                    "2015-12-05": 7.45876269238096,
                    "2015-12-06": 8.01400499477946,
                    "2015-12-07": 8.49678638163858,
                    "2015-12-08": 7.98104975966596,
                    "2015-12-09": 7.77779262633883,
                    "2015-12-10": 8.2602342916073,
                    "2015-12-11": 7.86633892304654,
                    "2015-12-12": 7.31055015853442,
                    "2015-12-13": 7.71824095195932,
                    "2015-12-14": 8.31947369244219,
                    "2015-12-15": 8.23668532271246,
                    "2015-12-16": 7.80751004221619,
                    "2015-12-17": 7.59186171488993,
                    "2015-12-18": 7.52886925664225,
                    "2015-12-19": 7.17165682276851,
                    "2015-12-20": 7.89133075766189,
                    "2015-12-21": 8.36007143564403,
                    "2015-12-22": 8.11042723757502,
                    "2015-12-23": 7.77527584648686,
                    "2015-12-24": 7.34729970074316,
                    "2015-12-25": 7.30182234213793,
                    "2015-12-26": 7.12044437239249,
                    "2015-12-27": 8.87877607170755,
                    "2015-12-28": 9.25061821847475,
                    "2015-12-29": 9.24792513230345,
                    "2015-12-30": 8.39140318535794,
                    "2015-12-31": 8.00469951054955,
                    "2016-01-01": 7.58933582317062,
                    "2016-01-02": 7.82524529143177,
                    "2016-01-03": 8.24931374626064,
                    "2016-01-04": 9.29514097366865,
                    "2016-01-05": 8.56826646160024,
                    "2016-01-06": 8.35255436947459,
                    "2016-01-07": 8.29579811063615,
                    "2016-01-08": 8.29029259122431,
                    "2016-01-09": 7.78572089653462,
                    "2016-01-10": 8.28172399041139,
                    "2016-01-11": 8.4707303170059,
                    "2016-01-12": 8.13505390861157,
                    "2016-01-13": 8.06714903991011,
                },
                x={
                    "2015-12-02": [0.5488135039273248, 0.5701967704178796],
                    "2015-12-03": [0.7151893663724195, 0.43860151346232035],
                    "2015-12-04": [0.6027633760716439, 0.9883738380592262],
                    "2015-12-05": [0.5448831829968969, 0.10204481074802807],
                    "2015-12-06": [0.4236547993389047, 0.2088767560948347],
                    "2015-12-07": [0.6458941130666561, 0.16130951788499626],
                    "2015-12-08": [0.4375872112626925, 0.6531083254653984],
                    "2015-12-09": [0.8917730007820798, 0.2532916025397821],
                    "2015-12-10": [0.9636627605010293, 0.4663107728563063],
                    "2015-12-11": [0.3834415188257777, 0.24442559200160274],
                    "2015-12-12": [0.7917250380826646, 0.15896958364551972],
                    "2015-12-13": [0.5288949197529045, 0.11037514116430513],
                    "2015-12-14": [0.5680445610939323, 0.6563295894652734],
                    "2015-12-15": [0.925596638292661, 0.1381829513486138],
                    "2015-12-16": [0.07103605819788694, 0.1965823616800535],
                    "2015-12-17": [0.08712929970154071, 0.3687251706609641],
                    "2015-12-18": [0.02021839744032572, 0.8209932298479351],
                    "2015-12-19": [0.832619845547938, 0.09710127579306127],
                    "2015-12-20": [0.7781567509498505, 0.8379449074988039],
                    "2015-12-21": [0.8700121482468192, 0.09609840789396307],
                    "2015-12-22": [0.978618342232764, 0.9764594650133958],
                    "2015-12-23": [0.7991585642167236, 0.4686512016477016],
                    "2015-12-24": [0.46147936225293185, 0.9767610881903371],
                    "2015-12-25": [0.7805291762864555, 0.604845519745046],
                    "2015-12-26": [0.11827442586893322, 0.7392635793983017],
                    "2015-12-27": [0.6399210213275238, 0.039187792254320675],
                    "2015-12-28": [0.1433532874090464, 0.2828069625764096],
                    "2015-12-29": [0.9446689170495839, 0.1201965612131689],
                    "2015-12-30": [0.5218483217500717, 0.29614019752214493],
                    "2015-12-31": [0.4146619399905236, 0.11872771895424405],
                    "2016-01-01": [0.26455561210462697, 0.317983179393976],
                    "2016-01-02": [0.7742336894342167, 0.41426299451466997],
                    "2016-01-03": [0.45615033221654855, 0.06414749634878436],
                    "2016-01-04": [0.5684339488686485, 0.6924721193700198],
                    "2016-01-05": [0.018789800436355142, 0.5666014542065752],
                    "2016-01-06": [0.6176354970758771, 0.2653894909394454],
                    "2016-01-07": [0.6120957227224214, 0.5232480534666997],
                    "2016-01-08": [0.6169339968747569, 0.09394051075844168],
                    "2016-01-09": [0.9437480785146242, 0.5759464955561793],
                    "2016-01-10": [0.6818202991034834, 0.9292961975762141],
                    "2016-01-11": [0.359507900573786, 0.31856895245132366],
                    "2016-01-12": [0.43703195379934145, 0.6674103799636817],
                    "2016-01-13": [0.6976311959272649, 0.13179786240439217],
                    "2016-01-14": [0.06022547162926983, 0.7163272041185655],
                    "2016-01-15": [0.6667667154456677, 0.2894060929472011],
                    "2016-01-16": [0.6706378696181594, 0.18319136200711683],
                    "2016-01-17": [0.2103825610738409, 0.5865129348100832],
                    "2016-01-18": [0.1289262976548533, 0.020107546187493552],
                    "2016-01-19": [0.31542835092418386, 0.8289400292173631],
                    "2016-01-20": [0.3637107709426226, 0.004695476192547066],
                },
                clean_ex_first=True,
                finetune_steps=0,
            ),
        )
        """
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "forecast"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def historic_forecast(
        self, *, request: SingleSeriesInsampleForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Based on the provided data, this endpoint predicts time series data for the in-sample period (historical period). It takes a JSON as an input, including information like the series frequency and the historical data. (See below for a full description of the parameters.) The response contains the predicted values for the historical period. Usually useful for anomaly detection. Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - request: SingleSeriesInsampleForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import SingleSeriesInsampleForecast
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.historic_forecast(
            request=SingleSeriesInsampleForecast(
                model="timegpt-1",
                freq="D",
                level=[90],
                y={
                    "2015-12-02": 8.71177264560569,
                    "2015-12-03": 8.05610965954506,
                    "2015-12-04": 8.08147504013705,
                    "2015-12-05": 7.45876269238096,
                    "2015-12-06": 8.01400499477946,
                    "2015-12-07": 8.49678638163858,
                    "2015-12-08": 7.98104975966596,
                    "2015-12-09": 7.77779262633883,
                    "2015-12-10": 8.2602342916073,
                    "2015-12-11": 7.86633892304654,
                    "2015-12-12": 7.31055015853442,
                    "2015-12-13": 7.71824095195932,
                    "2015-12-14": 8.31947369244219,
                    "2015-12-15": 8.23668532271246,
                    "2015-12-16": 7.80751004221619,
                    "2015-12-17": 7.59186171488993,
                    "2015-12-18": 7.52886925664225,
                    "2015-12-19": 7.17165682276851,
                    "2015-12-20": 7.89133075766189,
                    "2015-12-21": 8.36007143564403,
                    "2015-12-22": 8.11042723757502,
                    "2015-12-23": 7.77527584648686,
                    "2015-12-24": 7.34729970074316,
                    "2015-12-25": 7.30182234213793,
                    "2015-12-26": 7.12044437239249,
                    "2015-12-27": 8.87877607170755,
                    "2015-12-28": 9.25061821847475,
                    "2015-12-29": 9.24792513230345,
                    "2015-12-30": 8.39140318535794,
                    "2015-12-31": 8.00469951054955,
                    "2016-01-01": 7.58933582317062,
                    "2016-01-02": 7.82524529143177,
                    "2016-01-03": 8.24931374626064,
                    "2016-01-04": 9.29514097366865,
                    "2016-01-05": 8.56826646160024,
                    "2016-01-06": 8.35255436947459,
                    "2016-01-07": 8.29579811063615,
                    "2016-01-08": 8.29029259122431,
                    "2016-01-09": 7.78572089653462,
                    "2016-01-10": 8.28172399041139,
                    "2016-01-11": 8.4707303170059,
                    "2016-01-12": 8.13505390861157,
                    "2016-01-13": 8.06714903991011,
                },
                clean_ex_first=True,
            ),
        )
        """
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "historic_forecast"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def forecast_multi_series(
        self, *, request: MultiSeriesForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Based on the provided data, this endpoint predicts the future values of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values for each series based on the input arguments. Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - request: MultiSeriesForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import MultiSeriesForecast
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.forecast_multi_series(
            request=MultiSeriesForecast(),
        )
        """
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "forecast_multi_series"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def historic_forecast_multi_series(
        self, *, request: MultiSeriesInsampleForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Based on the provided data, this endpoint predicts the in-sample period (historical period) values of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values for the historical period. Usually useful for anomaly detection. Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - request: MultiSeriesInsampleForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import MultiSeriesInsampleForecast
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.historic_forecast_multi_series(
            request=MultiSeriesInsampleForecast(
                model="timegpt-1",
                freq="D",
                level=[90],
                y={
                    "columns": {"0": "unique_id", "1": "ds", "2": "y"},
                    "data": {
                        "0": {
                            "0": "PeytonManning",
                            "1": "2015-12-02",
                            "2": 8.71177264560569,
                        },
                        "1": {
                            "0": "PeytonManning",
                            "1": "2015-12-03",
                            "2": 8.05610965954506,
                        },
                        "2": {
                            "0": "PeytonManning",
                            "1": "2015-12-04",
                            "2": 8.08147504013705,
                        },
                        "3": {
                            "0": "PeytonManning",
                            "1": "2015-12-05",
                            "2": 7.45876269238096,
                        },
                        "4": {
                            "0": "PeytonManning",
                            "1": "2015-12-06",
                            "2": 8.01400499477946,
                        },
                        "5": {
                            "0": "PeytonManning",
                            "1": "2015-12-07",
                            "2": 8.49678638163858,
                        },
                        "6": {
                            "0": "PeytonManning",
                            "1": "2015-12-08",
                            "2": 7.98104975966596,
                        },
                        "7": {
                            "0": "PeytonManning",
                            "1": "2015-12-09",
                            "2": 7.77779262633883,
                        },
                        "8": {
                            "0": "PeytonManning",
                            "1": "2015-12-10",
                            "2": 8.2602342916073,
                        },
                        "9": {
                            "0": "PeytonManning",
                            "1": "2015-12-11",
                            "2": 7.86633892304654,
                        },
                        "10": {
                            "0": "PeytonManning",
                            "1": "2015-12-12",
                            "2": 7.31055015853442,
                        },
                        "11": {
                            "0": "PeytonManning",
                            "1": "2015-12-13",
                            "2": 7.71824095195932,
                        },
                        "12": {
                            "0": "PeytonManning",
                            "1": "2015-12-14",
                            "2": 8.31947369244219,
                        },
                        "13": {
                            "0": "PeytonManning",
                            "1": "2015-12-15",
                            "2": 8.23668532271246,
                        },
                        "14": {
                            "0": "PeytonManning",
                            "1": "2015-12-16",
                            "2": 7.80751004221619,
                        },
                        "15": {
                            "0": "PeytonManning",
                            "1": "2015-12-17",
                            "2": 7.59186171488993,
                        },
                        "16": {
                            "0": "PeytonManning",
                            "1": "2015-12-18",
                            "2": 7.52886925664225,
                        },
                        "17": {
                            "0": "PeytonManning",
                            "1": "2015-12-19",
                            "2": 7.17165682276851,
                        },
                        "18": {
                            "0": "PeytonManning",
                            "1": "2015-12-20",
                            "2": 7.89133075766189,
                        },
                        "19": {
                            "0": "PeytonManning",
                            "1": "2015-12-21",
                            "2": 8.36007143564403,
                        },
                        "20": {
                            "0": "PeytonManning",
                            "1": "2015-12-22",
                            "2": 8.11042723757502,
                        },
                        "21": {
                            "0": "PeytonManning",
                            "1": "2015-12-23",
                            "2": 7.77527584648686,
                        },
                        "22": {
                            "0": "PeytonManning",
                            "1": "2015-12-24",
                            "2": 7.34729970074316,
                        },
                        "23": {
                            "0": "PeytonManning",
                            "1": "2015-12-25",
                            "2": 7.30182234213793,
                        },
                        "24": {
                            "0": "PeytonManning",
                            "1": "2015-12-26",
                            "2": 7.12044437239249,
                        },
                        "25": {
                            "0": "PeytonManning",
                            "1": "2015-12-27",
                            "2": 8.87877607170755,
                        },
                        "26": {
                            "0": "PeytonManning",
                            "1": "2015-12-28",
                            "2": 9.25061821847475,
                        },
                        "27": {
                            "0": "PeytonManning",
                            "1": "2015-12-29",
                            "2": 9.24792513230345,
                        },
                        "28": {
                            "0": "PeytonManning",
                            "1": "2015-12-30",
                            "2": 8.39140318535794,
                        },
                        "29": {
                            "0": "PeytonManning",
                            "1": "2015-12-31",
                            "2": 8.00469951054955,
                        },
                        "30": {
                            "0": "PeytonManning",
                            "1": "2016-01-01",
                            "2": 7.58933582317062,
                        },
                        "31": {
                            "0": "PeytonManning",
                            "1": "2016-01-02",
                            "2": 7.82524529143177,
                        },
                        "32": {
                            "0": "PeytonManning",
                            "1": "2016-01-03",
                            "2": 8.24931374626064,
                        },
                        "33": {
                            "0": "PeytonManning",
                            "1": "2016-01-04",
                            "2": 9.29514097366865,
                        },
                        "34": {
                            "0": "PeytonManning",
                            "1": "2016-01-05",
                            "2": 8.56826646160024,
                        },
                        "35": {
                            "0": "PeytonManning",
                            "1": "2016-01-06",
                            "2": 8.35255436947459,
                        },
                        "36": {
                            "0": "PeytonManning",
                            "1": "2016-01-07",
                            "2": 8.29579811063615,
                        },
                        "37": {
                            "0": "PeytonManning",
                            "1": "2016-01-08",
                            "2": 8.29029259122431,
                        },
                        "38": {
                            "0": "PeytonManning",
                            "1": "2016-01-09",
                            "2": 7.78572089653462,
                        },
                        "39": {
                            "0": "PeytonManning",
                            "1": "2016-01-10",
                            "2": 8.28172399041139,
                        },
                        "40": {
                            "0": "PeytonManning",
                            "1": "2016-01-11",
                            "2": 8.4707303170059,
                        },
                        "41": {
                            "0": "PeytonManning",
                            "1": "2016-01-12",
                            "2": 8.13505390861157,
                        },
                        "42": {
                            "0": "PeytonManning",
                            "1": "2016-01-13",
                            "2": 8.06714903991011,
                        },
                        "43": {
                            "0": "TomBrady",
                            "1": "2015-12-02",
                            "2": 8.71177264560569,
                        },
                        "44": {
                            "0": "TomBrady",
                            "1": "2015-12-03",
                            "2": 8.05610965954506,
                        },
                        "45": {
                            "0": "TomBrady",
                            "1": "2015-12-04",
                            "2": 8.08147504013705,
                        },
                        "46": {
                            "0": "TomBrady",
                            "1": "2015-12-05",
                            "2": 7.45876269238096,
                        },
                        "47": {
                            "0": "TomBrady",
                            "1": "2015-12-06",
                            "2": 8.01400499477946,
                        },
                        "48": {
                            "0": "TomBrady",
                            "1": "2015-12-07",
                            "2": 8.49678638163858,
                        },
                        "49": {
                            "0": "TomBrady",
                            "1": "2015-12-08",
                            "2": 7.98104975966596,
                        },
                        "50": {
                            "0": "TomBrady",
                            "1": "2015-12-09",
                            "2": 7.77779262633883,
                        },
                        "51": {
                            "0": "TomBrady",
                            "1": "2015-12-10",
                            "2": 8.2602342916073,
                        },
                        "52": {
                            "0": "TomBrady",
                            "1": "2015-12-11",
                            "2": 7.86633892304654,
                        },
                        "53": {
                            "0": "TomBrady",
                            "1": "2015-12-12",
                            "2": 7.31055015853442,
                        },
                        "54": {
                            "0": "TomBrady",
                            "1": "2015-12-13",
                            "2": 7.71824095195932,
                        },
                        "55": {
                            "0": "TomBrady",
                            "1": "2015-12-14",
                            "2": 8.31947369244219,
                        },
                        "56": {
                            "0": "TomBrady",
                            "1": "2015-12-15",
                            "2": 8.23668532271246,
                        },
                        "57": {
                            "0": "TomBrady",
                            "1": "2015-12-16",
                            "2": 7.80751004221619,
                        },
                        "58": {
                            "0": "TomBrady",
                            "1": "2015-12-17",
                            "2": 7.59186171488993,
                        },
                        "59": {
                            "0": "TomBrady",
                            "1": "2015-12-18",
                            "2": 7.52886925664225,
                        },
                        "60": {
                            "0": "TomBrady",
                            "1": "2015-12-19",
                            "2": 7.17165682276851,
                        },
                        "61": {
                            "0": "TomBrady",
                            "1": "2015-12-20",
                            "2": 7.89133075766189,
                        },
                        "62": {
                            "0": "TomBrady",
                            "1": "2015-12-21",
                            "2": 8.36007143564403,
                        },
                        "63": {
                            "0": "TomBrady",
                            "1": "2015-12-22",
                            "2": 8.11042723757502,
                        },
                        "64": {
                            "0": "TomBrady",
                            "1": "2015-12-23",
                            "2": 7.77527584648686,
                        },
                        "65": {
                            "0": "TomBrady",
                            "1": "2015-12-24",
                            "2": 7.34729970074316,
                        },
                        "66": {
                            "0": "TomBrady",
                            "1": "2015-12-25",
                            "2": 7.30182234213793,
                        },
                        "67": {
                            "0": "TomBrady",
                            "1": "2015-12-26",
                            "2": 7.12044437239249,
                        },
                        "68": {
                            "0": "TomBrady",
                            "1": "2015-12-27",
                            "2": 8.87877607170755,
                        },
                        "69": {
                            "0": "TomBrady",
                            "1": "2015-12-28",
                            "2": 9.25061821847475,
                        },
                        "70": {
                            "0": "TomBrady",
                            "1": "2015-12-29",
                            "2": 9.24792513230345,
                        },
                        "71": {
                            "0": "TomBrady",
                            "1": "2015-12-30",
                            "2": 8.39140318535794,
                        },
                        "72": {
                            "0": "TomBrady",
                            "1": "2015-12-31",
                            "2": 8.00469951054955,
                        },
                        "73": {
                            "0": "TomBrady",
                            "1": "2016-01-01",
                            "2": 7.58933582317062,
                        },
                        "74": {
                            "0": "TomBrady",
                            "1": "2016-01-02",
                            "2": 7.82524529143177,
                        },
                        "75": {
                            "0": "TomBrady",
                            "1": "2016-01-03",
                            "2": 8.24931374626064,
                        },
                        "76": {
                            "0": "TomBrady",
                            "1": "2016-01-04",
                            "2": 9.29514097366865,
                        },
                        "77": {
                            "0": "TomBrady",
                            "1": "2016-01-05",
                            "2": 8.56826646160024,
                        },
                        "78": {
                            "0": "TomBrady",
                            "1": "2016-01-06",
                            "2": 8.35255436947459,
                        },
                        "79": {
                            "0": "TomBrady",
                            "1": "2016-01-07",
                            "2": 8.29579811063615,
                        },
                        "80": {
                            "0": "TomBrady",
                            "1": "2016-01-08",
                            "2": 8.29029259122431,
                        },
                        "81": {
                            "0": "TomBrady",
                            "1": "2016-01-09",
                            "2": 7.78572089653462,
                        },
                        "82": {
                            "0": "TomBrady",
                            "1": "2016-01-10",
                            "2": 8.28172399041139,
                        },
                        "83": {
                            "0": "TomBrady",
                            "1": "2016-01-11",
                            "2": 8.4707303170059,
                        },
                        "84": {
                            "0": "TomBrady",
                            "1": "2016-01-12",
                            "2": 8.13505390861157,
                        },
                        "85": {
                            "0": "TomBrady",
                            "1": "2016-01-13",
                            "2": 8.06714903991011,
                        },
                    },
                },
            ),
        )
        """
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "historic_forecast_multi_series"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def anomaly_detection_multi_series(
        self, *, request: MultiSeriesAnomaly, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Based on the provided data, this endpoint detects the anomalies in the historical perdiod of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains a flag indicating if the date has a anomaly and also provides the prediction interval used to define if an observation is an anomaly.Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - request: MultiSeriesAnomaly.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import MultiSeriesAnomaly
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.anomaly_detection_multi_series(
            request=MultiSeriesAnomaly(),
        )
        """
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "anomaly_detection_multi_series"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def cross_validation_multi_series(
        self, *, request: MultiSeriesCrossValidation, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Perform Cross Validation for multiple series

        Parameters:
            - request: MultiSeriesCrossValidation.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import MultiSeriesCrossValidation, MultiSeriesInput
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.cross_validation_multi_series(
            request=MultiSeriesCrossValidation(
                model="timegpt-1",
                freq="D",
                level=[99],
                y={
                    "columns": {"0": "unique_id", "1": "ds", "2": "y"},
                    "data": {
                        "0": {
                            "0": "PeytonManning",
                            "1": "2015-12-02",
                            "2": 8.71177264560569,
                        },
                        "1": {
                            "0": "PeytonManning",
                            "1": "2015-12-03",
                            "2": 8.05610965954506,
                        },
                        "2": {
                            "0": "PeytonManning",
                            "1": "2015-12-04",
                            "2": 8.08147504013705,
                        },
                        "3": {
                            "0": "PeytonManning",
                            "1": "2015-12-05",
                            "2": 7.45876269238096,
                        },
                        "4": {
                            "0": "PeytonManning",
                            "1": "2015-12-06",
                            "2": 8.01400499477946,
                        },
                        "5": {
                            "0": "PeytonManning",
                            "1": "2015-12-07",
                            "2": 8.49678638163858,
                        },
                        "6": {
                            "0": "PeytonManning",
                            "1": "2015-12-08",
                            "2": 7.98104975966596,
                        },
                        "7": {
                            "0": "PeytonManning",
                            "1": "2015-12-09",
                            "2": 7.77779262633883,
                        },
                        "8": {
                            "0": "PeytonManning",
                            "1": "2015-12-10",
                            "2": 8.2602342916073,
                        },
                        "9": {
                            "0": "PeytonManning",
                            "1": "2015-12-11",
                            "2": 7.86633892304654,
                        },
                        "10": {
                            "0": "PeytonManning",
                            "1": "2015-12-12",
                            "2": 7.31055015853442,
                        },
                        "11": {
                            "0": "PeytonManning",
                            "1": "2015-12-13",
                            "2": 7.71824095195932,
                        },
                        "12": {
                            "0": "PeytonManning",
                            "1": "2015-12-14",
                            "2": 8.31947369244219,
                        },
                        "13": {
                            "0": "PeytonManning",
                            "1": "2015-12-15",
                            "2": 8.23668532271246,
                        },
                        "14": {
                            "0": "PeytonManning",
                            "1": "2015-12-16",
                            "2": 7.80751004221619,
                        },
                        "15": {
                            "0": "PeytonManning",
                            "1": "2015-12-17",
                            "2": 7.59186171488993,
                        },
                        "16": {
                            "0": "PeytonManning",
                            "1": "2015-12-18",
                            "2": 7.52886925664225,
                        },
                        "17": {
                            "0": "PeytonManning",
                            "1": "2015-12-19",
                            "2": 7.17165682276851,
                        },
                        "18": {
                            "0": "PeytonManning",
                            "1": "2015-12-20",
                            "2": 7.89133075766189,
                        },
                        "19": {
                            "0": "PeytonManning",
                            "1": "2015-12-21",
                            "2": 8.36007143564403,
                        },
                        "20": {
                            "0": "PeytonManning",
                            "1": "2015-12-22",
                            "2": 8.11042723757502,
                        },
                        "21": {
                            "0": "PeytonManning",
                            "1": "2015-12-23",
                            "2": 7.77527584648686,
                        },
                        "22": {
                            "0": "PeytonManning",
                            "1": "2015-12-24",
                            "2": 7.34729970074316,
                        },
                        "23": {
                            "0": "PeytonManning",
                            "1": "2015-12-25",
                            "2": 7.30182234213793,
                        },
                        "24": {
                            "0": "PeytonManning",
                            "1": "2015-12-26",
                            "2": 7.12044437239249,
                        },
                        "25": {
                            "0": "PeytonManning",
                            "1": "2015-12-27",
                            "2": 8.87877607170755,
                        },
                        "26": {
                            "0": "PeytonManning",
                            "1": "2015-12-28",
                            "2": 9.25061821847475,
                        },
                        "27": {
                            "0": "PeytonManning",
                            "1": "2015-12-29",
                            "2": 9.24792513230345,
                        },
                        "28": {
                            "0": "PeytonManning",
                            "1": "2015-12-30",
                            "2": 8.39140318535794,
                        },
                        "29": {
                            "0": "PeytonManning",
                            "1": "2015-12-31",
                            "2": 8.00469951054955,
                        },
                        "30": {
                            "0": "PeytonManning",
                            "1": "2016-01-01",
                            "2": 7.58933582317062,
                        },
                        "31": {
                            "0": "PeytonManning",
                            "1": "2016-01-02",
                            "2": 7.82524529143177,
                        },
                        "32": {
                            "0": "PeytonManning",
                            "1": "2016-01-03",
                            "2": 8.24931374626064,
                        },
                        "33": {
                            "0": "PeytonManning",
                            "1": "2016-01-04",
                            "2": 9.29514097366865,
                        },
                        "34": {
                            "0": "PeytonManning",
                            "1": "2016-01-05",
                            "2": 8.56826646160024,
                        },
                        "35": {
                            "0": "PeytonManning",
                            "1": "2016-01-06",
                            "2": 8.35255436947459,
                        },
                        "36": {
                            "0": "PeytonManning",
                            "1": "2016-01-07",
                            "2": 8.29579811063615,
                        },
                        "37": {
                            "0": "PeytonManning",
                            "1": "2016-01-08",
                            "2": 8.29029259122431,
                        },
                        "38": {
                            "0": "PeytonManning",
                            "1": "2016-01-09",
                            "2": 7.78572089653462,
                        },
                        "39": {
                            "0": "PeytonManning",
                            "1": "2016-01-10",
                            "2": 8.28172399041139,
                        },
                        "40": {
                            "0": "PeytonManning",
                            "1": "2016-01-11",
                            "2": 8.4707303170059,
                        },
                        "41": {
                            "0": "PeytonManning",
                            "1": "2016-01-12",
                            "2": 8.13505390861157,
                        },
                        "42": {
                            "0": "PeytonManning",
                            "1": "2016-01-13",
                            "2": 8.06714903991011,
                        },
                        "43": {
                            "0": "TomBrady",
                            "1": "2015-12-02",
                            "2": 8.71177264560569,
                        },
                        "44": {
                            "0": "TomBrady",
                            "1": "2015-12-03",
                            "2": 8.05610965954506,
                        },
                        "45": {
                            "0": "TomBrady",
                            "1": "2015-12-04",
                            "2": 8.08147504013705,
                        },
                        "46": {
                            "0": "TomBrady",
                            "1": "2015-12-05",
                            "2": 7.45876269238096,
                        },
                        "47": {
                            "0": "TomBrady",
                            "1": "2015-12-06",
                            "2": 8.01400499477946,
                        },
                        "48": {
                            "0": "TomBrady",
                            "1": "2015-12-07",
                            "2": 8.49678638163858,
                        },
                        "49": {
                            "0": "TomBrady",
                            "1": "2015-12-08",
                            "2": 7.98104975966596,
                        },
                        "50": {
                            "0": "TomBrady",
                            "1": "2015-12-09",
                            "2": 7.77779262633883,
                        },
                        "51": {
                            "0": "TomBrady",
                            "1": "2015-12-10",
                            "2": 8.2602342916073,
                        },
                        "52": {
                            "0": "TomBrady",
                            "1": "2015-12-11",
                            "2": 7.86633892304654,
                        },
                        "53": {
                            "0": "TomBrady",
                            "1": "2015-12-12",
                            "2": 7.31055015853442,
                        },
                        "54": {
                            "0": "TomBrady",
                            "1": "2015-12-13",
                            "2": 7.71824095195932,
                        },
                        "55": {
                            "0": "TomBrady",
                            "1": "2015-12-14",
                            "2": 8.31947369244219,
                        },
                        "56": {
                            "0": "TomBrady",
                            "1": "2015-12-15",
                            "2": 8.23668532271246,
                        },
                        "57": {
                            "0": "TomBrady",
                            "1": "2015-12-16",
                            "2": 7.80751004221619,
                        },
                        "58": {
                            "0": "TomBrady",
                            "1": "2015-12-17",
                            "2": 7.59186171488993,
                        },
                        "59": {
                            "0": "TomBrady",
                            "1": "2015-12-18",
                            "2": 7.52886925664225,
                        },
                        "60": {
                            "0": "TomBrady",
                            "1": "2015-12-19",
                            "2": 7.17165682276851,
                        },
                        "61": {
                            "0": "TomBrady",
                            "1": "2015-12-20",
                            "2": 7.89133075766189,
                        },
                        "62": {
                            "0": "TomBrady",
                            "1": "2015-12-21",
                            "2": 8.36007143564403,
                        },
                        "63": {
                            "0": "TomBrady",
                            "1": "2015-12-22",
                            "2": 8.11042723757502,
                        },
                        "64": {
                            "0": "TomBrady",
                            "1": "2015-12-23",
                            "2": 7.77527584648686,
                        },
                        "65": {
                            "0": "TomBrady",
                            "1": "2015-12-24",
                            "2": 7.34729970074316,
                        },
                        "66": {
                            "0": "TomBrady",
                            "1": "2015-12-25",
                            "2": 7.30182234213793,
                        },
                        "67": {
                            "0": "TomBrady",
                            "1": "2015-12-26",
                            "2": 7.12044437239249,
                        },
                        "68": {
                            "0": "TomBrady",
                            "1": "2015-12-27",
                            "2": 8.87877607170755,
                        },
                        "69": {
                            "0": "TomBrady",
                            "1": "2015-12-28",
                            "2": 9.25061821847475,
                        },
                        "70": {
                            "0": "TomBrady",
                            "1": "2015-12-29",
                            "2": 9.24792513230345,
                        },
                        "71": {
                            "0": "TomBrady",
                            "1": "2015-12-30",
                            "2": 8.39140318535794,
                        },
                        "72": {
                            "0": "TomBrady",
                            "1": "2015-12-31",
                            "2": 8.00469951054955,
                        },
                        "73": {
                            "0": "TomBrady",
                            "1": "2016-01-01",
                            "2": 7.58933582317062,
                        },
                        "74": {
                            "0": "TomBrady",
                            "1": "2016-01-02",
                            "2": 7.82524529143177,
                        },
                        "75": {
                            "0": "TomBrady",
                            "1": "2016-01-03",
                            "2": 8.24931374626064,
                        },
                        "76": {
                            "0": "TomBrady",
                            "1": "2016-01-04",
                            "2": 9.29514097366865,
                        },
                        "77": {
                            "0": "TomBrady",
                            "1": "2016-01-05",
                            "2": 8.56826646160024,
                        },
                        "78": {
                            "0": "TomBrady",
                            "1": "2016-01-06",
                            "2": 8.35255436947459,
                        },
                        "79": {
                            "0": "TomBrady",
                            "1": "2016-01-07",
                            "2": 8.29579811063615,
                        },
                        "80": {
                            "0": "TomBrady",
                            "1": "2016-01-08",
                            "2": 8.29029259122431,
                        },
                        "81": {
                            "0": "TomBrady",
                            "1": "2016-01-09",
                            "2": 7.78572089653462,
                        },
                        "82": {
                            "0": "TomBrady",
                            "1": "2016-01-10",
                            "2": 8.28172399041139,
                        },
                        "83": {
                            "0": "TomBrady",
                            "1": "2016-01-11",
                            "2": 8.4707303170059,
                        },
                        "84": {
                            "0": "TomBrady",
                            "1": "2016-01-12",
                            "2": 8.13505390861157,
                        },
                        "85": {
                            "0": "TomBrady",
                            "1": "2016-01-13",
                            "2": 8.06714903991011,
                        },
                    },
                },
                x=MultiSeriesInput(
                    columns=[
                        "unique_id",
                        "ds",
                        "normalized_fb_marketing_spend",
                        "normalized_google_marketing_spend",
                    ],
                    data=[
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-02",
                            "2": 0.5488135039273248,
                            "3": 0.5701967704178796,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-03",
                            "2": 0.7151893663724195,
                            "3": 0.43860151346232035,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-04",
                            "2": 0.6027633760716439,
                            "3": 0.9883738380592262,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-05",
                            "2": 0.5448831829968969,
                            "3": 0.10204481074802807,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-06",
                            "2": 0.4236547993389047,
                            "3": 0.2088767560948347,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-07",
                            "2": 0.6458941130666561,
                            "3": 0.16130951788499626,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-08",
                            "2": 0.4375872112626925,
                            "3": 0.6531083254653984,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-09",
                            "2": 0.8917730007820798,
                            "3": 0.2532916025397821,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-10",
                            "2": 0.9636627605010293,
                            "3": 0.4663107728563063,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-11",
                            "2": 0.3834415188257777,
                            "3": 0.24442559200160274,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-12",
                            "2": 0.7917250380826646,
                            "3": 0.15896958364551972,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-13",
                            "2": 0.5288949197529045,
                            "3": 0.11037514116430513,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-14",
                            "2": 0.5680445610939323,
                            "3": 0.6563295894652734,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-15",
                            "2": 0.925596638292661,
                            "3": 0.1381829513486138,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-16",
                            "2": 0.07103605819788694,
                            "3": 0.1965823616800535,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-17",
                            "2": 0.08712929970154071,
                            "3": 0.3687251706609641,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-18",
                            "2": 0.02021839744032572,
                            "3": 0.8209932298479351,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-19",
                            "2": 0.832619845547938,
                            "3": 0.09710127579306127,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-20",
                            "2": 0.7781567509498505,
                            "3": 0.8379449074988039,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-21",
                            "2": 0.8700121482468192,
                            "3": 0.09609840789396307,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-22",
                            "2": 0.978618342232764,
                            "3": 0.9764594650133958,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-23",
                            "2": 0.7991585642167236,
                            "3": 0.4686512016477016,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-24",
                            "2": 0.46147936225293185,
                            "3": 0.9767610881903371,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-25",
                            "2": 0.7805291762864555,
                            "3": 0.604845519745046,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-26",
                            "2": 0.11827442586893322,
                            "3": 0.7392635793983017,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-27",
                            "2": 0.6399210213275238,
                            "3": 0.039187792254320675,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-28",
                            "2": 0.1433532874090464,
                            "3": 0.2828069625764096,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-29",
                            "2": 0.9446689170495839,
                            "3": 0.1201965612131689,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-30",
                            "2": 0.5218483217500717,
                            "3": 0.29614019752214493,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2015-12-31",
                            "2": 0.4146619399905236,
                            "3": 0.11872771895424405,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-01",
                            "2": 0.26455561210462697,
                            "3": 0.317983179393976,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-02",
                            "2": 0.7742336894342167,
                            "3": 0.41426299451466997,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-03",
                            "2": 0.45615033221654855,
                            "3": 0.06414749634878436,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-04",
                            "2": 0.5684339488686485,
                            "3": 0.6924721193700198,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-05",
                            "2": 0.018789800436355142,
                            "3": 0.5666014542065752,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-06",
                            "2": 0.6176354970758771,
                            "3": 0.2653894909394454,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-07",
                            "2": 0.6120957227224214,
                            "3": 0.5232480534666997,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-08",
                            "2": 0.6169339968747569,
                            "3": 0.09394051075844168,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-09",
                            "2": 0.9437480785146242,
                            "3": 0.5759464955561793,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-10",
                            "2": 0.6818202991034834,
                            "3": 0.9292961975762141,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-11",
                            "2": 0.359507900573786,
                            "3": 0.31856895245132366,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-12",
                            "2": 0.43703195379934145,
                            "3": 0.6674103799636817,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-13",
                            "2": 0.6976311959272649,
                            "3": 0.13179786240439217,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-14",
                            "2": 0.06022547162926983,
                            "3": 0.7163272041185655,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-15",
                            "2": 0.6667667154456677,
                            "3": 0.2894060929472011,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-16",
                            "2": 0.6706378696181594,
                            "3": 0.18319136200711683,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-17",
                            "2": 0.2103825610738409,
                            "3": 0.5865129348100832,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-18",
                            "2": 0.1289262976548533,
                            "3": 0.020107546187493552,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-19",
                            "2": 0.31542835092418386,
                            "3": 0.8289400292173631,
                        },
                        {
                            "0": "PeytonManning",
                            "1": "2016-01-20",
                            "2": 0.3637107709426226,
                            "3": 0.004695476192547066,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-02",
                            "2": 0.5488135039273248,
                            "3": 0.5701967704178796,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-03",
                            "2": 0.7151893663724195,
                            "3": 0.43860151346232035,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-04",
                            "2": 0.6027633760716439,
                            "3": 0.9883738380592262,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-05",
                            "2": 0.5448831829968969,
                            "3": 0.10204481074802807,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-06",
                            "2": 0.4236547993389047,
                            "3": 0.2088767560948347,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-07",
                            "2": 0.6458941130666561,
                            "3": 0.16130951788499626,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-08",
                            "2": 0.4375872112626925,
                            "3": 0.6531083254653984,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-09",
                            "2": 0.8917730007820798,
                            "3": 0.2532916025397821,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-10",
                            "2": 0.9636627605010293,
                            "3": 0.4663107728563063,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-11",
                            "2": 0.3834415188257777,
                            "3": 0.24442559200160274,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-12",
                            "2": 0.7917250380826646,
                            "3": 0.15896958364551972,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-13",
                            "2": 0.5288949197529045,
                            "3": 0.11037514116430513,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-14",
                            "2": 0.5680445610939323,
                            "3": 0.6563295894652734,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-15",
                            "2": 0.925596638292661,
                            "3": 0.1381829513486138,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-16",
                            "2": 0.07103605819788694,
                            "3": 0.1965823616800535,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-17",
                            "2": 0.08712929970154071,
                            "3": 0.3687251706609641,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-18",
                            "2": 0.02021839744032572,
                            "3": 0.8209932298479351,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-19",
                            "2": 0.832619845547938,
                            "3": 0.09710127579306127,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-20",
                            "2": 0.7781567509498505,
                            "3": 0.8379449074988039,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-21",
                            "2": 0.8700121482468192,
                            "3": 0.09609840789396307,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-22",
                            "2": 0.978618342232764,
                            "3": 0.9764594650133958,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-23",
                            "2": 0.7991585642167236,
                            "3": 0.4686512016477016,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-24",
                            "2": 0.46147936225293185,
                            "3": 0.9767610881903371,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-25",
                            "2": 0.7805291762864555,
                            "3": 0.604845519745046,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-26",
                            "2": 0.11827442586893322,
                            "3": 0.7392635793983017,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-27",
                            "2": 0.6399210213275238,
                            "3": 0.039187792254320675,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-28",
                            "2": 0.1433532874090464,
                            "3": 0.2828069625764096,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-29",
                            "2": 0.9446689170495839,
                            "3": 0.1201965612131689,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-30",
                            "2": 0.5218483217500717,
                            "3": 0.29614019752214493,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2015-12-31",
                            "2": 0.4146619399905236,
                            "3": 0.11872771895424405,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-01",
                            "2": 0.26455561210462697,
                            "3": 0.317983179393976,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-02",
                            "2": 0.7742336894342167,
                            "3": 0.41426299451466997,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-03",
                            "2": 0.45615033221654855,
                            "3": 0.06414749634878436,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-04",
                            "2": 0.5684339488686485,
                            "3": 0.6924721193700198,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-05",
                            "2": 0.018789800436355142,
                            "3": 0.5666014542065752,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-06",
                            "2": 0.6176354970758771,
                            "3": 0.2653894909394454,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-07",
                            "2": 0.6120957227224214,
                            "3": 0.5232480534666997,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-08",
                            "2": 0.6169339968747569,
                            "3": 0.09394051075844168,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-09",
                            "2": 0.9437480785146242,
                            "3": 0.5759464955561793,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-10",
                            "2": 0.6818202991034834,
                            "3": 0.9292961975762141,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-11",
                            "2": 0.359507900573786,
                            "3": 0.31856895245132366,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-12",
                            "2": 0.43703195379934145,
                            "3": 0.6674103799636817,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-13",
                            "2": 0.6976311959272649,
                            "3": 0.13179786240439217,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-14",
                            "2": 0.06022547162926983,
                            "3": 0.7163272041185655,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-15",
                            "2": 0.6667667154456677,
                            "3": 0.2894060929472011,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-16",
                            "2": 0.6706378696181594,
                            "3": 0.18319136200711683,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-17",
                            "2": 0.2103825610738409,
                            "3": 0.5865129348100832,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-18",
                            "2": 0.1289262976548533,
                            "3": 0.020107546187493552,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-19",
                            "2": 0.31542835092418386,
                            "3": 0.8289400292173631,
                        },
                        {
                            "0": "TomBrady",
                            "1": "2016-01-20",
                            "2": 0.3637107709426226,
                            "3": 0.004695476192547066,
                        },
                    ],
                ),
            ),
        )
        """
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "cross_validation_multi_series"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def model_input_size(
        self, *, request: SingleSeriesForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Parameters:
            - request: SingleSeriesForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import SingleSeriesForecast
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.model_input_size(
            request=SingleSeriesForecast(),
        )
        """
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "model_input_size"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def model_params(
        self, *, request: SingleSeriesForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Parameters:
            - request: SingleSeriesForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import SingleSeriesForecast
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.model_params(
            request=SingleSeriesForecast(),
        )
        """
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "model_params"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def timegpt(
        self, *, request: SingleSeriesForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        This endpoint predicts the future values of a single time series based on the provided data. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values based on the input arguments. Get your token for private beta at https://dashboard.nixtla.io

        Parameters:
            - request: SingleSeriesForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import SingleSeriesForecast
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.timegpt(
            request=SingleSeriesForecast(
                model="timegpt-1",
                freq="D",
                level=[90],
                fh=7,
                y={
                    "2015-12-02": 8.71177264560569,
                    "2015-12-03": 8.05610965954506,
                    "2015-12-04": 8.08147504013705,
                    "2015-12-05": 7.45876269238096,
                    "2015-12-06": 8.01400499477946,
                    "2015-12-07": 8.49678638163858,
                    "2015-12-08": 7.98104975966596,
                    "2015-12-09": 7.77779262633883,
                    "2015-12-10": 8.2602342916073,
                    "2015-12-11": 7.86633892304654,
                    "2015-12-12": 7.31055015853442,
                    "2015-12-13": 7.71824095195932,
                    "2015-12-14": 8.31947369244219,
                    "2015-12-15": 8.23668532271246,
                    "2015-12-16": 7.80751004221619,
                    "2015-12-17": 7.59186171488993,
                    "2015-12-18": 7.52886925664225,
                    "2015-12-19": 7.17165682276851,
                    "2015-12-20": 7.89133075766189,
                    "2015-12-21": 8.36007143564403,
                    "2015-12-22": 8.11042723757502,
                    "2015-12-23": 7.77527584648686,
                    "2015-12-24": 7.34729970074316,
                    "2015-12-25": 7.30182234213793,
                    "2015-12-26": 7.12044437239249,
                    "2015-12-27": 8.87877607170755,
                    "2015-12-28": 9.25061821847475,
                    "2015-12-29": 9.24792513230345,
                    "2015-12-30": 8.39140318535794,
                    "2015-12-31": 8.00469951054955,
                    "2016-01-01": 7.58933582317062,
                    "2016-01-02": 7.82524529143177,
                    "2016-01-03": 8.24931374626064,
                    "2016-01-04": 9.29514097366865,
                    "2016-01-05": 8.56826646160024,
                    "2016-01-06": 8.35255436947459,
                    "2016-01-07": 8.29579811063615,
                    "2016-01-08": 8.29029259122431,
                    "2016-01-09": 7.78572089653462,
                    "2016-01-10": 8.28172399041139,
                    "2016-01-11": 8.4707303170059,
                    "2016-01-12": 8.13505390861157,
                    "2016-01-13": 8.06714903991011,
                },
                x={
                    "2015-12-02": [0.5488135039273248, 0.5701967704178796],
                    "2015-12-03": [0.7151893663724195, 0.43860151346232035],
                    "2015-12-04": [0.6027633760716439, 0.9883738380592262],
                    "2015-12-05": [0.5448831829968969, 0.10204481074802807],
                    "2015-12-06": [0.4236547993389047, 0.2088767560948347],
                    "2015-12-07": [0.6458941130666561, 0.16130951788499626],
                    "2015-12-08": [0.4375872112626925, 0.6531083254653984],
                    "2015-12-09": [0.8917730007820798, 0.2532916025397821],
                    "2015-12-10": [0.9636627605010293, 0.4663107728563063],
                    "2015-12-11": [0.3834415188257777, 0.24442559200160274],
                    "2015-12-12": [0.7917250380826646, 0.15896958364551972],
                    "2015-12-13": [0.5288949197529045, 0.11037514116430513],
                    "2015-12-14": [0.5680445610939323, 0.6563295894652734],
                    "2015-12-15": [0.925596638292661, 0.1381829513486138],
                    "2015-12-16": [0.07103605819788694, 0.1965823616800535],
                    "2015-12-17": [0.08712929970154071, 0.3687251706609641],
                    "2015-12-18": [0.02021839744032572, 0.8209932298479351],
                    "2015-12-19": [0.832619845547938, 0.09710127579306127],
                    "2015-12-20": [0.7781567509498505, 0.8379449074988039],
                    "2015-12-21": [0.8700121482468192, 0.09609840789396307],
                    "2015-12-22": [0.978618342232764, 0.9764594650133958],
                    "2015-12-23": [0.7991585642167236, 0.4686512016477016],
                    "2015-12-24": [0.46147936225293185, 0.9767610881903371],
                    "2015-12-25": [0.7805291762864555, 0.604845519745046],
                    "2015-12-26": [0.11827442586893322, 0.7392635793983017],
                    "2015-12-27": [0.6399210213275238, 0.039187792254320675],
                    "2015-12-28": [0.1433532874090464, 0.2828069625764096],
                    "2015-12-29": [0.9446689170495839, 0.1201965612131689],
                    "2015-12-30": [0.5218483217500717, 0.29614019752214493],
                    "2015-12-31": [0.4146619399905236, 0.11872771895424405],
                    "2016-01-01": [0.26455561210462697, 0.317983179393976],
                    "2016-01-02": [0.7742336894342167, 0.41426299451466997],
                    "2016-01-03": [0.45615033221654855, 0.06414749634878436],
                    "2016-01-04": [0.5684339488686485, 0.6924721193700198],
                    "2016-01-05": [0.018789800436355142, 0.5666014542065752],
                    "2016-01-06": [0.6176354970758771, 0.2653894909394454],
                    "2016-01-07": [0.6120957227224214, 0.5232480534666997],
                    "2016-01-08": [0.6169339968747569, 0.09394051075844168],
                    "2016-01-09": [0.9437480785146242, 0.5759464955561793],
                    "2016-01-10": [0.6818202991034834, 0.9292961975762141],
                    "2016-01-11": [0.359507900573786, 0.31856895245132366],
                    "2016-01-12": [0.43703195379934145, 0.6674103799636817],
                    "2016-01-13": [0.6976311959272649, 0.13179786240439217],
                    "2016-01-14": [0.06022547162926983, 0.7163272041185655],
                    "2016-01-15": [0.6667667154456677, 0.2894060929472011],
                    "2016-01-16": [0.6706378696181594, 0.18319136200711683],
                    "2016-01-17": [0.2103825610738409, 0.5865129348100832],
                    "2016-01-18": [0.1289262976548533, 0.020107546187493552],
                    "2016-01-19": [0.31542835092418386, 0.8289400292173631],
                    "2016-01-20": [0.3637107709426226, 0.004695476192547066],
                },
                clean_ex_first=True,
                finetune_steps=0,
            ),
        )
        """
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "timegpt"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def timegpt_historic(
        self, *, request: SingleSeriesInsampleForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Based on the provided data, this endpoint predicts time series data for the in-sample period (historical period). It takes a JSON as an input, including information like the series frequency and the historical data. (See below for a full description of the parameters.) The response contains the predicted values for the historical period. Usually useful for anomaly detection. Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - request: SingleSeriesInsampleForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import SingleSeriesInsampleForecast
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.timegpt_historic(
            request=SingleSeriesInsampleForecast(
                model="timegpt-1",
                freq="D",
                level=[90],
                y={
                    "2015-12-02": 8.71177264560569,
                    "2015-12-03": 8.05610965954506,
                    "2015-12-04": 8.08147504013705,
                    "2015-12-05": 7.45876269238096,
                    "2015-12-06": 8.01400499477946,
                    "2015-12-07": 8.49678638163858,
                    "2015-12-08": 7.98104975966596,
                    "2015-12-09": 7.77779262633883,
                    "2015-12-10": 8.2602342916073,
                    "2015-12-11": 7.86633892304654,
                    "2015-12-12": 7.31055015853442,
                    "2015-12-13": 7.71824095195932,
                    "2015-12-14": 8.31947369244219,
                    "2015-12-15": 8.23668532271246,
                    "2015-12-16": 7.80751004221619,
                    "2015-12-17": 7.59186171488993,
                    "2015-12-18": 7.52886925664225,
                    "2015-12-19": 7.17165682276851,
                    "2015-12-20": 7.89133075766189,
                    "2015-12-21": 8.36007143564403,
                    "2015-12-22": 8.11042723757502,
                    "2015-12-23": 7.77527584648686,
                    "2015-12-24": 7.34729970074316,
                    "2015-12-25": 7.30182234213793,
                    "2015-12-26": 7.12044437239249,
                    "2015-12-27": 8.87877607170755,
                    "2015-12-28": 9.25061821847475,
                    "2015-12-29": 9.24792513230345,
                    "2015-12-30": 8.39140318535794,
                    "2015-12-31": 8.00469951054955,
                    "2016-01-01": 7.58933582317062,
                    "2016-01-02": 7.82524529143177,
                    "2016-01-03": 8.24931374626064,
                    "2016-01-04": 9.29514097366865,
                    "2016-01-05": 8.56826646160024,
                    "2016-01-06": 8.35255436947459,
                    "2016-01-07": 8.29579811063615,
                    "2016-01-08": 8.29029259122431,
                    "2016-01-09": 7.78572089653462,
                    "2016-01-10": 8.28172399041139,
                    "2016-01-11": 8.4707303170059,
                    "2016-01-12": 8.13505390861157,
                    "2016-01-13": 8.06714903991011,
                },
                clean_ex_first=True,
            ),
        )
        """
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "timegpt_historic"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def timegpt_multi_series(
        self, *, request: MultiSeriesForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Based on the provided data, this endpoint predicts the future values of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values for each series based on the input arguments. Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - request: MultiSeriesForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import MultiSeriesForecast
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.timegpt_multi_series(
            request=MultiSeriesForecast(),
        )
        """
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "timegpt_multi_series"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def timegpt_multi_series_historic(
        self, *, request: MultiSeriesInsampleForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Based on the provided data, this endpoint predicts the in-sample period (historical period) values of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values for the historical period. Usually useful for anomaly detection. Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - request: MultiSeriesInsampleForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import MultiSeriesInsampleForecast
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.timegpt_multi_series_historic(
            request=MultiSeriesInsampleForecast(
                model="timegpt-1",
                freq="D",
                level=[90],
                y={
                    "columns": {"0": "unique_id", "1": "ds", "2": "y"},
                    "data": {
                        "0": {
                            "0": "PeytonManning",
                            "1": "2015-12-02",
                            "2": 8.71177264560569,
                        },
                        "1": {
                            "0": "PeytonManning",
                            "1": "2015-12-03",
                            "2": 8.05610965954506,
                        },
                        "2": {
                            "0": "PeytonManning",
                            "1": "2015-12-04",
                            "2": 8.08147504013705,
                        },
                        "3": {
                            "0": "PeytonManning",
                            "1": "2015-12-05",
                            "2": 7.45876269238096,
                        },
                        "4": {
                            "0": "PeytonManning",
                            "1": "2015-12-06",
                            "2": 8.01400499477946,
                        },
                        "5": {
                            "0": "PeytonManning",
                            "1": "2015-12-07",
                            "2": 8.49678638163858,
                        },
                        "6": {
                            "0": "PeytonManning",
                            "1": "2015-12-08",
                            "2": 7.98104975966596,
                        },
                        "7": {
                            "0": "PeytonManning",
                            "1": "2015-12-09",
                            "2": 7.77779262633883,
                        },
                        "8": {
                            "0": "PeytonManning",
                            "1": "2015-12-10",
                            "2": 8.2602342916073,
                        },
                        "9": {
                            "0": "PeytonManning",
                            "1": "2015-12-11",
                            "2": 7.86633892304654,
                        },
                        "10": {
                            "0": "PeytonManning",
                            "1": "2015-12-12",
                            "2": 7.31055015853442,
                        },
                        "11": {
                            "0": "PeytonManning",
                            "1": "2015-12-13",
                            "2": 7.71824095195932,
                        },
                        "12": {
                            "0": "PeytonManning",
                            "1": "2015-12-14",
                            "2": 8.31947369244219,
                        },
                        "13": {
                            "0": "PeytonManning",
                            "1": "2015-12-15",
                            "2": 8.23668532271246,
                        },
                        "14": {
                            "0": "PeytonManning",
                            "1": "2015-12-16",
                            "2": 7.80751004221619,
                        },
                        "15": {
                            "0": "PeytonManning",
                            "1": "2015-12-17",
                            "2": 7.59186171488993,
                        },
                        "16": {
                            "0": "PeytonManning",
                            "1": "2015-12-18",
                            "2": 7.52886925664225,
                        },
                        "17": {
                            "0": "PeytonManning",
                            "1": "2015-12-19",
                            "2": 7.17165682276851,
                        },
                        "18": {
                            "0": "PeytonManning",
                            "1": "2015-12-20",
                            "2": 7.89133075766189,
                        },
                        "19": {
                            "0": "PeytonManning",
                            "1": "2015-12-21",
                            "2": 8.36007143564403,
                        },
                        "20": {
                            "0": "PeytonManning",
                            "1": "2015-12-22",
                            "2": 8.11042723757502,
                        },
                        "21": {
                            "0": "PeytonManning",
                            "1": "2015-12-23",
                            "2": 7.77527584648686,
                        },
                        "22": {
                            "0": "PeytonManning",
                            "1": "2015-12-24",
                            "2": 7.34729970074316,
                        },
                        "23": {
                            "0": "PeytonManning",
                            "1": "2015-12-25",
                            "2": 7.30182234213793,
                        },
                        "24": {
                            "0": "PeytonManning",
                            "1": "2015-12-26",
                            "2": 7.12044437239249,
                        },
                        "25": {
                            "0": "PeytonManning",
                            "1": "2015-12-27",
                            "2": 8.87877607170755,
                        },
                        "26": {
                            "0": "PeytonManning",
                            "1": "2015-12-28",
                            "2": 9.25061821847475,
                        },
                        "27": {
                            "0": "PeytonManning",
                            "1": "2015-12-29",
                            "2": 9.24792513230345,
                        },
                        "28": {
                            "0": "PeytonManning",
                            "1": "2015-12-30",
                            "2": 8.39140318535794,
                        },
                        "29": {
                            "0": "PeytonManning",
                            "1": "2015-12-31",
                            "2": 8.00469951054955,
                        },
                        "30": {
                            "0": "PeytonManning",
                            "1": "2016-01-01",
                            "2": 7.58933582317062,
                        },
                        "31": {
                            "0": "PeytonManning",
                            "1": "2016-01-02",
                            "2": 7.82524529143177,
                        },
                        "32": {
                            "0": "PeytonManning",
                            "1": "2016-01-03",
                            "2": 8.24931374626064,
                        },
                        "33": {
                            "0": "PeytonManning",
                            "1": "2016-01-04",
                            "2": 9.29514097366865,
                        },
                        "34": {
                            "0": "PeytonManning",
                            "1": "2016-01-05",
                            "2": 8.56826646160024,
                        },
                        "35": {
                            "0": "PeytonManning",
                            "1": "2016-01-06",
                            "2": 8.35255436947459,
                        },
                        "36": {
                            "0": "PeytonManning",
                            "1": "2016-01-07",
                            "2": 8.29579811063615,
                        },
                        "37": {
                            "0": "PeytonManning",
                            "1": "2016-01-08",
                            "2": 8.29029259122431,
                        },
                        "38": {
                            "0": "PeytonManning",
                            "1": "2016-01-09",
                            "2": 7.78572089653462,
                        },
                        "39": {
                            "0": "PeytonManning",
                            "1": "2016-01-10",
                            "2": 8.28172399041139,
                        },
                        "40": {
                            "0": "PeytonManning",
                            "1": "2016-01-11",
                            "2": 8.4707303170059,
                        },
                        "41": {
                            "0": "PeytonManning",
                            "1": "2016-01-12",
                            "2": 8.13505390861157,
                        },
                        "42": {
                            "0": "PeytonManning",
                            "1": "2016-01-13",
                            "2": 8.06714903991011,
                        },
                        "43": {
                            "0": "TomBrady",
                            "1": "2015-12-02",
                            "2": 8.71177264560569,
                        },
                        "44": {
                            "0": "TomBrady",
                            "1": "2015-12-03",
                            "2": 8.05610965954506,
                        },
                        "45": {
                            "0": "TomBrady",
                            "1": "2015-12-04",
                            "2": 8.08147504013705,
                        },
                        "46": {
                            "0": "TomBrady",
                            "1": "2015-12-05",
                            "2": 7.45876269238096,
                        },
                        "47": {
                            "0": "TomBrady",
                            "1": "2015-12-06",
                            "2": 8.01400499477946,
                        },
                        "48": {
                            "0": "TomBrady",
                            "1": "2015-12-07",
                            "2": 8.49678638163858,
                        },
                        "49": {
                            "0": "TomBrady",
                            "1": "2015-12-08",
                            "2": 7.98104975966596,
                        },
                        "50": {
                            "0": "TomBrady",
                            "1": "2015-12-09",
                            "2": 7.77779262633883,
                        },
                        "51": {
                            "0": "TomBrady",
                            "1": "2015-12-10",
                            "2": 8.2602342916073,
                        },
                        "52": {
                            "0": "TomBrady",
                            "1": "2015-12-11",
                            "2": 7.86633892304654,
                        },
                        "53": {
                            "0": "TomBrady",
                            "1": "2015-12-12",
                            "2": 7.31055015853442,
                        },
                        "54": {
                            "0": "TomBrady",
                            "1": "2015-12-13",
                            "2": 7.71824095195932,
                        },
                        "55": {
                            "0": "TomBrady",
                            "1": "2015-12-14",
                            "2": 8.31947369244219,
                        },
                        "56": {
                            "0": "TomBrady",
                            "1": "2015-12-15",
                            "2": 8.23668532271246,
                        },
                        "57": {
                            "0": "TomBrady",
                            "1": "2015-12-16",
                            "2": 7.80751004221619,
                        },
                        "58": {
                            "0": "TomBrady",
                            "1": "2015-12-17",
                            "2": 7.59186171488993,
                        },
                        "59": {
                            "0": "TomBrady",
                            "1": "2015-12-18",
                            "2": 7.52886925664225,
                        },
                        "60": {
                            "0": "TomBrady",
                            "1": "2015-12-19",
                            "2": 7.17165682276851,
                        },
                        "61": {
                            "0": "TomBrady",
                            "1": "2015-12-20",
                            "2": 7.89133075766189,
                        },
                        "62": {
                            "0": "TomBrady",
                            "1": "2015-12-21",
                            "2": 8.36007143564403,
                        },
                        "63": {
                            "0": "TomBrady",
                            "1": "2015-12-22",
                            "2": 8.11042723757502,
                        },
                        "64": {
                            "0": "TomBrady",
                            "1": "2015-12-23",
                            "2": 7.77527584648686,
                        },
                        "65": {
                            "0": "TomBrady",
                            "1": "2015-12-24",
                            "2": 7.34729970074316,
                        },
                        "66": {
                            "0": "TomBrady",
                            "1": "2015-12-25",
                            "2": 7.30182234213793,
                        },
                        "67": {
                            "0": "TomBrady",
                            "1": "2015-12-26",
                            "2": 7.12044437239249,
                        },
                        "68": {
                            "0": "TomBrady",
                            "1": "2015-12-27",
                            "2": 8.87877607170755,
                        },
                        "69": {
                            "0": "TomBrady",
                            "1": "2015-12-28",
                            "2": 9.25061821847475,
                        },
                        "70": {
                            "0": "TomBrady",
                            "1": "2015-12-29",
                            "2": 9.24792513230345,
                        },
                        "71": {
                            "0": "TomBrady",
                            "1": "2015-12-30",
                            "2": 8.39140318535794,
                        },
                        "72": {
                            "0": "TomBrady",
                            "1": "2015-12-31",
                            "2": 8.00469951054955,
                        },
                        "73": {
                            "0": "TomBrady",
                            "1": "2016-01-01",
                            "2": 7.58933582317062,
                        },
                        "74": {
                            "0": "TomBrady",
                            "1": "2016-01-02",
                            "2": 7.82524529143177,
                        },
                        "75": {
                            "0": "TomBrady",
                            "1": "2016-01-03",
                            "2": 8.24931374626064,
                        },
                        "76": {
                            "0": "TomBrady",
                            "1": "2016-01-04",
                            "2": 9.29514097366865,
                        },
                        "77": {
                            "0": "TomBrady",
                            "1": "2016-01-05",
                            "2": 8.56826646160024,
                        },
                        "78": {
                            "0": "TomBrady",
                            "1": "2016-01-06",
                            "2": 8.35255436947459,
                        },
                        "79": {
                            "0": "TomBrady",
                            "1": "2016-01-07",
                            "2": 8.29579811063615,
                        },
                        "80": {
                            "0": "TomBrady",
                            "1": "2016-01-08",
                            "2": 8.29029259122431,
                        },
                        "81": {
                            "0": "TomBrady",
                            "1": "2016-01-09",
                            "2": 7.78572089653462,
                        },
                        "82": {
                            "0": "TomBrady",
                            "1": "2016-01-10",
                            "2": 8.28172399041139,
                        },
                        "83": {
                            "0": "TomBrady",
                            "1": "2016-01-11",
                            "2": 8.4707303170059,
                        },
                        "84": {
                            "0": "TomBrady",
                            "1": "2016-01-12",
                            "2": 8.13505390861157,
                        },
                        "85": {
                            "0": "TomBrady",
                            "1": "2016-01-13",
                            "2": 8.06714903991011,
                        },
                    },
                },
            ),
        )
        """
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "timegpt_multi_series_historic"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def timegpt_multi_series_anomalies(
        self, *, request: MultiSeriesAnomaly, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Based on the provided data, this endpoint detects the anomalies in the historical perdiod of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains a flag indicating if the date has a anomaly and also provides the prediction interval used to define if an observation is an anomaly.Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - request: MultiSeriesAnomaly.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import MultiSeriesAnomaly
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.timegpt_multi_series_anomalies(
            request=MultiSeriesAnomaly(),
        )
        """
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "timegpt_multi_series_anomalies"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def timegpt_multi_series_cross_validation(
        self, *, request: MultiSeriesCrossValidation, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Perform Cross Validation for multiple series

        Parameters:
            - request: MultiSeriesCrossValidation.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import MultiSeriesCrossValidation
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.timegpt_multi_series_cross_validation(
            request=MultiSeriesCrossValidation(),
        )
        """
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "timegpt_multi_series_cross_validation"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def timegpt_input_size(
        self, *, request: SingleSeriesForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Parameters:
            - request: SingleSeriesForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import SingleSeriesForecast
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.timegpt_input_size(
            request=SingleSeriesForecast(),
        )
        """
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "timegpt_input_size"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def timegpt_model_params(
        self, *, request: SingleSeriesForecast, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Parameters:
            - request: SingleSeriesForecast.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import SingleSeriesForecast
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.timegpt_model_params(
            request=SingleSeriesForecast(),
        )
        """
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "timegpt_model_params"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(typing.Any, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def v_2_forecast(
        self,
        *,
        series: SeriesWithFutureExogenous,
        freq: str,
        h: int,
        model: typing.Optional[Model] = OMIT,
        clean_ex_first: typing.Optional[bool] = OMIT,
        level: typing.Optional[typing.Sequence[ForecastInputLevelItem]] = OMIT,
        finetune_steps: typing.Optional[int] = OMIT,
        finetune_loss: typing.Optional[ForecastInputFinetuneLoss] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ForecastOutput:
        """
        Based on the provided data, this endpoint predicts the future values of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values for each series based on the input arguments. Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - series: SeriesWithFutureExogenous.

            - freq: str. The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available.

            - h: int. The forecasting horizon. This represents the number of time steps into the future that the forecast should predict.

            - model: typing.Optional[Model]. Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data.

            - clean_ex_first: typing.Optional[bool]. A boolean flag that indicates whether the API should preprocess (clean) the exogenous signal before applying the large time model. If True, the exogenous signal is cleaned; if False, the exogenous variables are applied after the large time model.

            - level: typing.Optional[typing.Sequence[ForecastInputLevelItem]].

            - finetune_steps: typing.Optional[int]. The number of tuning steps used to train the large time model on the data. Set this value to 0 for zero-shot inference, i.e., to make predictions without any further model tuning.

            - finetune_loss: typing.Optional[ForecastInputFinetuneLoss]. The loss used to train the large time model on the data. Select from ['default', 'mae', 'mse', 'rmse', 'mape', 'smape']. It will only be used if finetune_steps larger than 0. Default is a robust loss function that is less sensitive to outliers.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import SeriesWithFutureExogenous
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.v_2_forecast(
            series=SeriesWithFutureExogenous(
                y=[1.1],
                sizes=[1],
            ),
            freq="freq",
            h=1,
        )
        """
        _request: typing.Dict[str, typing.Any] = {"series": series, "freq": freq, "h": h}
        if model is not OMIT:
            _request["model"] = model
        if clean_ex_first is not OMIT:
            _request["clean_ex_first"] = clean_ex_first
        if level is not OMIT:
            _request["level"] = level
        if finetune_steps is not OMIT:
            _request["finetune_steps"] = finetune_steps
        if finetune_loss is not OMIT:
            _request["finetune_loss"] = finetune_loss
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v2/forecast"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(ForecastOutput, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def v_2_cross_validation(
        self,
        *,
        series: Series,
        freq: str,
        n_windows: int,
        h: int,
        model: typing.Optional[Model] = OMIT,
        clean_ex_first: typing.Optional[bool] = OMIT,
        level: typing.Optional[typing.Sequence[CrossValidationInputLevelItem]] = OMIT,
        finetune_steps: typing.Optional[int] = OMIT,
        finetune_loss: typing.Optional[CrossValidationInputFinetuneLoss] = OMIT,
        step_size: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CrossValidationOutput:
        """
        Perform Cross Validation for multiple series

        Parameters:
            - series: Series.

            - freq: str. The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available.

            - n_windows: int. Number of windows to evaluate.

            - h: int. The forecasting horizon. This represents the number of time steps into the future that the forecast should predict.

            - model: typing.Optional[Model]. Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data.

            - clean_ex_first: typing.Optional[bool]. A boolean flag that indicates whether the API should preprocess (clean) the exogenous signal before applying the large time model. If True, the exogenous signal is cleaned; if False, the exogenous variables are applied after the large time model.

            - level: typing.Optional[typing.Sequence[CrossValidationInputLevelItem]].

            - finetune_steps: typing.Optional[int]. The number of tuning steps used to train the large time model on the data. Set this value to 0 for zero-shot inference, i.e., to make predictions without any further model tuning.

            - finetune_loss: typing.Optional[CrossValidationInputFinetuneLoss]. The loss used to train the large time model on the data. Select from ['default', 'mae', 'mse', 'rmse', 'mape', 'smape']. It will only be used if finetune_steps larger than 0. Default is a robust loss function that is less sensitive to outliers.

            - step_size: typing.Optional[int].

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import Series
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.v_2_cross_validation(
            series=Series(
                y=[1.1],
                sizes=[1],
            ),
            freq="freq",
            n_windows=1,
            h=1,
        )
        """
        _request: typing.Dict[str, typing.Any] = {"series": series, "freq": freq, "n_windows": n_windows, "h": h}
        if model is not OMIT:
            _request["model"] = model
        if clean_ex_first is not OMIT:
            _request["clean_ex_first"] = clean_ex_first
        if level is not OMIT:
            _request["level"] = level
        if finetune_steps is not OMIT:
            _request["finetune_steps"] = finetune_steps
        if finetune_loss is not OMIT:
            _request["finetune_loss"] = finetune_loss
        if step_size is not OMIT:
            _request["step_size"] = step_size
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v2/cross_validation"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(CrossValidationOutput, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def v_2_historic_forecast(
        self,
        *,
        series: Series,
        freq: str,
        model: typing.Optional[Model] = OMIT,
        clean_ex_first: typing.Optional[bool] = OMIT,
        level: typing.Optional[typing.Sequence[InSampleInputLevelItem]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> InSampleOutput:
        """
        Based on the provided data, this endpoint predicts the in-sample period (historical period) values of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values for the historical period. Usually useful for anomaly detection. Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - series: Series.

            - freq: str. The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available.

            - model: typing.Optional[Model]. Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data.

            - clean_ex_first: typing.Optional[bool]. A boolean flag that indicates whether the API should preprocess (clean) the exogenous signal before applying the large time model. If True, the exogenous signal is cleaned; if False, the exogenous variables are applied after the large time model.

            - level: typing.Optional[typing.Sequence[InSampleInputLevelItem]].

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import Series
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.v_2_historic_forecast(
            series=Series(
                y=[1.1],
                sizes=[1],
            ),
            freq="freq",
        )
        """
        _request: typing.Dict[str, typing.Any] = {"series": series, "freq": freq}
        if model is not OMIT:
            _request["model"] = model
        if clean_ex_first is not OMIT:
            _request["clean_ex_first"] = clean_ex_first
        if level is not OMIT:
            _request["level"] = level
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v2/historic_forecast"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(InSampleOutput, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def v_2_anomaly_detection(
        self,
        *,
        series: Series,
        freq: str,
        model: typing.Optional[Model] = OMIT,
        clean_ex_first: typing.Optional[bool] = OMIT,
        level: typing.Optional[Level] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AnomalyDetectionOutput:
        """
        Based on the provided data, this endpoint detects the anomalies in the historical perdiod of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains a flag indicating if the date has a anomaly and also provides the prediction interval used to define if an observation is an anomaly.Get your token for private beta at https://dashboard.nixtla.io.

        Parameters:
            - series: Series.

            - freq: str. The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available.

            - model: typing.Optional[Model]. Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data.

            - clean_ex_first: typing.Optional[bool]. A boolean flag that indicates whether the API should preprocess (clean) the exogenous signal before applying the large time model. If True, the exogenous signal is cleaned; if False, the exogenous variables are applied after the large time model.

            - level: typing.Optional[Level]. Specifies the confidence level for the prediction interval used in anomaly detection. It is represented as a percentage between 0 and 100. For instance, a level of 95 indicates that the generated prediction interval captures the true future observation 95% of the time. Any observed values outside of this interval would be considered anomalies. A higher level leads to wider prediction intervals and potentially fewer detected anomalies, whereas a lower level results in narrower intervals and potentially more detected anomalies. Default: 99.

            - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
        ---
        from nixtla import Series
        from nixtla.client import AsyncNixtla

        client = AsyncNixtla(
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        await client.v_2_anomaly_detection(
            series=Series(
                y=[1.1],
                sizes=[1],
            ),
            freq="freq",
        )
        """
        _request: typing.Dict[str, typing.Any] = {"series": series, "freq": freq}
        if model is not OMIT:
            _request["model"] = model
        if clean_ex_first is not OMIT:
            _request["clean_ex_first"] = clean_ex_first
        if level is not OMIT:
            _request["level"] = level
        _response = await self._client_wrapper.httpx_client.request(
            "POST",
            urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v2/anomaly_detection"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(AnomalyDetectionOutput, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)
