Skip to content

Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)

Python

Ignore removed thinking env keys

Alishahryar1103869f62fbd
diff --git a/config/settings.py b/config/settings.py
index 90fe8aa1..ba49ae41 100644
--- a/config/settings.py
+++ b/config/settings.py
@@ -48,11 +48,6 @@ def _configured_env_files(model_config: Mapping[str, Any]) -> tuple[Path, ...]:
return tuple(Path(item) for item in configured)
-def _env_file_contains_key(path: Path, key: str) -> bool:
- """Check whether a dotenv-style file defines the given key."""
- return _env_file_value(path, key) is not None
-
-
def _env_file_value(path: Path, key: str) -> str | None:
"""Return a dotenv value when the file explicitly defines the key."""
if not path.is_file():
@@ -79,31 +74,6 @@ def _env_file_override(model_config: Mapping[str, Any], key: str) -> str | None:
return configured_value
-def _removed_env_var_message(model_config: Mapping[str, Any]) -> str | None:
- """Return a migration error for removed env vars, if present."""
- removed_keys = ("NIM_ENABLE_THINKING", "ENABLE_THINKING")
- replacement = (
- "ENABLE_MODEL_THINKING, ENABLE_OPUS_THINKING, "
- "ENABLE_SONNET_THINKING, or ENABLE_HAIKU_THINKING"
- )
-
- for removed_key in removed_keys:
- if removed_key in os.environ:
- return (
- f"{removed_key} has been removed in this release. "
- f"Rename it to {replacement}."
- )
-
- for env_file in _configured_env_files(model_config):
- if _env_file_contains_key(env_file, removed_key):
- return (
- f"{removed_key} has been removed in this release. "
- f"Rename it to {replacement}. Found in {env_file}."
- )
-
- return None
-
-
class Settings(BaseSettings):
"""Application settings loaded from environment variables."""
@@ -333,14 +303,6 @@ class Settings(BaseSettings):
default="", validation_alias="ANTHROPIC_AUTH_TOKEN"
)
- @model_validator(mode="before")
- @classmethod
- def reject_removed_env_vars(cls, data: Any) -> Any:
- """Fail fast when removed environment variables are still configured."""
- if message := _removed_env_var_message(cls.model_config):
- raise ValueError(message)
- return data
-
# Handle empty strings for optional string fields
@field_validator(
"telegram_bot_token",
diff --git a/pyproject.toml b/pyproject.toml
index abc46d53..8ece905a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "free-claude-code"
-version = "1.2.38"
+version = "1.2.39"
description = "Middleware between Claude Code CLI (Anthropic API) and NVIDIA NIM"
readme = "README.md"
requires-python = ">=3.14.0"
diff --git a/tests/config/test_config.py b/tests/config/test_config.py
index e12665ff..c0f31cd4 100644
--- a/tests/config/test_config.py
+++ b/tests/config/test_config.py
@@ -350,21 +350,34 @@ class TestSettings:
assert settings.anthropic_auth_token == "server-token"
assert settings.uses_process_anthropic_auth_token() is False
- def test_removed_nim_enable_thinking_raises(self, monkeypatch):
- """NIM_ENABLE_THINKING now fails fast with a migration message."""
+ @pytest.mark.parametrize("removed_key", ["NIM_ENABLE_THINKING", "ENABLE_THINKING"])
+ def test_removed_thinking_env_keys_are_ignored(self, monkeypatch, removed_key):
+ """Stale thinking env keys do not block startup or affect settings."""
from config.settings import Settings
- monkeypatch.setenv("NIM_ENABLE_THINKING", "false")
- with pytest.raises(ValidationError, match="ENABLE_MODEL_THINKING"):
- Settings()
+ monkeypatch.setenv(removed_key, "false")
+ monkeypatch.setitem(Settings.model_config, "env_file", ())
+
+ settings = Settings()
+
+ assert settings.enable_model_thinking is True
- def test_removed_enable_thinking_raises(self, monkeypatch):
- """ENABLE_THINKING now fails fast with a migration message."""
+ @pytest.mark.parametrize("removed_key", ["NIM_ENABLE_THINKING", "ENABLE_THINKING"])
+ @pytest.mark.parametrize("value", ["false", ""])
+ def test_removed_thinking_dotenv_keys_are_ignored(
+ self, monkeypatch, tmp_path, removed_key, value
+ ):
+ """Stale thinking dotenv keys do not block startup or affect settings."""
from config.settings import Settings
- monkeypatch.setenv("ENABLE_THINKING", "false")
- with pytest.raises(ValidationError, match="ENABLE_MODEL_THINKING"):
- Settings()
+ env_file = tmp_path / ".env"
+ env_file.write_text(f"{removed_key}={value}\n", encoding="utf-8")
+ monkeypatch.delenv(removed_key, raising=False)
+ monkeypatch.setitem(Settings.model_config, "env_file", (env_file,))
+
+ settings = Settings()
+
+ assert settings.enable_model_thinking is True
# --- NimSettings Validation Tests ---
diff --git a/uv.lock b/uv.lock
index 6dd20cf6..34e58132 100644
--- a/uv.lock
+++ b/uv.lock
@@ -554,7 +554,7 @@ wheels = [
[[package]]
name = "free-claude-code"
-version = "1.2.38"
+version = "1.2.39"
source = { editable = "." }
dependencies = [
{ name = "aiohttp" },