Repository navigation
v1.2.1
[1.2.1] - 2026-05-24
fix: provider compatibility — 7 bugs causing 400 errors on cloud/local LLMs
Comprehensive audit of LLM API integration surfaced seven genuine bugs that
would produce silent failures or HTTP 400 errors against specific providers.
All fixed and tested (83 unit tests + 11 E2E + inline triple-check
assertions).
-
Bug 1/4 —
model_client.jsalways sendstools: []— the module-based
chatCompletion(used byfeatures_adapter.jsfor MarrowScript cognition
calls) unconditionally setbody.tools = ctx.getAllTools(config). When
getAllToolsreturns[](e.g.,respondcategory or 2-stage routing
first pass), this sends"tools": []which OpenWebUI rejects with a 400.
Fixed: guarded withif (_tools && _tools.length > 0), matching the main
chatCompletioninbin/smallcode.js. -
Bug 2/5 —
thinking_budget.jsinjects unknown fields to Ollama/OpenAI —
body.thinkingwas sent to any local server running a reasoning model
(qwen3, o3-mini via Ollama). Ollama's/v1shim rejects unknown
top-level fields.chat_template_kwargsandenable_thinkingare
llama.cpp-only; Ollama also rejects them. Fixed:body.thinkingnow
ONLY sent to Anthropic;chat_template_kwargsonly to llama.cpp/LM Studio
(detected by excluding known cloud providers AND Ollama port 11434).
reasoning_effortrestricted to OpenAI cloud and OpenRouter only. -
Bug 3 —
max_tokensnot renamed for OpenAI reasoning models — OpenAI
o1/o3/o4 requiremax_completion_tokens.max_tokensis silently ignored,
causing potentially truncated output. Fixed: afterapplyThinkingBudget,
reasoning models on OpenAI cloud or OpenRouter get
body.max_completion_tokens = body.max_tokens; delete body.max_tokens. -
Bug 7 — Auth header priority picks the wrong API key —
buildAuthHeaders
used a flat fallback chain (OPENAI_API_KEY || ANTHROPIC_API_KEY || DEEPSEEK_API_KEY). If a user had both keys set (common with escalation
configured) and theirbaseUrlpointed at DeepSeek, the OpenAI key was
sent to DeepSeek → auth failure. Fixed: provider-aware routing based on
baseUrl— DeepSeek URLs getDEEPSEEK_API_KEY, OpenAI gets
OPENAI_API_KEY, OpenRouter getsOPENROUTER_API_KEY, local servers get
SMALLCODE_API_KEY(new) as first choice. Three inline auth blocks in
bin/smallcode.jsreplaced with calls to the centralised
buildAuthHeaders(config).
Also fixed three previously untracked issues (#43, #44, #45) — see changelog
entry above for details.
Verification
- 83/83 unit tests pass (
npm test) — 70 prior + 13 new in
test/provider_compat.test.js - 11/11 E2E checks pass (
npm run test:e2e) against
huihui-gemma-4-e4b-it-abliteratedonhttp://10.0.0.20:1234/v1 - Inline triple-check assertions for auth routing, thinking-budget
isolation (Ollama, OpenAI, LM Studio), and max_completion_tokens rename
[1.2.1] - 2026-05-24
fix: ollama base URL auto-/v1, install-doc branch, fewer deprecation warnings
Three reported issues closed (#43, #44, #45).
- Issue #44 —
Cannot reach endpoint at http://localhost:11434— Ollama
exposes its OpenAI-compatible route at/v1, butbin/config.jswas sending
${baseUrl}/modelsagainst the bare host whenprovider=openai(the
default). NewnormalizeBaseUrl()auto-appends/v1for known
OpenAI-compatible local ports (11434 Ollama, 1234 LM Studio, 8080
llama.cpp) when the URL has no path. URLs that already contain/v1or
/api/are left alone so existing setups don't break. TheCannot reach endpointerror message now also suggests${baseUrl}/v1on a 404 when
the URL has no/v1. - Issue #45 — README install URLs use
/main— both the Linux/macOS and
Windows one-liners pointed atraw.githubusercontent.com/.../main/...,
but the default branch ismaster. Updated both. Reported by @aaronjmars
(community fix). - Issue #43 —
npm install -gdeprecation warnings — moved
playwright-extraandpuppeteer-extra-plugin-stealthfrom
optionalDependenciestopeerDependencieswith
peerDependenciesMeta.optional, so a default install no longer pulls
the deprecatedrimraf@3 → glob@7 → inflight@1chain. Users who want
web browsing runnpm install -g playwright-extra puppeteer-extra-plugin-stealththemselves; the lazy-require in
src/tools/builtin/web_browse.jsalready falls back to plainfetch
when they're absent. The remainingprebuild-installdeprecation comes
frombetter-sqlite3(transitive ofbudget-aware-mcp) and is upstream
— kept on the optional path since SmallCode falls back to JSON-backed
memory when SQLite isn't available.
Verification
- 6/6 new
normalizeBaseUrlunit tests intest/config_normalize.test.js - Existing 60 tests still pass (
npm test) npm install -g smallcode@1.2.1 --dry-runproduces 1 warning
(prebuild-install, transitive of optionalbudget-aware-mcp) instead
of 4