Skip to content

Commit f6aa14f

Browse files
authored
Revert "Add FreeToken provider for on-device models (#91)" (#92)
This reverts commit 1b03370. Co-authored-by: shubham3-ucb <shubham3-ucb@users.noreply.github.com>
1 parent 1b03370 commit f6aa14f

4 files changed

Lines changed: 4 additions & 83 deletions

File tree

README.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -350,23 +350,8 @@ Any [LiteLLM](https://docs.litellm.ai/)-compatible model works using `provider/m
350350
--model gemini/gemini-3-pro-preview # Gemini
351351
--model anthropic/claude-sonnet-4-20250514 # Anthropic
352352
--model ollama/llama3 --api-base http://localhost:11434/v1 # Local (Ollama, vLLM, etc.)
353-
--model freetoken/Qwen3.6-35B-A3B # On-device via FreeToken
354353
```
355354

356-
**On-device via [FreeToken](https://github.com/FlashML-org/FreeToken)** runs fully
357-
local, no API key. Serve a model, then use the `freetoken/` prefix; the endpoint
358-
(`http://127.0.0.1:1919/v1`) and key are set for you:
359-
360-
```bash
361-
uv pip install "freetoken[accel]"
362-
ft serve --model Qwen3.6-35B-A3B # OpenAI-compatible server on 127.0.0.1:1919
363-
364-
uv run skydiscover-run initial_program.py evaluator.py \
365-
--model freetoken/Qwen3.6-35B-A3B --search evox --iterations 100
366-
```
367-
368-
Add `--api-base http://<host>:<port>/v1` if the server runs elsewhere.
369-
370355
Multi-model pools with weighted sampling are supported in config:
371356

372357
```yaml

docs/content/docs/getting-started/configuration.mdx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,8 @@ compatible model works:
1313
--model gemini/gemini-3-pro-preview # Google Gemini
1414
--model anthropic/claude-sonnet-4-6 # Anthropic
1515
--model ollama/llama3 --api-base http://localhost:11434/v1 # Local
16-
--model freetoken/Qwen3.6-35B-A3B # On-device via FreeToken
1716
```
1817

19-
On-device via [FreeToken](https://github.com/FlashML-org/FreeToken) runs fully local,
20-
no API key. Serve a model, then use the `freetoken/` prefix; the endpoint
21-
(`http://127.0.0.1:1919/v1`) and key are set for you:
22-
23-
```bash
24-
uv pip install "freetoken[accel]"
25-
ft serve --model Qwen3.6-35B-A3B # OpenAI-compatible server on 127.0.0.1:1919
26-
27-
uv run skydiscover-run initial_program.py evaluator.py \
28-
--model freetoken/Qwen3.6-35B-A3B --search evox --iterations 100
29-
```
30-
31-
Add `--api-base http://<host>:<port>/v1` if the server runs elsewhere.
32-
3318
## Pick an algorithm
3419

3520
| Algorithm | Flag | Best for |

skydiscover/config.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,8 @@
3434
"huggingface": (None, ["HF_TOKEN", "HUGGINGFACE_API_KEY"]),
3535
"ollama": (None, []),
3636
"vllm": (None, []),
37-
"freetoken": ("http://127.0.0.1:1919/v1", []),
3837
}
3938

40-
# Local OpenAI-compatible servers need no real key, but the OpenAI client still
41-
# requires a non-empty string, so keyless providers get a harmless placeholder.
42-
_LOCAL_PROVIDERS = frozenset({"ollama", "vllm", "freetoken"})
43-
_LOCAL_PLACEHOLDER_KEY = "EMPTY"
44-
4539
# Bare model-name prefixes → provider (backwards compat for --model gpt-5, etc.)
4640
_BARE_PREFIX_MAP: Dict[str, str] = {
4741
"gpt-": "openai",
@@ -84,21 +78,16 @@ def _parse_model_spec(model_str: str) -> tuple:
8478
return None, model_str, None, []
8579

8680

87-
def _resolve_api_key_from_env(
88-
env_vars: Optional[List[str]] = None, provider: Optional[str] = None
89-
) -> Optional[str]:
81+
def _resolve_api_key_from_env(env_vars: Optional[List[str]] = None) -> Optional[str]:
9082
"""Return the first API key found in *env_vars*.
9183
9284
*env_vars* typically comes from ``_parse_model_spec()``.
93-
Only returns a key if it matches the provider's own env vars. Keyless local
94-
providers fall back to a placeholder so the OpenAI client accepts them.
85+
Only returns a key if it matches the provider's own env vars.
9586
"""
9687
for var in env_vars or []:
9788
key = os.environ.get(var)
9889
if key:
9990
return key
100-
if provider in _LOCAL_PROVIDERS:
101-
return _LOCAL_PLACEHOLDER_KEY
10291
return None
10392

10493

@@ -212,7 +201,7 @@ def __post_init__(self):
212201
if provider_base and not (user_set_api_base and provider == "openai"):
213202
model.api_base = provider_base
214203
if model.api_key is None:
215-
model.api_key = _resolve_api_key_from_env(env_vars, provider)
204+
model.api_key = _resolve_api_key_from_env(env_vars)
216205
# Strip provider prefix so the API receives the bare model name
217206
if "/" in model.name and provider != "openai":
218207
model.name = bare_name
@@ -937,7 +926,7 @@ def apply_overrides(
937926
f"Provider '{provider}' requires an explicit api_base.\n"
938927
f"Example: model='{spec}', api_base='http://localhost:8000/v1'"
939928
)
940-
resolved_key = _resolve_api_key_from_env(env_vars, provider)
929+
resolved_key = _resolve_api_key_from_env(env_vars)
941930
models.append(
942931
LLMModelConfig(
943932
name=model_name,

tests/config/test_provider_defaults.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -192,44 +192,6 @@ def test_multi_provider_each_gets_own_endpoint(self):
192192
assert "anthropic.com" in cfg.models[2].api_base
193193

194194

195-
# ── FreeToken / keyless local providers ────────────────────────────
196-
197-
198-
class TestFreeTokenProvider:
199-
def test_parse_defaults_to_local_endpoint(self):
200-
provider, name, api_base, env_vars = _parse_model_spec("freetoken/Qwen3.6-35B-A3B")
201-
assert provider == "freetoken"
202-
assert name == "Qwen3.6-35B-A3B"
203-
assert api_base == "http://127.0.0.1:1919/v1"
204-
assert env_vars == []
205-
206-
def test_keyless_provider_gets_placeholder_key(self):
207-
assert _resolve_api_key_from_env([], "freetoken") == "EMPTY"
208-
assert _resolve_api_key_from_env([], "ollama") == "EMPTY"
209-
assert _resolve_api_key_from_env([], "vllm") == "EMPTY"
210-
211-
def test_unknown_provider_still_returns_none(self):
212-
assert _resolve_api_key_from_env([], None) is None
213-
assert _resolve_api_key_from_env([], "mycompany") is None
214-
215-
def test_config_works_with_no_env_or_flags(self):
216-
"""freetoken/<model> resolves endpoint, bare name, and placeholder key off-the-shelf."""
217-
env = os.environ.copy()
218-
env.pop("OPENAI_API_KEY", None)
219-
with patch.dict(os.environ, env, clear=True):
220-
cfg = LLMConfig(models=[LLMModelConfig(name="freetoken/Qwen3.6-35B-A3B")])
221-
model = cfg.models[0]
222-
assert model.name == "Qwen3.6-35B-A3B"
223-
assert model.api_base == "http://127.0.0.1:1919/v1"
224-
assert model.api_key == "EMPTY"
225-
226-
def test_custom_api_base_preserved(self):
227-
cfg = LLMConfig(
228-
models=[LLMModelConfig(name="freetoken/Qwen3.6-35B-A3B", api_base="http://gpu-box:9000/v1")],
229-
)
230-
assert cfg.models[0].api_base == "http://gpu-box:9000/v1"
231-
232-
233195
# ── MonitorConfig defaults ─────────────────────────────────────────
234196

235197

0 commit comments

Comments
 (0)