Skip to content

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

Python

feat: add Cheaper Inference provider

aiapienthusiast5b55395f326d
diff --git a/README.md b/README.md
index 595230f..e2f1918 100644
--- a/README.md
+++ b/README.md
@@ -150,6 +150,7 @@ windows-use
| Anthropic | `from windows_use.providers.anthropic import ChatAnthropic` |
| OpenAI | `from windows_use.providers.openai import ChatOpenAI` |
| Atlas Cloud | `from windows_use.providers.atlas_cloud import ChatAtlasCloud` |
+| Cheaper Inference | `from windows_use.providers.cheaper_inference import ChatCheaperInference` |
| Google | `from windows_use.providers.google import ChatGoogle` |
| Groq | `from windows_use.providers.groq import ChatGroq` |
| Ollama | `from windows_use.providers.ollama import ChatOllama` |
@@ -170,6 +171,14 @@ from windows_use.providers.atlas_cloud import ChatAtlasCloud
llm = ChatAtlasCloud(model="openai/gpt-4.1-mini")
```
+Cheaper Inference uses its OpenAI-compatible API and reads `CHEAPER_INFERENCE_API_KEY` by default:
+
+```python
+from windows_use.providers.cheaper_inference import ChatCheaperInference
+
+llm = ChatCheaperInference(model="gpt-5.4-mini")
+```
+
## 🧰 Agent Configuration
```python
diff --git a/tests/unit/providers/test_cheaper_inference.py b/tests/unit/providers/test_cheaper_inference.py
new file mode 100644
index 0000000..f71bd3b
--- /dev/null
+++ b/tests/unit/providers/test_cheaper_inference.py
@@ -0,0 +1,42 @@
+from unittest.mock import patch
+
+from windows_use.cli.registry import (
+ get_models,
+ get_provider_display,
+ get_providers,
+ provider_requires_api_key,
+)
+from windows_use.providers.cheaper_inference import ChatCheaperInference
+from windows_use.providers.cheaper_inference.llm import CHEAPER_INFERENCE_BASE_URL
+
+
+@patch("windows_use.providers.openai.llm.AsyncOpenAI")
+@patch("windows_use.providers.openai.llm.OpenAI")
+def test_cheaper_inference_defaults(mock_openai, mock_async_openai, monkeypatch):
+ monkeypatch.setenv("CHEAPER_INFERENCE_API_KEY", "ci-key")
+ monkeypatch.delenv("CHEAPER_INFERENCE_API_BASE", raising=False)
+
+ llm = ChatCheaperInference()
+
+ assert llm.provider == "cheaper_inference"
+ assert llm.model_name == "gpt-5.4-mini"
+ assert llm.base_url == CHEAPER_INFERENCE_BASE_URL
+ mock_openai.assert_called_once_with(
+ api_key="ci-key",
+ base_url=CHEAPER_INFERENCE_BASE_URL,
+ timeout=600.0,
+ max_retries=2,
+ )
+ mock_async_openai.assert_called_once_with(
+ api_key="ci-key",
+ base_url=CHEAPER_INFERENCE_BASE_URL,
+ timeout=600.0,
+ max_retries=2,
+ )
+
+
+def test_cheaper_inference_is_available_in_cli_registry():
+ assert ("Cheaper Inference", "cheaper_inference") in get_providers()
+ assert ("GPT-5.4 mini (recommended)", "gpt-5.4-mini") in get_models("cheaper_inference")
+ assert get_provider_display("cheaper_inference") == "Cheaper Inference"
+ assert provider_requires_api_key("cheaper_inference") is True
diff --git a/windows_use/cli/registry.py b/windows_use/cli/registry.py
index 9ebe266..7a1b2be 100644
--- a/windows_use/cli/registry.py
+++ b/windows_use/cli/registry.py
@@ -12,6 +12,7 @@ PROVIDERS: list[tuple[str, str]] = [
("Groq", "groq"),
("OpenAI", "openai"),
("Atlas Cloud", "atlas_cloud"),
+ ("Cheaper Inference", "cheaper_inference"),
("Anthropic", "anthropic"),
("Google", "google"),
("Ollama", "ollama"),
@@ -58,6 +59,13 @@ MODELS: dict[str, list[tuple[str, str]]] = {
"atlas_cloud": [
("OpenAI GPT-4.1 mini", "openai/gpt-4.1-mini"),
],
+ "cheaper_inference": [
+ ("GPT-5.4 mini (recommended)", "gpt-5.4-mini"),
+ ("GPT-5.4", "gpt-5.4"),
+ ("Claude Sonnet 5", "claude-sonnet-5"),
+ ("DeepSeek V4 Flash", "deepseek-v4-flash"),
+ ("GLM-5.3", "glm-5.3"),
+ ],
"perplexity": [
("GPT-5.4 (recommended)", "openai/gpt-5.4"),
("Gemini 3.1 Pro Preview", "google/gemini-3.1-pro-preview"),
@@ -179,6 +187,7 @@ PROVIDERS_REQUIRING_API_KEY: set[str] = {
"groq",
"openai",
"atlas_cloud",
+ "cheaper_inference",
"anthropic",
"google",
"mistral",
@@ -202,6 +211,7 @@ PROVIDER_DISPLAY: dict[str, str] = {
"groq": "Groq",
"openai": "OpenAI",
"atlas_cloud": "Atlas Cloud",
+ "cheaper_inference": "Cheaper Inference",
"anthropic": "Anthropic",
"google": "Google",
"ollama": "Ollama",
diff --git a/windows_use/cli/setup.py b/windows_use/cli/setup.py
index 025bfed..e2e8d17 100644
--- a/windows_use/cli/setup.py
+++ b/windows_use/cli/setup.py
@@ -371,6 +371,10 @@ def create_llm(provider: str, model: str, api_key: str | None = None, base_url:
from windows_use.providers.atlas_cloud import ChatAtlasCloud
return ChatAtlasCloud(model=model, api_key=key, base_url=base_url)
+ if provider == "cheaper_inference":
+ from windows_use.providers.cheaper_inference import ChatCheaperInference
+
+ return ChatCheaperInference(model=model, api_key=key, base_url=base_url)
if provider == "anthropic":
from windows_use.providers.anthropic import ChatAnthropic
@@ -756,6 +760,7 @@ def _env_api_key_for_provider(provider: str) -> str | None:
"groq": "GROQ_API_KEY",
"openai": "OPENAI_API_KEY",
"atlas_cloud": "ATLAS_CLOUD_API_KEY",
+ "cheaper_inference": "CHEAPER_INFERENCE_API_KEY",
"anthropic": "ANTHROPIC_API_KEY",
"google": "GEMINI_API_KEY", # or GOOGLE_API_KEY
"mistral": "MISTRAL_API_KEY",
diff --git a/windows_use/providers/__init__.py b/windows_use/providers/__init__.py
index 1a0472e..38b8551 100644
--- a/windows_use/providers/__init__.py
+++ b/windows_use/providers/__init__.py
@@ -18,6 +18,7 @@ from windows_use.providers.atlas_cloud import ChatAtlasCloud
from windows_use.providers.azure_openai import ChatAzureOpenAI
from windows_use.providers.base import BaseChatLLM, BaseSTT, BaseTTS
from windows_use.providers.cerebras import ChatCerebras
+from windows_use.providers.cheaper_inference import ChatCheaperInference
from windows_use.providers.deepseek import ChatDeepSeek
from windows_use.providers.events import LLMEvent, LLMStreamEvent, Thinking, ToolCall
from windows_use.providers.google import ChatGoogle, STTGoogle
@@ -75,6 +76,7 @@ __all__ = [
# LLM providers
"ChatAnthropic",
"ChatAtlasCloud",
+ "ChatCheaperInference",
"ChatGoogle",
"ChatOpenAI",
"ChatOllama",
diff --git a/windows_use/providers/cheaper_inference/__init__.py b/windows_use/providers/cheaper_inference/__init__.py
new file mode 100644
index 0000000..d570e3f
--- /dev/null
+++ b/windows_use/providers/cheaper_inference/__init__.py
@@ -0,0 +1,3 @@
+from windows_use.providers.cheaper_inference.llm import ChatCheaperInference
+
+__all__ = ["ChatCheaperInference"]
diff --git a/windows_use/providers/cheaper_inference/llm.py b/windows_use/providers/cheaper_inference/llm.py
new file mode 100644
index 0000000..fb486f5
--- /dev/null
+++ b/windows_use/providers/cheaper_inference/llm.py
@@ -0,0 +1,39 @@
+"""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"