Skip to content

An AI Agent that interacts with Windows OS at GUI level.

Python
1.1 KB
Raw Blame
"""Cheaper Inference LLM provider via its OpenAI-compatible API."""

import os

from windows_use.providers.openai.llm import ChatOpenAI

CHEAPER_INFERENCE_BASE_URL = "https://api.cheaperinference.com/v1"


class ChatCheaperInference(ChatOpenAI):
    """Chat model served through Cheaper Inference's OpenAI-compatible endpoint."""

    def __init__(
        self,
        model: str = "gpt-5.4-mini",
        api_key: str | None = None,
        base_url: str | None = None,
        timeout: float = 600.0,
        max_retries: int = 2,
        temperature: float | None = None,
        **kwargs,
    ):
        api_key = api_key or os.environ.get("CHEAPER_INFERENCE_API_KEY")
        base_url = (
            base_url or os.environ.get("CHEAPER_INFERENCE_API_BASE") or CHEAPER_INFERENCE_BASE_URL
        )
        super().__init__(
            model=model,
            api_key=api_key,
            base_url=base_url,
            timeout=timeout,
            max_retries=max_retries,
            temperature=temperature,
            **kwargs,
        )

    @property
    def provider(self) -> str:
        return "cheaper_inference"