feat(config): align tier defaults to cost-conscious models + qwen3-235b on tier C

- Tier S → google/gemini-3-flash-preview ($0.50/$3.00)
- Tier A/B → deepseek/deepseek-v4-flash ($0.14/$0.28)
- Tier C → qwen/qwen3-235b-a22b-2507 ($0.071/$0.10) — Phase 2 target
- Tier D → openai/gpt-oss-20b ($0.03/$0.14)

Aggiornato cost_tracker con prezzi reali per tier. Defaults config.py
ora rispecchiano .env corrente per evitare divergenze dead-code.

Tier S/A/B/D restano cablati ma non ancora invocati nel loop Phase 2
(solo Hypothesis tier C attivo).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-11 22:13:49 +02:00
parent 68637d1102
commit 9c53995f23
8 changed files with 39 additions and 39 deletions
+5 -5
View File
@@ -73,9 +73,9 @@ def test_settings_llm_model_defaults(monkeypatch: pytest.MonkeyPatch) -> None:
s = Settings(_env_file=None) # type: ignore[call-arg]
assert s.llm_model_tier_s == "anthropic/claude-opus-4-7"
assert s.llm_model_tier_a == "anthropic/claude-sonnet-4-6"
assert s.llm_model_tier_b == "anthropic/claude-sonnet-4-6"
assert s.llm_model_tier_c == "qwen/qwen-2.5-72b-instruct"
assert s.llm_model_tier_d == "meta-llama/llama-3.3-70b-instruct"
assert s.llm_model_tier_s == "google/gemini-3-flash-preview"
assert s.llm_model_tier_a == "deepseek/deepseek-v4-flash"
assert s.llm_model_tier_b == "deepseek/deepseek-v4-flash"
assert s.llm_model_tier_c == "qwen/qwen3-235b-a22b-2507"
assert s.llm_model_tier_d == "openai/gpt-oss-20b"
assert s.openrouter_base_url == "https://openrouter.ai/api/v1"
+5 -5
View File
@@ -4,12 +4,12 @@ from multi_swarm.llm.cost_tracker import CostTracker, estimate_cost
def test_estimate_cost_tier_c():
cost = estimate_cost(input_tokens=1_000_000, output_tokens=1_000_000, tier=ModelTier.C)
assert cost == 0.40 + 0.40
assert cost == 0.071 + 0.10
def test_estimate_cost_tier_b():
cost = estimate_cost(input_tokens=1_000_000, output_tokens=1_000_000, tier=ModelTier.B)
assert cost == 3.00 + 15.00
assert cost == 0.14 + 0.28
def test_tracker_accumulates():
@@ -34,17 +34,17 @@ def test_tracker_per_tier_breakdown():
def test_estimate_cost_tier_s():
cost = estimate_cost(input_tokens=1_000_000, output_tokens=1_000_000, tier=ModelTier.S)
assert cost == 15.00 + 75.00
assert cost == 0.50 + 3.00
def test_estimate_cost_tier_a():
cost = estimate_cost(input_tokens=1_000_000, output_tokens=1_000_000, tier=ModelTier.A)
assert cost == 3.00 + 15.00
assert cost == 0.14 + 0.28
def test_estimate_cost_tier_d():
cost = estimate_cost(input_tokens=1_000_000, output_tokens=1_000_000, tier=ModelTier.D)
assert cost == 0.10 + 0.30
assert cost == 0.03 + 0.14
def test_tracker_summary_contains_all_five_tiers():
+8 -8
View File
@@ -54,8 +54,8 @@ def test_completion_tier_b_uses_openrouter_with_anthropic_model(mocker):
assert out.output_tokens == 150
assert out.tier == ModelTier.B
call_kwargs = fake_openai.chat.completions.create.call_args.kwargs
assert call_kwargs["model"] == "anthropic/claude-sonnet-4-6"
assert out.model == "anthropic/claude-sonnet-4-6"
assert call_kwargs["model"] == "deepseek/deepseek-v4-flash"
assert out.model == "deepseek/deepseek-v4-flash"
@pytest.mark.slow
@@ -138,9 +138,9 @@ def test_completion_tier_s_uses_openrouter_with_anthropic_model(mocker):
fake_openai.chat.completions.create.assert_called_once()
call_kwargs = fake_openai.chat.completions.create.call_args.kwargs
assert call_kwargs["model"] == "anthropic/claude-opus-4-7"
assert call_kwargs["model"] == "google/gemini-3-flash-preview"
assert out.tier == ModelTier.S
assert out.model == "anthropic/claude-opus-4-7"
assert out.model == "google/gemini-3-flash-preview"
def test_completion_tier_a_uses_openrouter_with_anthropic_model(mocker):
@@ -157,9 +157,9 @@ def test_completion_tier_a_uses_openrouter_with_anthropic_model(mocker):
fake_openai.chat.completions.create.assert_called_once()
call_kwargs = fake_openai.chat.completions.create.call_args.kwargs
assert call_kwargs["model"] == "anthropic/claude-sonnet-4-6"
assert call_kwargs["model"] == "deepseek/deepseek-v4-flash"
assert out.tier == ModelTier.A
assert out.model == "anthropic/claude-sonnet-4-6"
assert out.model == "deepseek/deepseek-v4-flash"
def test_completion_tier_d_uses_openrouter_with_llama(mocker):
@@ -178,9 +178,9 @@ def test_completion_tier_d_uses_openrouter_with_llama(mocker):
fake_openai.chat.completions.create.assert_called_once()
call_kwargs = fake_openai.chat.completions.create.call_args.kwargs
assert call_kwargs["model"] == "meta-llama/llama-3.3-70b-instruct"
assert call_kwargs["model"] == "openai/gpt-oss-20b"
assert out.tier == ModelTier.D
assert out.model == "meta-llama/llama-3.3-70b-instruct"
assert out.model == "openai/gpt-oss-20b"
def test_completion_uses_custom_model_tier_s(mocker):