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
Normalize NVIDIA NIM top-p sampling (#1518)
Ali Khokharda5f7c3211bb
diff --git a/pyproject.toml b/pyproject.tomlindex 7d72ee7e..bfdf9a79 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "hatchling.build"[project]name = "free-claude-code"-version = "5.13.6"+version = "5.13.7"description = "Local proxy connecting coding agents to OpenAI-compatible AI providers"readme = "README.md"requires-python = ">=3.14.0"diff --git a/src/free_claude_code/config/nim.py b/src/free_claude_code/config/nim.pyindex fd2fdf34..2d913757 100644--- a/src/free_claude_code/config/nim.py+++ b/src/free_claude_code/config/nim.py@@ -12,7 +12,10 @@ class NimSettings(BaseModel):1.0, ge=0.0, le=2.0, description="Sampling temperature, must be >=0 and <=2.")top_p: float = Field(- 1.0, ge=0.0, le=1.0, description="Nucleus sampling probability. [0,1]"+ 0.95,+ ge=0.95,+ le=0.95,+ description="FCC's fixed NVIDIA NIM nucleus sampling probability.",)top_k: int = -1max_tokens: int = Field(@@ -61,7 +64,7 @@ class NimSettings(BaseModel):def validate_float_fields(cls, v, info: ValidationInfo):field_defaults = {"temperature": 1.0,- "top_p": 1.0,+ "top_p": 0.95,"min_p": 0.0,"presence_penalty": 0.0,"frequency_penalty": 0.0,diff --git a/src/free_claude_code/providers/nvidia_nim/request_options.py b/src/free_claude_code/providers/nvidia_nim/request_options.pyindex 5c4cc9a0..bbc4894d 100644--- a/src/free_claude_code/providers/nvidia_nim/request_options.py+++ b/src/free_claude_code/providers/nvidia_nim/request_options.py@@ -58,8 +58,7 @@ def apply_nim_request_options(if body.get("temperature") is None and nim.temperature is not None:body["temperature"] = nim.temperature- if body.get("top_p") is None and nim.top_p is not None:- body["top_p"] = nim.top_p+ body["top_p"] = nim.top_pif "stop" not in body and nim.stop:body["stop"] = nim.stopdiff --git a/tests/config/test_config.py b/tests/config/test_config.pyindex 11c71f84..3f4c8266 100644--- a/tests/config/test_config.py+++ b/tests/config/test_config.py@@ -334,8 +334,10 @@ def test_nim_settings_keep_request_local_validation() -> None:assert settings.seed == 7assert settings.stop is Noneassert NimSettings().max_tokens == ANTHROPIC_DEFAULT_MAX_OUTPUT_TOKENS- with pytest.raises(ValidationError):- NimSettings(top_p=1.1)+ assert NimSettings().top_p == 0.95+ for unsupported_top_p in (0.0, 0.9, 1.0):+ with pytest.raises(ValidationError):+ NimSettings(top_p=unsupported_top_p)def test_settings_defaults_do_not_contain_empty_enum_strings() -> None:diff --git a/tests/providers/test_nvidia_nim_request.py b/tests/providers/test_nvidia_nim_request.pyindex fb794bb1..84b22b87 100644--- a/tests/providers/test_nvidia_nim_request.py+++ b/tests/providers/test_nvidia_nim_request.py@@ -163,6 +163,14 @@ class TestBuildRequestBody:body = build_request_body(req, nim, reasoning=REASONING_ON)assert body["max_tokens"] == 4096+ @pytest.mark.parametrize("client_top_p", (None, 0.0, 0.5, 0.95, 1.0))+ def test_top_p_always_uses_nim_policy(self, req, client_top_p):+ req.top_p = client_top_p++ body = build_request_body(req, NimSettings(), reasoning=REASONING_ON)++ assert body["top_p"] == 0.95+def test_presence_penalty_included_when_nonzero(self, req):nim = NimSettings(presence_penalty=0.5)body = build_request_body(req, nim, reasoning=REASONING_ON)diff --git a/uv.lock b/uv.lockindex ad9f9f44..b5330453 100644--- a/uv.lock+++ b/uv.lock@@ -607,7 +607,7 @@ wheels = [[[package]]name = "free-claude-code"-version = "5.13.6"+version = "5.13.7"source = { editable = "." }dependencies = [{ name = "aiohttp" },