Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(context): C77 let an API model without server metadata take the user's window

purpleeea5c2ed8b28
diff --git a/src/components/chat/ContextDropdown.tsx b/src/components/chat/ContextDropdown.tsx
index 644bbdea..a8cb85be 100644
--- a/src/components/chat/ContextDropdown.tsx
+++ b/src/components/chat/ContextDropdown.tsx
@@ -22,6 +22,8 @@ import { savedLmStudioContext, withLmStudioPick } from '../../lib/lmstudio-conte
import { usePopoverPlatz } from '../../hooks/usePopoverPlatz'
const PRESETS = [4096, 8192, 16384, 32768, 65536, 131072]
+/** C77: what a hosted model's own window commonly is. */
+const MODEL_WINDOW_PRESETS = [8192, 16384, 32768, 65536, 131072, 262144, 1048576]
/**
* Context-window picker for the active LOCAL model. Sets `contextWindowOverride`
@@ -140,6 +142,8 @@ export function ContextDropdown({ children }: { children?: ReactNode }) {
// der `TokenCounter` `null` zurueckgibt. Bewusst ein BOOLEAN als Selektor:
// ein Abo auf `s.conversations` wuerde diesen Knopf bei jedem Streaming-Flush
// neu rendern (T-45), ein Boolean wechselt einmal pro Chat.
+ // C77: the model window the user gave a hosted API that names none.
+ const modelWindowPick = ctx.modelWindowKey ? byModel?.[ctx.modelWindowKey] ?? 0 : 0
const hasFill = useChatStore(
(s) => (s.conversations.find((c) => c.id === s.activeConversationId)?.messages.length ?? 0) > 0,
)
@@ -184,6 +188,20 @@ export function ContextDropdown({ children }: { children?: ReactNode }) {
*/
const selectedNow = (ctx.clampedFrom ?? 0) > 0 ? ctx.contextWindow : selected
+ /*
+ * C77: the hosted API named no window, so this is what the model has, said
+ * by the user. Saved per endpoint and model; the provider's cascade reads
+ * it for the counter, the send window and the request budget. 0 = Auto.
+ */
+ const applyModelWindow = (value: number) => {
+ setOpen(false)
+ if (!ctx.modelWindowKey) return
+ const current = useSettingsStore.getState().settings.contextWindowByModel
+ updateSettings({ contextWindowByModel: withStoredWindow(current, ctx.modelWindowKey, value) })
+ setTick((t) => t + 1)
+ window.dispatchEvent(new Event('lu-context-reloaded'))
+ }
+
const apply = async (value: number) => {
setOpen(false)
/*
@@ -289,7 +307,7 @@ export function ContextDropdown({ children }: { children?: ReactNode }) {
disabled={busy}
title={
cloud
- ? 'Context sent per step: how much of this chat the model sees on every step. More remembers more and costs more per step.'
+ ? `Context sent per step: how much of this chat the model sees on every step. More remembers more and costs more per step.${ctx.modelWindow ? ` Model context window: ${formatContextWindow(ctx.modelWindow)}, ${SOURCE_LABEL[ctx.modelWindowSource ?? ctx.source]}.` : ''}`
: ctx.provider === 'custom'
? `Context window: ${SOURCE_LABEL[ctx.source]}. This server decides its own context; pick the value it actually runs with so the counter and the request budget match it.`
: `Context window: ${ctx.provider === 'lmstudio' ? "LM Studio's loaded context" : ctx.provider === 'builtin' ? "the LU Engine's loaded context" : 'Ollama num_ctx'}. Changing it reloads the model so it takes effect now.`
@@ -360,6 +378,10 @@ export function ContextDropdown({ children }: { children?: ReactNode }) {
platz.nachOben ? 'bottom-full mb-1' : 'top-full mt-1'
}`}
>
+ {(!cloud || ctx.sendAdjustable !== false) && (<>
+ {cloud && ctx.modelWindowSettable && (
+ <div className="px-2 pt-0.5 text-[0.5rem] uppercase tracking-wide text-gray-400">Sent per message</div>
+ )}
<button onClick={() => apply(0)} className={rowCls(selectedNow === 0)}>
<span>Auto{ctx.provider === 'ollama' ? ` · ${formatContextWindow(ctx.autoWindow ?? ollamaWindowFor(windowUse, ctx.modelMax))}` : ctx.provider === 'builtin' ? ` · ${formatContextWindow(ENGINE_DEFAULT_CTX)}` : ctx.provider === 'custom' && ctx.source !== 'user' ? ` · ${formatContextWindow(ctx.contextWindow)}` : cloud ? ` · ${formatContextWindow(globalSendWindow)}` : ''}</span>
{selectedNow === 0 && <Check size={10} />}
@@ -376,6 +398,25 @@ export function ContextDropdown({ children }: { children?: ReactNode }) {
{selectedNow === ctx.modelMax && <Check size={10} />}
</button>
)}
+ </>)}
+ {cloud && ctx.modelWindowSettable && (
+ <div data-testid="context-model-window" className="flex flex-col gap-0.5">
+ <div className={`px-2 pt-1 ${ctx.sendAdjustable !== false ? 'mt-0.5 border-t border-gray-100 dark:border-white/[0.06]' : ''} text-[0.5rem] uppercase tracking-wide text-gray-400`}>Model context window</div>
+ <button onClick={() => applyModelWindow(0)} className={rowCls(modelWindowPick === 0)}>
+ <span>Auto{modelWindowPick === 0 && ctx.modelWindow ? ` · ${formatContextWindow(ctx.modelWindow)}` : ''}</span>
+ {modelWindowPick === 0 && <Check size={10} />}
+ </button>
+ {[...new Set([...MODEL_WINDOW_PRESETS, ...(modelWindowPick > 0 ? [modelWindowPick] : [])])].sort((a, b) => a - b).map((p) => (
+ <button key={`m${p}`} onClick={() => applyModelWindow(p)} className={rowCls(modelWindowPick === p)}>
+ <span>{formatContextWindow(p)}</span>
+ {modelWindowPick === p && <Check size={10} />}
+ </button>
+ ))}
+ <div className="px-2 pt-0.5 text-[0.5rem] text-gray-400 leading-snug max-w-[220px]">
+ {`Now ${formatContextWindow(ctx.modelWindow ?? 0)}, ${SOURCE_LABEL[ctx.modelWindowSource ?? 'guess']}. This API does not report the model's context window, so LU cannot check it. Pick the window its documentation names. Saved for this model.`}
+ </div>
+ </div>
+ )}
{cpuNote && cpuNote.model === ollamaModel && (
<div
data-testid="context-cpu-note"
@@ -385,11 +426,11 @@ export function ContextDropdown({ children }: { children?: ReactNode }) {
<span>{cpuNote.text}</span>
</div>
)}
- <div className="mt-0.5 px-2 pt-1 border-t border-gray-100 dark:border-white/[0.06] text-[0.5rem] text-gray-400 leading-snug">
+ {!(cloud && ctx.sendAdjustable === false) && <div className="mt-0.5 px-2 pt-1 border-t border-gray-100 dark:border-white/[0.06] text-[0.5rem] text-gray-400 leading-snug">
{raised
? <span className="flex items-start gap-1"><AlertTriangle size={9} className="shrink-0 mt-px" />Once the chat is longer than {formatContextWindow(DEFAULT_SEND_WINDOW_TOKENS)}, every message sends more and costs more credits.</span>
: cloud
- ? 'How much of the chat each message sends. Saved for this model.'
+ ? `How much of the chat each message sends. Saved for this model.${ctx.modelWindow && !ctx.modelWindowSettable ? ` Model window ${formatContextWindow(ctx.modelWindow)}, ${SOURCE_LABEL[ctx.modelWindowSource ?? ctx.source]}.` : ''}`
: unknownMax
? "This server did not report the model's context length, so LU cannot check these sizes. Pick the size the server runs with. Reloads the model on change."
: ctx.provider !== 'custom'
@@ -397,7 +438,7 @@ export function ContextDropdown({ children }: { children?: ReactNode }) {
: (ctx.clampedFrom ?? 0) > 0
? `Your saved ${formatContextWindow(ctx.clampedFrom ?? 0)} is more than this server runs, so ${formatContextWindow(ctx.contextWindow)} is used. Start the server larger to use it.`
: `Current value ${SOURCE_LABEL[ctx.source]}. Your pick is saved for this model on this server.`}
- </div>
+ </div>}
</div>
</>
)}
diff --git a/src/components/chat/__tests__/c77-api-model-window-picker.test.tsx b/src/components/chat/__tests__/c77-api-model-window-picker.test.tsx
new file mode 100644
index 00000000..310afc12
--- /dev/null
+++ b/src/components/chat/__tests__/c77-api-model-window-picker.test.tsx
@@ -0,0 +1,81 @@
+// @vitest-environment jsdom
+/**
+ * C77: the context button of an API model whose server names no window lets
+ * the user set the model window and says where the number comes from.
+ *
+ * Run: npx vitest run src/components/chat/__tests__/c77-api-model-window-picker.test.tsx
+ */
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+import type { ActiveContext } from '../../../hooks/useActiveContextWindow'
+
+let ctx: ActiveContext
+
+vi.mock('../../../hooks/useActiveContextWindow', () => ({
+ useActiveContextWindow: () => ctx,
+ useActiveWindowUse: () => 'chat',
+}))
+
+import { ContextDropdown } from '../ContextDropdown'
+import { useModelStore } from '../../../stores/modelStore'
+import { useSettingsStore } from '../../../stores/settingsStore'
+
+const KEY = 'https://api.example-llm.test/v1|vendor/brand-new-model-x'
+
+function apiModel(overrides: Partial<ActiveContext> = {}): ActiveContext {
+ return {
+ provider: 'cloud', contextWindow: 8192, modelMax: 8192, sendWindow: 6553, isTrue: false,
+ adjustable: true, sendAdjustable: true, source: 'guess', windowKey: 'openai:x::vendor/brand-new-model-x',
+ modelWindow: 8192, modelWindowSource: 'guess', modelWindowSettable: true, modelWindowKey: KEY,
+ ...overrides,
+ }
+}
+
+beforeEach(() => {
+ cleanup()
+ ctx = apiModel()
+ useModelStore.setState({ activeModel: 'openai:x::vendor/brand-new-model-x' })
+ useSettingsStore.getState().updateSettings({ contextWindowByModel: {}, cloudSendWindowByModel: {}, contextDecay: true })
+})
+
+describe('C77: the model window of an API model', () => {
+ it('names the source in the button and offers the model window', () => {
+ render(<ContextDropdown />)
+ const button = screen.getByRole('button', { name: /^Context window/ })
+ expect(button.getAttribute('title')).toMatch(/Model context window: 8K, estimated\./)
+ fireEvent.click(button)
+ const section = screen.getByTestId('context-model-window')
+ expect(section.textContent).toMatch(/Model context window/)
+ expect(section.textContent).toMatch(/Now 8K, estimated\. This API does not report the model's context window/)
+ // The send window list is still there, with its own heading.
+ expect(screen.getByText('Sent per message')).toBeTruthy()
+ })
+
+ it('a pick is saved for this model under its endpoint key', () => {
+ render(<ContextDropdown />)
+ fireEvent.click(screen.getByRole('button', { name: /^Context window/ }))
+ const section = screen.getByTestId('context-model-window')
+ const rows = Array.from(section.querySelectorAll('button'))
+ const k128 = rows.find((b) => b.textContent?.trim() === '128K')!
+ fireEvent.click(k128)
+ expect(useSettingsStore.getState().settings.contextWindowByModel?.[KEY]).toBe(131072)
+ // The send window was not touched.
+ expect(useSettingsStore.getState().settings.cloudSendWindowByModel).toEqual({})
+ })
+
+ it('with the user value it says "set by you"', () => {
+ ctx = apiModel({ modelWindow: 131072, modelWindowSource: 'user', contextWindow: 131072, modelMax: 131072 })
+ useSettingsStore.getState().updateSettings({ contextWindowByModel: { [KEY]: 131072 } })
+ render(<ContextDropdown />)
+ const button = screen.getByRole('button', { name: /^Context window/ })
+ expect(button.getAttribute('title')).toMatch(/Model context window: 128K, set by you\./)
+ })
+
+ it('a server that names its window keeps the old picker, with the source said', () => {
+ ctx = apiModel({ modelWindowSettable: undefined, modelWindowKey: undefined, modelWindow: 262144, modelWindowSource: 'probe', contextWindow: 262144, modelMax: 262144 })
+ render(<ContextDropdown />)
+ fireEvent.click(screen.getByRole('button', { name: /^Context window/ }))
+ expect(screen.queryByTestId('context-model-window')).toBeNull()
+ expect(screen.getByText(/Model window 256K, from server\./)).toBeTruthy()
+ })
+})
diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsx
index 01a6be23..5e0b25ed 100644
--- a/src/components/settings/SettingsPage.tsx
+++ b/src/components/settings/SettingsPage.tsx
@@ -2114,7 +2114,7 @@ export function SettingsPage() {
clips RAG / long chats). Bump up to use the model's full
context window. Ignored by Anthropic / OpenAI providers. */}
<div className="flex items-center justify-between">
- <span className="t-micro text-gray-700 dark:text-gray-400" title="Forwarded as Ollama num_ctx. 0 = provider default (Ollama defaults to 2048, which clips RAG and long chats). Bump up to use the model's full context. Ignored by cloud providers.">Context window (Ollama)</span>
+ <span className="t-micro text-gray-700 dark:text-gray-400" title="Forwarded as Ollama num_ctx. 0 = provider default (Ollama defaults to 2048, which clips RAG and long chats). Bump up to use the model's full context. Ignored by cloud providers: for an API model whose server reports no window, set it from the context button in the chat.">Context window (Ollama)</span>
<BoundedNumberInput
ariaLabel="Context window (Ollama)"
value={settings.contextWindowOverride ?? 0}
diff --git a/src/hooks/__tests__/c77-api-model-window.test.ts b/src/hooks/__tests__/c77-api-model-window.test.ts
new file mode 100644
index 00000000..85674602
--- /dev/null
+++ b/src/hooks/__tests__/c77-api-model-window.test.ts
@@ -0,0 +1,124 @@
+// @vitest-environment jsdom
+/**
+ * C77 (redapplevi, Discord 11.11.2026): an API model on an OpenAI-compatible
+ * endpoint got a context window of 8192 because the API names none, and
+ * nothing could change it ("Context window (Ollama)" is Ollama's, and the
+ * picker of a paid model sets only the send window).
+ *
+ * Now the user's value for that model is used, and where the number comes
+ * from is said.
+ *
+ * Run: npx vitest run src/hooks/__tests__/c77-api-model-window.test.ts
+ */
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+
+const seen: { url: string; body?: Record<string, unknown> }[] = []
+
+vi.mock('../../api/backend', async () => {
+ const lan = (host: string) => /^(127\.|localhost$|\[?::1\]?$|10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(host)
+ const answer = async (input: RequestInfo | URL, init?: RequestInit) => {
+ const url = String(input)
+ seen.push({ url, body: init?.body ? JSON.parse(String(init.body)) : undefined })
+ if (url === 'http://192.168.1.20:5001/api/extra/true_max_context_length') {
+ return new Response(JSON.stringify({ value: 32768 }))
+ }
+ if (url === 'http://192.168.1.21:8080/props') {
+ return new Response(JSON.stringify({ default_generation_settings: { n_ctx: 65536 } }))
+ }
+ if (url.endsWith('/chat/completions')) {
+ return new Response(
+ `data: ${JSON.stringify({ choices: [{ delta: { content: 'ok' } }] })}\n\ndata: [DONE]\n\n`,
+ { headers: { 'Content-Type': 'text/event-stream' } },
+ )
+ }
+ return new Response('{}', { status: 404 })
+ }
+ return {
+ localFetch: vi.fn(answer),
+ localFetchStream: vi.fn(answer),
+ isPrivateOrLanHost: lan,
+ hostnameOf: (url: string) => { try { return new URL(url).hostname } catch { return '' } },
+ isDirectFetchAllowed: () => false,
+ ensureProxyAllowsHost: vi.fn(async () => {}),
+ backendCall: vi.fn(async () => { throw new Error('no backend in this test') }),
+ isTauri: () => false,
+ isOllamaLocal: () => true,
+ secretGet: vi.fn(async () => { throw new Error('no keychain here') }),
+ secretSet: vi.fn(async () => { throw new Error('no keychain here') }),
+ secretDelete: vi.fn(async () => { throw new Error('no keychain here') }),
+ secretParkGet: vi.fn(async () => { throw new Error('no keychain here') }),
+ secretParkSet: vi.fn(async () => { throw new Error('no keychain here') }),
+ secretParkDelete: vi.fn(async () => { throw new Error('no keychain here') }),
+ }
+})
+// This machine's LM Studio has a model of the same name, loaded small.
+vi.mock('../../api/lmstudio', async () => {
+ const actual = await vi.importActual<typeof import('../../api/lmstudio')>('../../api/lmstudio')
+ return { ...actual, getLmStudioModelContext: vi.fn(async () => ({ loaded: 4096, max: 4096, state: 'loaded' })) }
+})
+// The LU Engine runs with -c 8192.
+vi.mock('../../api/engine', async () => {
+ const actual = await vi.importActual<typeof import('../../api/engine')>('../../api/engine')
+ return { ...actual, bundledEngineStatus: vi.fn(async () => ({ running: true, healthy: true, ctx: 8192 })), bundledCtxTrain: () => 0 }
+})
+
+import { useProviderStore } from '../../stores/providerStore'
+import { useSettingsStore } from '../../stores/settingsStore'
+import { clearProviderCache, getProviderForModel } from '../../api/providers/registry'
+import { resolveModelContext, currentContextKnobs } from '../useActiveContextWindow'
+import { getChatWindowTokens } from '../../lib/context-compaction'
+import { withStoredWindow } from '../../lib/context-source'
+
+const API = 'https://api.example-llm.test/v1'
+let entry = ''
+const model = () => `openai:${entry}::vendor/brand-new-model-x`
+
+beforeEach(() => {
+ const st = useProviderStore.getState()
+ useProviderStore.setState({
+ providers: { ...st.providers, ollama: { ...st.providers.ollama, enabled: false } },
+ openaiEntries: [],
+ })
+ entry = useProviderStore.getState().addOpenAIEntry({ name: 'Some API', baseUrl: API, isLocal: false })
+ useSettingsStore.getState().updateSettings({ contextDecay: true, contextWindowByModel: {} })
+ clearProviderCache()
+ seen.length = 0
+})
+
+describe('C77: the window of an API model whose server names none', () => {
+ it('without a value: the guess, said as such, and the user may set it', async () => {
+ const ctx = await resolveModelContext(model(), 'chat', currentContextKnobs())
+ expect(ctx.provider).toBe('cloud')
+ expect(ctx.modelWindow).toBe(8192)
+ expect(ctx.modelWindowSource).toBe('guess')
+ expect(ctx.modelWindowSettable).toBe(true)
+ expect(ctx.modelWindowKey).toContain('brand-new-model-x')
+ expect(ctx.adjustable).toBe(true)
+ // A hosted API is asked nothing about its window (LAN rule).
+ expect(seen.filter((s) => s.url.startsWith(API))).toEqual([])
+ })
+
+ it('the user\'s value is the window: counter, send window, request budget, chat budget', async () => {
+ const first = await resolveModelContext(model(), 'chat', currentContextKnobs())
+ useSettingsStore.getState().updateSettings({
+ contextWindowByModel: withStoredWindow(useSettingsStore.getState().settings.contextWindowByModel, first.modelWindowKey!, 131072),
+ })
+ const ctx = await resolveModelContext(model(), 'chat', currentContextKnobs())
+ expect(ctx.modelWindow).toBe(131072)
+ expect(ctx.contextWindow).toBe(131072)
+ expect(ctx.modelWindowSource).toBe('user')
+ // Still a paid model: what one step sends stays under the send cap.
+ expect(ctx.sendWindow).toBe(32768)
+ const { provider, modelId } = getProviderForModel(model())
+ expect(await provider.getContextLength!(modelId)).toBe(131072)
+ expect(await getChatWindowTokens(model())).toBeGreaterThan(8192)
+ })
+
+ it('without the send cap the button stays, for the model window alone', async () => {
+ useSettingsStore.getState().updateSettings({ contextDecay: false })
+ const ctx = await resolveModelContext(model(), 'chat', currentContextKnobs())
+ expect(ctx.sendAdjustable).toBe(false)
+ expect(ctx.adjustable).toBe(true)
+ expect(ctx.modelWindowSettable).toBe(true)
+ })
+})
diff --git a/src/hooks/useActiveContextWindow.ts b/src/hooks/useActiveContextWindow.ts
index 1737dd6e..1236a2dc 100644
--- a/src/hooks/useActiveContextWindow.ts
+++ b/src/hooks/useActiveContextWindow.ts
@@ -69,6 +69,23 @@ export interface ActiveContext {
maxUnknown?: boolean
/** Ollama only: what Auto sends, which an unknown maximum keeps small. */
autoWindow?: number
+ /**
+ * C77 (redapplevi, Discord 11.11.2026): a hosted OpenAI-compatible API
+ * that names no window for its model. The window was then a guess from the
+ * name, 8192 at the floor, and nothing could change it: the picker of a
+ * paid model only sets the send window, and "Context window (Ollama)" is
+ * Ollama's. Here the user may say what the model really has; saved per
+ * endpoint and model under `modelWindowKey` in `contextWindowByModel`,
+ * which the provider's cascade already reads (step 2, GH #129).
+ * Absent where the server says its window, or for other providers.
+ */
+ modelWindowSettable?: boolean
+ modelWindowKey?: string
+ /** The model's own window and where it comes from (cloud branch). */
+ modelWindow?: number
+ modelWindowSource?: ContextSource
+ /** Cloud only: the send window can be set (a paid provider with the cap on). */
+ sendAdjustable?: boolean
}
/** What the hook reports while there is no model, or none resolved yet. */
@@ -343,6 +360,13 @@ export async function resolveModelContext(model: string, use: WindowUse, k: Cont
? await cloudClient.getContextWindow(cloudId).catch(() => null)
: null
const max = cloudResolved?.tokens || await getModelMaxTokens(model).catch(() => 4096)
+ const sendAdjustable = k.capEnabled !== false && isPaidProvider(providerId, sendsToALanBackend(providerId, model))
+ const windowSource = remoteWindowSource(providerId, cloudResolved?.source, max)
+ // C77: an OpenAI-compatible endpoint (it has a per model window key) that
+ // did not say its window. A window the server named is never overridden
+ // from here: the cascade clamps a pick to it anyway.
+ const modelWindowKey = providerId !== 'lu-cloud' && cloudClient?.contextWindowKey ? cloudClient.contextWindowKey(cloudId) : ''
+ const modelWindowSettable = !!modelWindowKey && !!cloudResolved && (cloudResolved.source === 'guess' || cloudResolved.source === 'user')
return {
provider: 'cloud',
contextWindow: max,
@@ -365,10 +389,14 @@ export async function resolveModelContext(model: string, use: WindowUse, k: Cont
// conversation each step sends and pays for. The dropdown sets it per
// model (settings.cloudSendWindowByModel). A LAN server that fell
// through to here bills nobody, so there is nothing to choose.
- adjustable: k.capEnabled !== false && isPaidProvider(providerId, sendsToALanBackend(providerId, model)),
+ adjustable: sendAdjustable || modelWindowSettable,
+ sendAdjustable,
// Woher die Zahl kommt, auch wenn sie hier niemand verstellen kann.
- source: remoteWindowSource(providerId, cloudResolved?.source, max),
+ source: windowSource,
windowKey: model,
+ modelWindow: max,
+ modelWindowSource: windowSource,
+ ...(modelWindowSettable ? { modelWindowSettable, modelWindowKey } : {}),
}
}
diff --git a/src/lib/settings-catalog.ts b/src/lib/settings-catalog.ts
index 671328b3..047a7b8f 100644
--- a/src/lib/settings-catalog.ts
+++ b/src/lib/settings-catalog.ts
@@ -256,7 +256,7 @@ export const CATALOG: readonly CatalogEntry[] = [
e('autoCompact', 'Auto-compact', 'general', 'Summarise older turns automatically when the chat nears the context window.', bool()),
e('chatRecall', 'Recall older messages', 'general', 'After a compaction, send the older messages that relate to the new one along, found by a local embedding model.', bool()),
e('autoCompactThreshold', 'Auto-compact at', 'general', 'How full the context window gets before auto-compact runs.', compactThreshold),
- e('contextWindowOverride', 'Context window (Ollama)', 'general', 'num_ctx sent to Ollama, in tokens. Other backends ignore it.', int(0, CONTEXT_WINDOW_MAX, 'tokens', 'auto')),
+ e('contextWindowOverride', 'Context window (Ollama)', 'general', 'num_ctx sent to Ollama, in tokens. Other backends ignore it; an API model whose server reports no window gets its own from the context button in the chat.', int(0, CONTEXT_WINDOW_MAX, 'tokens', 'auto')),
e('engineIdleUnloadMinutes', 'Unload the model when unused', 'backends', 'Minutes without use before LU Engine frees the model.', int(0, 1_440, 'min', 'never')),
e('builtinEngine.ctx', 'Context window (LU Engine)', 'backends', 'Context size of LU Engine, in tokens. Applies on the next engine start.', int(0, 1_048_576, 'tokens', 'default 8192')),
e('attachmentTokenLimit', 'Attachment limit', 'general', 'Most tokens one attached text file may take.', int(0, 1_048_576, 'tokens', 'no limit'), { lockOverride: 'A number of tokens, not a token.' }),