Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

Model servers on this network get the thinking vocabulary of a local model (the Reasoning menu did nothing for them); effort and sampling drivers

Niko12212b54cf4fbdb2
diff --git a/apps/host/scripts/agent-http.mjs b/apps/host/scripts/agent-http.mjs
index 6e75e2a7c..cdafa03e8 100644
--- a/apps/host/scripts/agent-http.mjs
+++ b/apps/host/scripts/agent-http.mjs
@@ -196,7 +196,7 @@ ${filler(n)}`}, { quiet: true });
// The same question at each reasoning level (and optional thinking budget): what really changes is the thinking the model did.
const [question = 'What is 17 times 23, and is the result divisible by 3? Explain briefly.', budget = '0'] = rest;
const rows = [];
- for (const level of ['Off', 'Low', 'Medium', 'High', 'Max']) {
+ for (const level of (process.env.LEVELS ? process.env.LEVELS.split(',') : ['Off', 'Low', 'Medium', 'High', 'Max'])) {
const t = Date.now();
const frames = await stream({ sessionId: `ef-${level}-${Date.now()}`, message: question, mode: 'bypass', remoteModel: await model(), thinking: level, thinkingBudget: Number(budget), agent: process.env.PLAIN ? false : undefined }, { quiet: true });
const reasoning = frames.filter(x => x.type === 'reasoning').map(x => x.text ?? '').join('').length;
diff --git a/apps/host/server/agent/profile.mjs b/apps/host/server/agent/profile.mjs
index 4afda2c58..c6b2d0b0b 100644
--- a/apps/host/server/agent/profile.mjs
+++ b/apps/host/server/agent/profile.mjs
@@ -151,6 +151,9 @@ export function outputBudget(context, maxOutput = null) {
* @param {Array<{id:string,name:string,baseUrl:string,protocol:string,apiKey?:string,models:Array<{id:string,name?:string,contextMax?:number|null}>}>} input.connections
* @returns {{patch:string, env:Record<string,string>, routes:Array, defaultRoute:object|null, signature:string}}
*/
+/** What a local model, or an OpenAI-style server on this network, takes for the thinking level (see the comment where a local route is built). */
+const THINKING_COMPAT = { supportsStore: false, thinkingFormat: 'chat-template', chatTemplateKwargs: { enable_thinking: { $var: 'thinking.enabled' }, reasoning_effort: { $var: 'thinking.effort', omitWhenOff: true } } };
+
export function buildProfile({ local = [], connections = [], gate = true, tools = NO_TOOLS_SETTINGS, skillsDir = null, proxyBase = null }) {
const providers = {};
const env = {};
@@ -189,7 +192,7 @@ export function buildProfile({ local = [], connections = [], gate = true, tools
apiKeyEnv: keyEnv,
// The Strata server reads the thinking level from `chat_template_kwargs` (enable_thinking, reasoning_effort) or from a top-level
// reasoning_effort; a top-level `enable_thinking` (pi-ai's `qwen` format) is ignored, so the model went on thinking with the menu on Off.
- compat: { supportsStore: false, thinkingFormat: 'chat-template', chatTemplateKwargs: { enable_thinking: { $var: 'thinking.enabled' }, reasoning_effort: { $var: 'thinking.effort', omitWhenOff: true } } },
+ compat: THINKING_COMPAT,
models: [{
id: inst.modelId, name: inst.label || inst.modelId, contextWindow: context, maxTokens: localOutputBudget(context),
input: inst.vision ? ['text', 'image'] : ['text'],
@@ -214,19 +217,24 @@ export function buildProfile({ local = [], connections = [], gate = true, tools
else if (keyless) env[keyEnv] = 'not-needed';
let baseURL = conn.baseUrl;
if (protocol === 'anthropic-messages') baseURL = baseURL.replace(/\/v1\/?$/, '');
+ // A model server on this computer or network (another Strata PC, llama.cpp, LM Studio) takes the same thinking vocabulary as a local model:
+ // without it the Reasoning menu did nothing for a connection to another Strata machine.
+ const ownServer = protocol === 'openai-completions' && isPrivateHost(baseURL);
providers[route] = {
displayName: conn.name,
api: protocol,
baseURL,
...(conn.apiKey || keyless ? { apiKeyEnv: keyEnv } : {}),
+ ...(ownServer ? { compat: THINKING_COMPAT } : {}),
models: conn.models.map(m => ({
id: m.id, name: m.name || m.id,
contextWindow: m.contextMax ?? ASSUMED_API_CONTEXT, maxTokens: outputBudget(m.contextMax ?? ASSUMED_API_CONTEXT, m.maxOutput),
input: ['text'],
+ ...(ownServer ? { reasoning: true, reasoningEfforts: LOCAL_EFFORTS } : {}),
})),
};
const fp = fingerprint(providers[route], conn.apiKey ?? '');
- const shaped = protocol === 'openai-completions' && isPrivateHost(baseURL) ? addShaped(route, providers[route], baseURL) : null;
+ const shaped = ownServer ? addShaped(route, providers[route], baseURL) : null;
for (const m of conn.models) { const ctx = m.contextMax ?? ASSUMED_API_CONTEXT; compaction.push({ provider: route, model: m.id, headroomTokens: compactionHeadroom(ctx, outputBudget(ctx, m.maxOutput)) }); }
for (const m of conn.models) routes.push({ route, fp, kind: 'api', connectionId: conn.id, modelId: m.id, name: m.name || m.id, contextWindow: m.contextMax ?? ASSUMED_API_CONTEXT, ...(shaped ? { shaped } : {}) });
});
diff --git a/apps/host/tests/agent-shape.test.mjs b/apps/host/tests/agent-shape.test.mjs
index b97e6826b..cc2e70af8 100644
--- a/apps/host/tests/agent-shape.test.mjs
+++ b/apps/host/tests/agent-shape.test.mjs
@@ -49,6 +49,11 @@ test('the profile adds a response-settings copy of each shapeable route (local,
assert.deepEqual(Object.keys(profile.shapeTargets).sort(), [...Object.values(local.shaped), ...Object.values(profile.routes.find(r => r.connectionId === 'lan').shaped)].sort());
assert.equal(profile.shapeTargets['strata-local~s0'], 'http://127.0.0.1:9001');
assert.equal(profile.routes.find(r => r.connectionId === 'cloud').shaped, undefined);
+ const doc = JSON.parse(profile.patch.slice(profile.patch.indexOf('[')));
+ const providers = doc.find(e => e.id === 'llm-pi-ai').config.providers;
+ assert.equal(providers['api-lan'].compat.thinkingFormat, 'chat-template', 'a model server on this network gets the thinking vocabulary of a local model');
+ assert.equal(providers['api-lan'].models[0].reasoning, true);
+ assert.equal(providers['api-cloud'].compat, undefined, 'a cloud service does not');
assert.match(profile.patch, /"baseURL": "http:\/\/127\.0\.0\.1:8791\/api\/internal\/agent-llm\/strata-local~s8192\/v1"/);
assert.match(profile.patch, /"x-strata-budget": "8192"/);
assert.match(profile.patch, /"provider": "strata-local~s8192"/, 'compaction keeps its timing on the copy too');