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

Restore full live smoke reliability across providers (#1442)

Ali Khokhara541c533f37a
diff --git a/pyproject.toml b/pyproject.toml
index e1d763f9..30089a21 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "free-claude-code"
-version = "5.5.0"
+version = "5.5.1"
description = "Local proxy connecting coding agents to OpenAI-compatible AI providers"
readme = "README.md"
requires-python = ">=3.14.0"
diff --git a/smoke/lib/config.py b/smoke/lib/config.py
index 561030bb..6960ce2f 100644
--- a/smoke/lib/config.py
+++ b/smoke/lib/config.py
@@ -49,7 +49,7 @@ SECRET_KEY_PARTS = ("KEY", "TOKEN", "SECRET", "WEBHOOK", "AUTH")
PROVIDER_SMOKE_DEFAULT_MODELS: dict[str, str] = {
"nvidia_nim": "nvidia_nim/nvidia/nemotron-3-super-120b-a12b",
"azure_openai": "azure_openai/gpt-5.1",
- "open_router": "open_router/moonshotai/kimi-k2.6:free",
+ "open_router": "open_router/nvidia/nemotron-3-super-120b-a12b:free",
"mistral": "mistral/devstral-small-latest",
"mistral_codestral": "mistral_codestral/codestral-latest",
"deepseek": "deepseek/deepseek-v4-pro",
diff --git a/smoke/product/test_client_product_live.py b/smoke/product/test_client_product_live.py
index b606a205..add95a65 100644
--- a/smoke/product/test_client_product_live.py
+++ b/smoke/product/test_client_product_live.py
@@ -70,7 +70,7 @@ def test_pi_cli_prompt_e2e(smoke_config: SmokeConfig, tmp_path: Path) -> None:
if not uv_bin:
pytest.skip("missing_env: uv not found")
provider_model = ProviderMatrixDriver(smoke_config).first_model()
- auth_token = "fcc-pi-smoke-token"
+ auth_token = smoke_config.settings.proxy_auth_token
with SmokeServerDriver(
smoke_config,
@@ -126,7 +126,7 @@ def test_opencode_cli_prompt_e2e(smoke_config: SmokeConfig, tmp_path: Path) -> N
if not uv_bin:
pytest.skip("missing_env: uv not found")
provider_model = ProviderMatrixDriver(smoke_config).first_model()
- auth_token = "fcc-opencode-smoke-token"
+ auth_token = smoke_config.settings.proxy_auth_token
isolated_home = tmp_path / "opencode-home"
isolated_config = tmp_path / "opencode-config"
for path in (isolated_home, isolated_config):
diff --git a/smoke/product/test_provider_product_live.py b/smoke/product/test_provider_product_live.py
index dec48c9c..95a4079d 100644
--- a/smoke/product/test_provider_product_live.py
+++ b/smoke/product/test_provider_product_live.py
@@ -125,7 +125,7 @@ def test_mistral_native_reasoning_model_e2e(smoke_config: SmokeConfig) -> None:
payload = {
"model": "claude-opus-4-7",
- "max_tokens": 256,
+ "max_tokens": 1024,
"messages": [{"role": "user", "content": "Reply with one short sentence."}],
"thinking": {"type": "adaptive"},
}
@@ -302,7 +302,7 @@ def _scenario_adaptive_thinking_history(
) -> None:
payload = {
"model": "claude-opus-4-7",
- "max_tokens": 256,
+ "max_tokens": 2048,
"messages": [
{"role": "user", "content": "hello"},
{
@@ -327,7 +327,7 @@ def _scenario_interleaved_history(
) -> None:
payload = {
"model": "claude-sonnet-4-5-20250929",
- "max_tokens": 256,
+ "max_tokens": 1024,
"messages": [
{"role": "user", "content": "Use the tool."},
{
@@ -458,7 +458,7 @@ def _scenario_interrupted_tool_turn_resume(
tool_id = "toolu_interrupted123456789"
payload = {
"model": "claude-sonnet-4-5-20250929",
- "max_tokens": 32,
+ "max_tokens": 256,
"stream": True,
"messages": [
{"role": "user", "content": "Use echo_smoke with value FCC_INTERRUPTED."},
diff --git a/src/free_claude_code/providers/lmstudio/client.py b/src/free_claude_code/providers/lmstudio/client.py
index 2916c009..c2e83fda 100644
--- a/src/free_claude_code/providers/lmstudio/client.py
+++ b/src/free_claude_code/providers/lmstudio/client.py
@@ -52,6 +52,7 @@ _PROFILE = OpenAIChatProfile(
disabled_value="none",
enabled_value="high",
budget_field="reasoning_tokens",
+ use_extra_body=True,
),
)
diff --git a/src/free_claude_code/providers/mistral/reasoning.py b/src/free_claude_code/providers/mistral/reasoning.py
index f85ab9d0..a65f4f96 100644
--- a/src/free_claude_code/providers/mistral/reasoning.py
+++ b/src/free_claude_code/providers/mistral/reasoning.py
@@ -244,7 +244,7 @@ def _split_mistral_content(content: Any) -> tuple[str | None, str | None, bool]:
return (
"".join(text_parts) or None,
"".join(reasoning_parts) or None,
- bool(text_parts or reasoning_parts),
+ True,
)
diff --git a/tests/contracts/test_smoke_config.py b/tests/contracts/test_smoke_config.py
index c28d3fe8..51426841 100644
--- a/tests/contracts/test_smoke_config.py
+++ b/tests/contracts/test_smoke_config.py
@@ -522,7 +522,7 @@ def test_openrouter_provider_smoke_uses_concrete_free_model(monkeypatch) -> None
models = config.provider_smoke_models()
assert [model.provider for model in models] == ["open_router"]
- assert models[0].full_model == "open_router/moonshotai/kimi-k2.6:free"
+ assert models[0].full_model == "open_router/nvidia/nemotron-3-super-120b-a12b:free"
assert models[0].source == "provider_default"
diff --git a/tests/providers/test_lmstudio.py b/tests/providers/test_lmstudio.py
index 359e7844..c6694d7d 100644
--- a/tests/providers/test_lmstudio.py
+++ b/tests/providers/test_lmstudio.py
@@ -67,7 +67,8 @@ def test_adaptive_client_reasoning_uses_documented_named_effort(lmstudio_provide
body = lmstudio_provider._build_request_body(req, reasoning=REASONING_ON)
- assert body["reasoning_effort"] == "high"
+ assert body["extra_body"]["reasoning_effort"] == "high"
+ assert "reasoning_effort" not in body
def test_exact_client_budget_is_not_derived_from_output_tokens(lmstudio_provider):
@@ -81,7 +82,8 @@ def test_exact_client_budget_is_not_derived_from_output_tokens(lmstudio_provider
),
)
- assert body["reasoning_tokens"] == 1024
+ assert body["extra_body"]["reasoning_tokens"] == 1024
+ assert "reasoning_tokens" not in body
assert body["max_tokens"] == 8192
@@ -187,6 +189,49 @@ async def test_stream_response_text(lmstudio_provider):
)
+async def test_stream_response_passes_exact_reasoning_budget_via_extra_body(
+ lmstudio_provider,
+):
+ req = make_request()
+ policy = ReasoningPolicy.on(
+ effort=ReasoningEffort.HIGH,
+ budget_tokens=1024,
+ )
+
+ mock_chunk = MagicMock()
+ mock_chunk.choices = [
+ MagicMock(
+ delta=MagicMock(content="Done", reasoning_content=None, tool_calls=None),
+ finish_reason="stop",
+ )
+ ]
+ mock_chunk.usage = MagicMock(completion_tokens=1, prompt_tokens=1)
+
+ async def mock_stream():
+ yield mock_chunk
+
+ with patch.object(
+ lmstudio_provider._client.chat.completions, "create", new_callable=AsyncMock
+ ) as mock_create:
+ mock_create.return_value = mock_stream()
+
+ events = [
+ event
+ async for event in lmstudio_provider.stream_response(
+ req,
+ reasoning=policy,
+ )
+ ]
+
+ await_args = mock_create.await_args
+ assert await_args is not None
+ create_kwargs = await_args.kwargs
+ assert create_kwargs["extra_body"] == {"reasoning_tokens": 1024}
+ assert "reasoning_tokens" not in create_kwargs
+ assert any("message_stop" in event for event in events)
+
+
@pytest.mark.asyncio
async def test_cleanup(lmstudio_provider):
lmstudio_provider._client = AsyncMock()
diff --git a/tests/providers/test_mistral.py b/tests/providers/test_mistral.py
index 430104b6..3b841ceb 100644
--- a/tests/providers/test_mistral.py
+++ b/tests/providers/test_mistral.py
@@ -435,6 +435,45 @@ async def test_stream_response_preserves_mixed_native_content_array(
assert "Native text." in event_text
+async def test_stream_response_ignores_unknown_native_content_chunks(
+ mistral_provider,
+):
+ req = make_request()
+
+ mock_chunk = MagicMock()
+ mock_chunk.choices = [
+ MagicMock(
+ delta=MagicMock(
+ content=[
+ {
+ "type": "reference",
+ "reference_ids": ["ref_1"],
+ }
+ ],
+ reasoning_content=None,
+ tool_calls=None,
+ ),
+ finish_reason="stop",
+ )
+ ]
+ mock_chunk.usage = MagicMock(completion_tokens=1, prompt_tokens=1)
+
+ async def mock_stream():
+ yield mock_chunk
+
+ with patch.object(
+ mistral_provider._client.chat.completions, "create", new_callable=AsyncMock
+ ) as mock_create:
+ mock_create.return_value = mock_stream()
+
+ events = [event async for event in mistral_provider.stream_response(req)]
+
+ event_text = "\n".join(events)
+ assert "reference_ids" not in event_text
+ assert "message_stop" in event_text
+
+
@pytest.mark.asyncio
async def test_stream_response_suppresses_native_mistral_thinking_when_disabled(
mistral_provider,
diff --git a/uv.lock b/uv.lock
index f0a6b297..5dda1e9b 100644
--- a/uv.lock
+++ b/uv.lock
@@ -607,7 +607,7 @@ wheels = [
[[package]]
name = "free-claude-code"
-version = "5.5.0"
+version = "5.5.1"
source = { editable = "." }
dependencies = [
{ name = "aiohttp" },