OpenCode's free tier now returns HTTP 403 for anonymous traffic outside the OpenCode client, so the built-in keyless provider is dead weight: - drop the opencode-free provider row, aliases (free/opencode_free), model catalog, keyless runtime ladder rung, header wiring, and cached slugs - delete the model-providers/opencode-free plugin - update tests and the compat manifest for the removed symbols - keep a migration hint in auth.py so users who had it configured see a clear error naming the removal Existing opencode-free configs can move to opencode-zen (pay-as-you-go) or opencode-go (flat subscription).
47 lines
2.3 KiB
Python
47 lines
2.3 KiB
Python
"""Thinking-toggle / reasoning_effort wire invariants shared by the Moonshot- and
|
|
DeepSeek-style chat_completions profiles (all route through
|
|
``agent.reasoning_effort.thinking_toggle_extras``)."""
|
|
|
|
import pytest
|
|
|
|
from agent.reasoning_effort import DEEPSEEK_V4_EFFORTS
|
|
from providers import get_provider_profile
|
|
|
|
REASONING_MATRIX = (
|
|
None,
|
|
{"enabled": False},
|
|
{"enabled": True},
|
|
*({"enabled": True, "effort": e} for e in ("low", "medium", "high", "xhigh", "max", "none")),
|
|
)
|
|
|
|
|
|
@pytest.mark.parametrize("reasoning_config", REASONING_MATRIX, ids=str)
|
|
def test_thinking_toggle_and_effort_never_both_on_moonshot_wire(reasoning_config):
|
|
for provider, model in (("kimi-coding", "kimi-k3"), ("opencode-go", "kimi-k2.6"), ("opencode-go", "deepseek-v4-pro")):
|
|
extra_body, top_level = get_provider_profile(provider).build_api_kwargs_extras(
|
|
reasoning_config=reasoning_config, model=model
|
|
)
|
|
assert not ("thinking" in extra_body and "reasoning_effort" in top_level), (provider, model, reasoning_config)
|
|
|
|
# DeepSeek's own API wants the toggle on every request (omitting it defaults thinking on
|
|
# and then demands reasoning_content echoes); effort rides alongside only when supported.
|
|
extra_body, top_level = get_provider_profile("deepseek").build_api_kwargs_extras(
|
|
reasoning_config=reasoning_config, model="deepseek-v4-pro"
|
|
)
|
|
assert extra_body["thinking"]["type"] in ("enabled", "disabled")
|
|
assert top_level.get("reasoning_effort", DEEPSEEK_V4_EFFORTS[0]) in DEEPSEEK_V4_EFFORTS
|
|
if isinstance(reasoning_config, dict) and reasoning_config.get("enabled") is False:
|
|
assert (extra_body, top_level) == ({"thinking": {"type": "disabled"}}, {})
|
|
|
|
|
|
@pytest.mark.parametrize("reasoning_config", REASONING_MATRIX, ids=str)
|
|
def test_ox_alpha_translation_on_zen(reasoning_config):
|
|
extra_body, top_level = get_provider_profile("opencode-zen").build_api_kwargs_extras(
|
|
reasoning_config=reasoning_config, model="x-preview-f-free"
|
|
)
|
|
# Ox Alpha's wire carries reasoning_effort at top level — never the thinking
|
|
# toggle — and every emitted effort is inside the wire vocabulary.
|
|
assert "thinking" not in extra_body
|
|
effort = top_level.get("reasoning_effort")
|
|
assert effort in (None, "low", "high", "max"), (reasoning_config, effort)
|