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

import typing

from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.request_options import RequestOptions
from ..types.model_reasoning_options_response import ModelReasoningOptionsResponse
from ..types.models_list_response import ModelsListResponse
from .raw_client import AsyncRawModelsClient, RawModelsClient


class ModelsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawModelsClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> RawModelsClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawModelsClient
        """
        return self._raw_client

    def list_models(
        self,
        *,
        ui_models_only: typing.Optional[bool] = None,
        include_pricing: typing.Optional[bool] = None,
        include_details: typing.Optional[bool] = None,
        include_capabilities: typing.Optional[bool] = None,
        include_deprecated: typing.Optional[bool] = None,
        include_legacy: typing.Optional[bool] = None,
        include_recent_usage: typing.Optional[bool] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ModelsListResponse:
        """
        List available AI models with their capabilities and configuration.

        Authentication:
            Requires either Bearer token or X-API-Key header

        Query Parameters:
            ui_models_only: Filter to show only UI-visible models (default: False)
            include_pricing: Include pricing information (default: False)
            include_details: Include detailed model information (default: False)
            include_capabilities: Include model capabilities array (default: True)
            include_deprecated: Include deprecated models (default: False)
            include_legacy: Include legacy models (default: False)
            include_recent_usage: Include last_used_at timestamp for API key (default: False)

        Returns:
            ModelsListResponse with list of models and total count

        Parameters
        ----------
        ui_models_only : typing.Optional[bool]

        include_pricing : typing.Optional[bool]

        include_details : typing.Optional[bool]

        include_capabilities : typing.Optional[bool]

        include_deprecated : typing.Optional[bool]

        include_legacy : typing.Optional[bool]

        include_recent_usage : typing.Optional[bool]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ModelsListResponse
            Successful Response

        Examples
        --------
        from aitronos import Aitronos

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.models.list_models()
        """
        _response = self._raw_client.list_models(
            ui_models_only=ui_models_only,
            include_pricing=include_pricing,
            include_details=include_details,
            include_capabilities=include_capabilities,
            include_deprecated=include_deprecated,
            include_legacy=include_legacy,
            include_recent_usage=include_recent_usage,
            request_options=request_options,
        )
        return _response.data

    def get_reasoning_options(
        self, *, model_key: str, request_options: typing.Optional[RequestOptions] = None
    ) -> ModelReasoningOptionsResponse:
        """
        Get available reasoning effort and summary options for a specific model.

        Different models support different reasoning effort levels. Use this endpoint
        to discover which options are available for a given model before configuring
        an assistant or sending a chat request.

        Authentication:
            Requires either Bearer token or X-API-Key header

        Query Parameters:
            model_key: The model key to look up (e.g., 'claude-sonnet-4', 'o3-mini')

        Returns:
            ModelReasoningOptionsResponse with available effort and summary options

        Parameters
        ----------
        model_key : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ModelReasoningOptionsResponse
            Successful Response

        Examples
        --------
        from aitronos import Aitronos

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.models.get_reasoning_options(
            model_key="model_key",
        )
        """
        _response = self._raw_client.get_reasoning_options(model_key=model_key, request_options=request_options)
        return _response.data


class AsyncModelsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawModelsClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> AsyncRawModelsClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawModelsClient
        """
        return self._raw_client

    async def list_models(
        self,
        *,
        ui_models_only: typing.Optional[bool] = None,
        include_pricing: typing.Optional[bool] = None,
        include_details: typing.Optional[bool] = None,
        include_capabilities: typing.Optional[bool] = None,
        include_deprecated: typing.Optional[bool] = None,
        include_legacy: typing.Optional[bool] = None,
        include_recent_usage: typing.Optional[bool] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ModelsListResponse:
        """
        List available AI models with their capabilities and configuration.

        Authentication:
            Requires either Bearer token or X-API-Key header

        Query Parameters:
            ui_models_only: Filter to show only UI-visible models (default: False)
            include_pricing: Include pricing information (default: False)
            include_details: Include detailed model information (default: False)
            include_capabilities: Include model capabilities array (default: True)
            include_deprecated: Include deprecated models (default: False)
            include_legacy: Include legacy models (default: False)
            include_recent_usage: Include last_used_at timestamp for API key (default: False)

        Returns:
            ModelsListResponse with list of models and total count

        Parameters
        ----------
        ui_models_only : typing.Optional[bool]

        include_pricing : typing.Optional[bool]

        include_details : typing.Optional[bool]

        include_capabilities : typing.Optional[bool]

        include_deprecated : typing.Optional[bool]

        include_legacy : typing.Optional[bool]

        include_recent_usage : typing.Optional[bool]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ModelsListResponse
            Successful Response

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

        client = AsyncAitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.models.list_models()


        asyncio.run(main())
        """
        _response = await self._raw_client.list_models(
            ui_models_only=ui_models_only,
            include_pricing=include_pricing,
            include_details=include_details,
            include_capabilities=include_capabilities,
            include_deprecated=include_deprecated,
            include_legacy=include_legacy,
            include_recent_usage=include_recent_usage,
            request_options=request_options,
        )
        return _response.data

    async def get_reasoning_options(
        self, *, model_key: str, request_options: typing.Optional[RequestOptions] = None
    ) -> ModelReasoningOptionsResponse:
        """
        Get available reasoning effort and summary options for a specific model.

        Different models support different reasoning effort levels. Use this endpoint
        to discover which options are available for a given model before configuring
        an assistant or sending a chat request.

        Authentication:
            Requires either Bearer token or X-API-Key header

        Query Parameters:
            model_key: The model key to look up (e.g., 'claude-sonnet-4', 'o3-mini')

        Returns:
            ModelReasoningOptionsResponse with available effort and summary options

        Parameters
        ----------
        model_key : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ModelReasoningOptionsResponse
            Successful Response

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

        client = AsyncAitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.models.get_reasoning_options(
                model_key="model_key",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_reasoning_options(model_key=model_key, request_options=request_options)
        return _response.data
