Repository navigation
Releases
v0.4.1
What's Changed
Action required if you use these features
executecodeis now disabled by default (#337, #302). The plugin runs Python from requests and LLM responses with no sandboxing. To keep using it, start optillm with--enable-unsafe-plugins=executecodeor setOPTILLM_ENABLE_UNSAFE_PLUGINS=executecode. Only enable it in single-user, air-gapped environments.- MCP secrets could be written to logs. The MCP plugin wrote configured
envandheadersvalues, which can include API keys, to~/.optillm/logs/mcp_plugin.log. It now logs only the names. If you use the plugin, check that file for old secrets and rotate any you find.
New
- Streaming hints plugin (#352, #206):
streaming_hintswatches the model's reasoning as it is generated and injects relevant hints from a memory bank at moments of uncertainty. - Legacy completions endpoint: the inbuilt inference server now exposes
POST /v1/completions. - LLM gateway guide:
docs/llm-gateway.mdcovers using the proxy plugin for routing and inference optimization together.
Security
readurls: blocks SSRF destinations, including CGNAT/shared and multicast ranges.z3: statically gates solver code to the declared z3/sympy subset and closes string-based evasions of the AST attribute denylist.
Fixes
max_completion_tokens(#350): pass-through and proxy requests no longer addmax_tokens, which o-series and gpt-5 models reject with a 400. The local inference server now honorsmax_completion_tokens.mcts: follows tree selection through to a leaf.mars: populates diverse aggregation groups, preserves full agent IDs when applying verification, and matches solution authors across string and integer IDs.bon: excludes truncated and blank candidates.rstar: backpropagates rewards from evaluated rollout nodes and preserves signed and decimal answers.deepconf: votes and calibrates as in the DeepConf reference implementation.entropy_decoding: keeps the nucleus head and appliesmin_pin sampling.
Project
- CI now runs every test file, and MCP tests run on pull requests.
- The README has been streamlined.
Thanks to Parman Mohammadalizadeh, akushonkamen, ZY Liu, flyingdoubleG, and Daniel Peng for their contributions.
Full Changelog: v0.4.0...v0.4.1
v0.4.0
What's Changed
Fix: proxy plugin config, logging and agent clients (#330, #331)
- Proxy target ignored: without
~/.optillm/proxy_config.yaml, the proxy silently loaded the bundled example config and routed to its sample providers. It now creates an empty template instead. A single failed request no longer sends all later traffic to--base-url: 4xx errors don't mark a provider unhealthy, and unhealthy providers are retried before falling back. /v1/modelslists the configured providers' models (plusmodel_mapaliases) with--approach proxy.- Agent clients (e.g. Crush): the
noneand proxy approaches now forward the original conversation, includingtool_callsand tool results, instead of flattening it. Streamed responses carry tool calls, finish reason and usage.stream_optionsis no longer forwarded upstream, and messages withcontent: nullno longer crash parsing. - Logging:
--log/OPTILLM_LOGnow apply to all modules and are case-insensitive, so DEBUG logs from the proxy and other plugins show up.
MCP plugin ported to mcp 2.x
- Works with the MCP Python SDK 2.x (
MCPError, snake_case result fields). - New
streamable_httptransport, with headers and timeouts.
Breaking changes
- MCP
websockettransport removed (dropped from the MCP Python SDK in 2.x). Configs using"transport": "websocket"must switch tostreamable_httporsse. - Requires
mcp>=2,<3. Environments that also needmcp<2won't install. - The proxy no longer loads the bundled
example_config.yamlwhen~/.optillm/proxy_config.yamlis missing. Requests use the server's default client (--base-url) until you add providers. OPTILLM_LOG_LEVELremoved. Use--log/OPTILLM_LOG;monitoring.log_levelin the proxy config is an optional proxy-only override.
Thanks to @brettowe for the detailed report.
Full Changelog: v0.3.22...v0.4.0
v0.3.22
What's Changed
Fix: autothink, thinkdeeper and deepconf for transformers >= 5 (#320)
Since transformers 5, apply_chat_template(return_tensors="pt") returns a BatchEncoding rather than a plain tensor, so passing the result straight to model(input_ids=...) raised. The tensor is now unwrapped via .input_ids:
optillm/thinkdeeper.pyoptillm/autothink/processor.pyoptillm/deepconf/processor.py
The unwrap is chained with the existing device transfer (.input_ids.to(self.model.device)) so tokens still land on the model's device — Tensor.to() returns a new tensor rather than mutating in place, so the assignment matters on CUDA/MPS.
Thanks to @jacquerie for diagnosing and reporting this.
README: dropped the GitHub stars badge and switched the downloads badge to pepy.tech, which reports actual download counts.
Full Changelog: v0.3.21...v0.3.22
v0.3.21
What's Changed
Fix: broken PyPI wheel — import optillm failed with ModuleNotFoundError: No module named 'math_verify' (#318)
The published wheel is built from pyproject.toml [project.dependencies], which had drifted from requirements.txt, so pip install optillm shipped a package that couldn't even start:
math-verifywas missing frompyproject.toml—optillm/cepo/cepo.pyimports it at import time, so importing optillm crashed. (Affected 0.3.16–0.3.20.)transformerswas unpinned — the<5.13.0cap added in 0.3.19 only landed inrequirements.txt, so PyPI installs pulled transformers 5.13.0 and broke mlx-lm on Apple silicon.
Fix
Synced the runtime deps into pyproject.toml: added math-verify, pinned transformers>=5.0.0,<5.13.0, and outlines[transformers]>=1.2.3.
Verified by building the wheel and installing it into a clean venv (only its declared deps) — import optillm succeeds and transformers resolves to 5.12.x.
If you hit the math_verify import error on 0.3.16–0.3.20, upgrade to 0.3.21.
Full Changelog: v0.3.20...v0.3.21
v0.3.20
What's Changed
Fix: runaway local generation for models whose ChatML end token differs from their tokenizer EOS (#317)
Running such a model through optillm's built-in local inference never stopped early and generated the full max_new_tokens default (4096) on every call that omitted max_tokens — e.g. dhara-250m's chat ends at <|im_end|> (49154) but its tokenizer eos_token is <|end_of_text|> (1), so it rambled ~800s/call.
- Honor
generation_config.eos_token_id: generation now resolves EOS from the model's own generation config (merging the tokenizer EOS as a fallback) instead of hardcodingtokenizer.eos_token_id. Fixes any chat model with this mismatch; well-behaved models (e.g. Qwen2.5, whose tokenizer EOS already is<|im_end|>) are unchanged. OPTILLM_MAX_TOKENS: new env var to override the defaultmax_new_tokens(default stays 4096), bounding any request that sends nomax_tokens. An explicit requestmax_tokensstill takes precedence. Useful for small models that don't reliably emit an EOS token.
Only the local inference engine (OPTILLM_API_KEY=optillm) is affected; proxied providers handle stopping themselves. Includes unit tests for both helpers.
Full Changelog: v0.3.19...v0.3.20
v0.3.19
What's Changed
Fix: import optillm crash on macOS with transformers 5.13 (#316)
A fresh install on Apple silicon crashed with AttributeError: 'str' object has no attribute '__module__' at import optillm.
- Root cause: transformers 5.13.0 tightened
AutoTokenizer.register()to require a class, butmlx-lm0.31.3 registers a custom tokenizer by string name (tokenizer_utils.py: AutoTokenizer.register("NewlineTokenizer", ...)). transformers ≤5.12.1 tolerated it. - macOS-only: optillm installs
mlx-lmonly on Apple silicon (platform_machine=="arm64" and sys_platform=="darwin"); Linux CI never installs it, so CI was unaffected. - Fix: pin
transformers>=5.0.0,<5.13.0(resolves to 5.12.1). The transformers 5.13.0 HF path itself is fine (dhara loads and generates); the incompatibility is purely mlx-lm's. Lift the cap once mlx-lm ships a transformers-5.13-compatible release.
Full Changelog: v0.3.18...v0.3.19
v0.3.18
What's Changed
Opt-in file persistence for the memory plugin (#111, #315)
The memory plugin can now persist extracted memories across requests. Set OPTILLM_MEMORY_FILE to a path to opt in; when unset, behaviour is byte-for-byte unchanged (in-RAM, reset per request).
- Loads any previously saved items on init and writes after every
add(). - Atomic writes (temp file +
os.replace) so a crash mid-write can't corrupt the store. - A missing/corrupt/non-list file degrades gracefully to an empty store — persistence can never fail a request. Loaded items are filtered to strings and bounded by
max_size.
CI: Frame SAST scan of PR-changed files
Added a Security Scan (Frame SAST) workflow that runs the Frame neuro-symbolic SAST tool (pinned) on the Python files changed by each pull request. Scanning only changed files surfaces newly introduced issues without failing on pre-existing findings; the job fails only on high/critical severity.
Full Changelog: v0.3.17...v0.3.18
v0.3.17
What's Changed
Fix: MCTS parameters are now request-scoped (#304, #314)
proxy() previously wrote each request's mcts_depth / mcts_exploration / mcts_simulations into the module-level server_config, and execute_single_approach() read them back out of that same global. Under any threaded WSGI server (Flask's default threaded mode, gunicorn, uWSGI, Hypercorn), two concurrent requests raced on that global — request B could overwrite request A's params between A's write and A's read, silently running A's MCTS with B's settings. The write also leaked one request's params into every later request.
MCTS params now flow through the per-request request_config (with the server/CLI defaults as fallback), consistent with every other approach parameter. Behaviour is unchanged for all callers; the shared global is no longer mutated per request, so there is nothing left to race on.
Includes regression tests covering both the per-request read path and the proxy no-mutation guarantee.
Full Changelog: v0.3.16...v0.3.17
v0.3.16
What's Changed
- Guard against empty/None/truncated provider responses in rto, self_consistency, reread, leap by @SuperMarioYL in #311
New Contributors
- @SuperMarioYL made their first contribution in #311
Full Changelog: v0.3.15...v0.3.16