Skip to content

LLM Wiki is a cross-platform desktop application that turns your documents into an organized, interlinked knowledge base — automatically. Instead of traditional RAG (retrieve-and-answer from scratch every time), the LLM incrementally builds and maintains a persistent wiki from your sources。

TypeScript

fix: adapt requests to model capabilities

nash_su6aea0b2f7d17
diff --git a/src-tauri/src/agent/provider.rs b/src-tauri/src/agent/provider.rs
index 6f034170..1754139f 100644
--- a/src-tauri/src/agent/provider.rs
+++ b/src-tauri/src/agent/provider.rs
@@ -55,6 +55,9 @@ pub struct LlmConfig {
/// each request because app-state may be edited outside the settings UI.
#[serde(default)]
pub custom_headers: BTreeMap<String, String>,
+ /// Provider-specific fields for custom OpenAI-compatible request bodies.
+ #[serde(default)]
+ pub extra_request_body: BTreeMap<String, Value>,
/// Missing keeps the historical streaming behavior for existing configs.
#[serde(default)]
pub streaming_enabled: Option<bool>,
@@ -313,6 +316,24 @@ impl LlmClient {
if include_model {
body["model"] = Value::String(self.config.model.clone());
}
+ if self.config.provider == "custom"
+ && self.config.api_mode.as_deref() != Some("anthropic_messages")
+ {
+ for (key, value) in &self.config.extra_request_body {
+ if !matches!(
+ key.as_str(),
+ "messages"
+ | "model"
+ | "stream"
+ | "stream_options"
+ | "__proto__"
+ | "constructor"
+ | "prototype"
+ ) {
+ body[key] = value.clone();
+ }
+ }
+ }
adapt_openai_strict_completion_body(&mut body, &self.config);
apply_openai_reasoning(&mut body, &self.config);
body
@@ -962,7 +983,7 @@ fn is_deepseek_endpoint(config: &LlmConfig) -> bool {
fn supports_deepseek_thinking_param(config: &LlmConfig) -> bool {
let model = config.model.to_ascii_lowercase().replace('_', "-");
- model.contains("deepseek-v4")
+ model.starts_with("deepseek-v4") || model.starts_with("deepseek-flash")
}
fn apply_openai_reasoning(body: &mut Value, config: &LlmConfig) {
@@ -996,10 +1017,16 @@ fn apply_openai_reasoning(body: &mut Value, config: &LlmConfig) {
return;
}
match reasoning.mode.as_deref() {
+ Some("off") if is_openai_future_reasoning_model(config) => {
+ body["reasoning_effort"] = Value::String("none".to_string())
+ }
Some("off") => {}
Some("low" | "medium" | "high") => {
body["reasoning_effort"] = Value::String(reasoning.mode.clone().unwrap_or_default());
}
+ Some("max") if is_openai_future_reasoning_model(config) => {
+ body["reasoning_effort"] = Value::String("xhigh".to_string())
+ }
_ => {}
}
}
@@ -1089,13 +1116,27 @@ fn is_openai_reasoning_model(config: &LlmConfig) -> bool {
return true;
}
let lower = config.model.to_ascii_lowercase();
- lower.starts_with("gpt-5")
+ openai_gpt_major(&lower).is_some_and(|major| major >= 5)
|| lower
.strip_prefix('o')
.and_then(|tail| tail.chars().next())
.is_some_and(|first| first.is_ascii_digit())
}
+fn is_openai_future_reasoning_model(config: &LlmConfig) -> bool {
+ openai_gpt_major(&config.model.to_ascii_lowercase()).is_some_and(|major| major >= 6)
+}
+
+fn openai_gpt_major(model: &str) -> Option<u32> {
+ let tail = model.strip_prefix("gpt-")?;
+ let digits: String = tail.chars().take_while(char::is_ascii_digit).collect();
+ let delimiter = tail.chars().nth(digits.len());
+ if digits.is_empty() || delimiter.is_some_and(|value| !matches!(value, '.' | '-' | '_')) {
+ return None;
+ }
+ digits.parse().ok()
+}
+
fn is_gemini_3(model: &str) -> bool {
let lower = model.to_ascii_lowercase();
lower.starts_with("gemini-3-")
@@ -1159,6 +1200,7 @@ mod tests {
max_tokens: None,
max_context_size: None,
custom_headers: BTreeMap::new(),
+ extra_request_body: BTreeMap::new(),
streaming_enabled: None,
}
}
@@ -1404,6 +1446,49 @@ mod tests {
);
}
+ #[test]
+ fn deepseek_flash_structured_tasks_disable_thinking() {
+ let mut cfg = config("custom");
+ cfg.custom_endpoint = "https://api.deepseek.com/v1".to_string();
+ cfg.model = "deepseek-flash".to_string();
+ cfg.reasoning = Some(LlmReasoningConfig {
+ mode: Some("off".to_string()),
+ budget_tokens: None,
+ });
+ let body = LlmClient::new(cfg).expect("client").openai_like_body(
+ "system",
+ "user",
+ &[],
+ true,
+ false,
+ );
+ assert_eq!(
+ body.pointer("/thinking/type").and_then(Value::as_str),
+ Some("disabled")
+ );
+ }
+
+ #[test]
+ fn custom_extra_request_body_cannot_override_core_fields() {
+ let mut cfg = config("custom");
+ cfg.extra_request_body
+ .insert("enable_thinking".into(), Value::Bool(false));
+ cfg.extra_request_body
+ .insert("model".into(), Value::String("hijacked".into()));
+ let body = LlmClient::new(cfg).expect("client").openai_like_body(
+ "system",
+ "user",
+ &[],
+ true,
+ false,
+ );
+ assert_eq!(body.get("enable_thinking"), Some(&Value::Bool(false)));
+ assert_eq!(
+ body.get("model").and_then(Value::as_str),
+ Some("model/name")
+ );
+ }
+
#[test]
fn azure_gpt5_uses_max_completion_tokens() {
let mut cfg = config("azure");
@@ -1434,6 +1519,29 @@ mod tests {
assert!(body.get("max_tokens").is_none());
}
+ #[test]
+ fn future_openai_models_use_strict_tokens_and_none_reasoning() {
+ let mut cfg = config("openai");
+ cfg.model = "gpt-6-luna".to_string();
+ cfg.reasoning = Some(LlmReasoningConfig {
+ mode: Some("off".to_string()),
+ budget_tokens: None,
+ });
+ let body = LlmClient::new(cfg).expect("client").openai_like_body(
+ "system",
+ "user",
+ &[],
+ true,
+ false,
+ );
+ assert!(body.get("max_tokens").is_none());
+ assert!(body.get("max_completion_tokens").is_some());
+ assert_eq!(
+ body.get("reasoning_effort").and_then(Value::as_str),
+ Some("none")
+ );
+ }
+
#[test]
fn ordinary_azure_model_keeps_max_tokens() {
let mut cfg = config("azure");
diff --git a/src-tauri/src/agent/runtime.rs b/src-tauri/src/agent/runtime.rs
index ef68335a..344c34c0 100644
--- a/src-tauri/src/agent/runtime.rs
+++ b/src-tauri/src/agent/runtime.rs
@@ -4219,6 +4219,7 @@ mod tests {
max_tokens: None,
max_context_size: Some(8_000),
custom_headers: Default::default(),
+ extra_request_body: Default::default(),
streaming_enabled: None,
};
let fitted = fit_context_to_model(context, Some(&config));
@@ -4246,6 +4247,7 @@ mod tests {
max_tokens: None,
max_context_size: Some(8_000),
custom_headers: Default::default(),
+ extra_request_body: Default::default(),
streaming_enabled: None,
};
diff --git a/src-tauri/src/api_server.rs b/src-tauri/src/api_server.rs
index a64b82d5..91faba54 100644
--- a/src-tauri/src/api_server.rs
+++ b/src-tauri/src/api_server.rs
@@ -2367,6 +2367,7 @@ fn project_llm_config(parsed: &Value, project_id: &str) -> Option<agent::provide
"reasoning",
"streamingEnabled",
"customHeaders",
+ "extraRequestBody",
] {
if let Some(value) = provider.get(key) {
profile_object.insert(key.to_string(), value.clone());
diff --git a/src/components/settings/preset-resolver.ts b/src/components/settings/preset-resolver.ts
index 2f62869f..86fbdd4d 100644
--- a/src/components/settings/preset-resolver.ts
+++ b/src/components/settings/preset-resolver.ts
@@ -48,6 +48,7 @@ export function resolveConfig(
? Math.max(1, Math.min(1440, Math.floor(ov.requestTimeoutMinutes)))
: fallback.requestTimeoutMinutes
const customHeaders = ov.customHeaders
+ const extraRequestBody = ov.extraRequestBody
// Streaming is a per-preset preference. Never inherit it from the currently
// active fallback preset, or a newly selected provider would silently adopt
// the previous provider's disabled state. Missing means legacy/default on.
@@ -68,6 +69,7 @@ export function resolveConfig(
localCliIsolation: false,
requestTimeoutMinutes,
customHeaders,
+ extraRequestBody,
...streamingConfig,
}
}
diff --git a/src/components/settings/sections/llm-provider-section.test.ts b/src/components/settings/sections/llm-provider-section.test.ts
new file mode 100644
index 00000000..eda0fee1
--- /dev/null
+++ b/src/components/settings/sections/llm-provider-section.test.ts
@@ -0,0 +1,14 @@
+import { describe, expect, it } from "vitest"
+import { parseExtraRequestBody } from "./llm-provider-section"
+
+describe("parseExtraRequestBody", () => {
+ it("accepts an object and treats blank input as disabled", () => {
+ expect(parseExtraRequestBody('{"enable_thinking":false}')).toEqual({ enable_thinking: false })
+ expect(parseExtraRequestBody(" ")).toBeUndefined()
+ })
+
+ it("rejects arrays and invalid JSON", () => {
+ expect(() => parseExtraRequestBody("[]")).toThrow(/JSON object/)
+ expect(() => parseExtraRequestBody("{")).toThrow()
+ })
+})
diff --git a/src/components/settings/sections/llm-provider-section.tsx b/src/components/settings/sections/llm-provider-section.tsx
index 81ce0f8b..e927d45e 100644
--- a/src/components/settings/sections/llm-provider-section.tsx
+++ b/src/components/settings/sections/llm-provider-section.tsx
@@ -36,6 +36,16 @@ export function parseLlmHeadersText(text: string): Record<string, string> {
return headers
}
+export function parseExtraRequestBody(text: string): Record<string, unknown> | undefined {
+ const trimmed = text.trim()
+ if (!trimmed) return undefined
+ const parsed: unknown = JSON.parse(trimmed)
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
+ throw new Error("Extra request body must be a JSON object")
+ }
+ return parsed as Record<string, unknown>
+}
+
export function LlmProviderSection() {
const { t } = useTranslation()
const providerConfigs = useWikiStore((s) => s.providerConfigs)
@@ -387,10 +397,16 @@ function PresetRow({
const requestTimeoutMinutes = Math.max(1, Math.min(1440, ov.requestTimeoutMinutes ?? 30))
const streamingEnabled = ov.streamingEnabled !== false
const [headersText, setHeadersText] = useState(() => llmHeadersToText(ov.customHeaders))
+ const [extraBodyText, setExtraBodyText] = useState(() =>
+ ov.extraRequestBody ? JSON.stringify(ov.extraRequestBody, null, 2) : "",
+ )
+ const [extraBodyError, setExtraBodyError] = useState(false)
const isLocalCliProvider = preset.provider === "claude-code" || preset.provider === "codex-cli"
const [testState, setTestState] = useState<ProviderTestState>({ kind: "idle" })
const hasConfig = !!apiKey || !!ov.baseUrl || !!ov.model || !!ov.azureApiVersion || !!ov.azureModelFamily
- || Object.keys(ov.customHeaders ?? {}).length > 0 || ov.streamingEnabled === false
+ || Object.keys(ov.customHeaders ?? {}).length > 0
+ || Object.keys(ov.extraRequestBody ?? {}).length > 0
+ || ov.streamingEnabled === false
// Local CLI providers authenticate via their own existing login state
// (inherited by the spawned subprocess), so no API key field is shown.
// Ollama ditto for its local-only model.
@@ -541,6 +557,35 @@ function PresetRow({
</div>
</div>
)}
+ {preset.provider === "custom" && apiMode === "chat_completions" && (
+ <div className="space-y-2">
+ <Label>{t("settings.sections.llm.extraRequestBody")}</Label>
+ <textarea
+ value={extraBodyText}
+ onChange={(event) => {
+ setExtraBodyText(event.target.value)
+ setExtraBodyError(false)
+ }}
+ onBlur={() => {
+ try {
+ onChange({ extraRequestBody: parseExtraRequestBody(extraBodyText) })
+ setExtraBodyError(false)
+ } catch {
+ setExtraBodyError(true)
+ }
+ }}
+ rows={4}
+ spellCheck={false}
+ placeholder={'{\n "enable_thinking": false\n}'}
+ className={`w-full resize-y rounded-md border bg-background px-3 py-2 font-mono text-sm focus:outline-none focus:ring-2 focus:ring-ring ${extraBodyError ? "border-destructive" : ""}`}
+ />
+ <p className={`text-xs ${extraBodyError ? "text-destructive" : "text-muted-foreground"}`}>
+ {t(extraBodyError
+ ? "settings.sections.llm.extraRequestBodyInvalid"
+ : "settings.sections.llm.extraRequestBodyHint")}
+ </p>
+ </div>
+ )}
{(preset.provider === "custom" || preset.provider === "ollama" || preset.provider === "azure") && (
<EndpointField
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 2a85e4ad..e1141b5d 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -586,6 +586,9 @@
"streamingOutputOff": "Streaming off: response text appears after generation completes.",
"customHeaders": "Custom request headers",
"customHeadersHint": "Optional. Enter one Header-Name: value per line. Content-Type and configured API-key headers take precedence.",
+ "extraRequestBody": "Extra request body (JSON)",
+ "extraRequestBodyHint": "Optional fields for custom OpenAI-compatible APIs, such as enable_thinking. Core messages, model, and streaming fields cannot be overridden.",
+ "extraRequestBodyInvalid": "Enter a valid JSON object before leaving this field.",
"cliStatus": "CLI status",
"checkingCli": "Checking…",
"recheckCli": "Re-check",
diff --git a/src/i18n/it.json b/src/i18n/it.json
index d932eae6..3d516b0e 100644
--- a/src/i18n/it.json
+++ b/src/i18n/it.json
@@ -586,6 +586,9 @@
"streamingOutputOff": "Streaming disattivo: il testo della risposta compare al termine della generazione.",
"customHeaders": "Header personalizzati",
"customHeadersHint": "Opzionale. Inserisci un Nome-Header: valore per riga. Content-Type e gli header configurati per la chiave API hanno la precedenza.",
+ "extraRequestBody": "Corpo richiesta aggiuntivo (JSON)",
+ "extraRequestBodyHint": "Campi opzionali per API personalizzate compatibili con OpenAI, ad esempio enable_thinking. Messaggi, modello e streaming non possono essere sovrascritti.",
+ "extraRequestBodyInvalid": "Inserisci un oggetto JSON valido prima di uscire dal campo.",
"cliStatus": "Stato della CLI",
"checkingCli": "Controllo…",
"recheckCli": "Ricontrolla",
diff --git a/src/i18n/ru.json b/src/i18n/ru.json
index 34d2e3c6..193b464e 100644
--- a/src/i18n/ru.json
+++ b/src/i18n/ru.json
@@ -586,6 +586,9 @@
"streamingOutputOff": "Потоковая передача выключена: текст ответа появляется после завершения генерации.",
"customHeaders": "Пользовательские заголовки запроса",
"customHeadersHint": "Необязательно. Укажите по одному заголовку Header-Name: value в строке. Заголовки Content-Type и настроенного API-ключа имеют приоритет.",
+ "extraRequestBody": "Дополнительное тело запроса (JSON)",
+ "extraRequestBodyHint": "Необязательные поля для пользовательских OpenAI-совместимых API, например enable_thinking. Нельзя переопределять сообщения, модель и потоковый режим.",
+ "extraRequestBodyInvalid": "Введите корректный объект JSON перед выходом из поля.",
"cliStatus": "Статус CLI",
"checkingCli": "Проверка…",
"recheckCli": "Проверить заново",
diff --git a/src/i18n/zh.json b/src/i18n/zh.json
index c3b75ce4..72683dd7 100644
--- a/src/i18n/zh.json
+++ b/src/i18n/zh.json
@@ -586,6 +586,9 @@
"streamingOutputOff": "流式输出已关闭:生成完成后一次性显示内容。",
"customHeaders": "自定义请求头",
"customHeadersHint": "可选。每行填写一条 Header-Name: value。Content-Type 和已配置的 API 密钥请求头优先。",
+ "extraRequestBody": "额外请求体(JSON)",
+ "extraRequestBodyHint": "用于自定义 OpenAI 兼容 API 的可选字段,例如 enable_thinking。不能覆盖消息、模型和流式输出等核心字段。",
+ "extraRequestBodyInvalid": "请输入有效的 JSON 对象后再离开此输入框。",
"cliStatus": "CLI 状态",
"checkingCli": "正在检查……",
"recheckCli": "重新检查",
diff --git a/src/lib/llm-providers.test.ts b/src/lib/llm-providers.test.ts
index f1bb2085..eac4a3e9 100644
--- a/src/lib/llm-providers.test.ts
+++ b/src/lib/llm-providers.test.ts
@@ -605,6 +605,59 @@ describe("reasoning controls", () => {
expect(body.reasoning).toBeUndefined()
})
+ it("maps the official DeepSeek Flash model id to thinking disabled", () => {
+ const cfg = mkConfig({
+ provider: "custom",
+ model: "deepseek-flash",
+ customEndpoint: "https://api.deepseek.com/v1",
+ apiMode: "chat_completions",
+ })
+ const body = getProviderConfig(cfg).buildBody(
+ [{ role: "user", content: "hi" }],
+ { reasoning: { mode: "off" } },
+ ) as Record<string, unknown>
+ expect(body.thinking).toEqual({ type: "disabled" })
+ })
+
+ it("adapts future OpenAI model ids and supports none/xhigh effort", () => {
+ const cfg = mkConfig({ provider: "openai", model: "gpt-6-luna" })
+ const off = getProviderConfig(cfg).buildBody(
+ [{ role: "user", content: "hi" }],
+ { max_tokens: 500, temperature: 0.1, reasoning: { mode: "off" } },
+ ) as Record<string, unknown>
+ expect(off.max_tokens).toBeUndefined()
+ expect(off.max_completion_tokens).toBe(500)
+ expect(off.temperature).toBeUndefined()
+ expect(off.reasoning_effort).toBe("none")
+
+ const max = getProviderConfig(cfg).buildBody(
+ [{ role: "user", content: "hi" }],
+ { reasoning: { mode: "max" } },
+ ) as Record<string, unknown>
+ expect(max.reasoning_effort).toBe("xhigh")
+ })
+
+ it("merges custom request fields without allowing core body overrides", () => {
+ const cfg = mkConfig({
+ provider: "custom",
+ model: "qwen3.8-flash",
+ customEndpoint: "https://dashscope.example/v1",
+ extraRequestBody: {
+ enable_thinking: false,
+ model: "hijacked",
+ messages: [],
+ stream: false,
+ },
+ })
+ const body = getProviderConfig(cfg).buildBody(
+ [{ role: "user", content: "hi" }],
+ ) as Record<string, unknown>
+ expect(body.enable_thinking).toBe(false)
+ expect(body.model).toBe("qwen3.8-flash")
+ expect(body.messages).toEqual([{ role: "user", content: "hi" }])
+ expect(body.stream).toBe(true)
+ })
+
it("maps DeepSeek V4 high reasoning to thinking enabled plus reasoning_effort", () => {
const cfg = mkConfig({
provider: "custom",
diff --git a/src/lib/llm-providers.ts b/src/lib/llm-providers.ts
index 2009c7f0..127b1267 100644
--- a/src/lib/llm-providers.ts
+++ b/src/lib/llm-providers.ts
@@ -353,7 +353,18 @@ function isDeepSeekEndpoint(config: LlmConfig): boolean {
}
function supportsDeepSeekThinkingParam(config: LlmConfig): boolean {
- return /deepseek[-_]?v4/i.test(config.model)
+ return /deepseek[-_]?(?:v4|flash)(?:[-_.]|$)/i.test(config.model)
+}
+
+const PROTECTED_EXTRA_BODY_FIELDS = new Set([
+ "messages", "model", "stream", "stream_options", "__proto__", "constructor", "prototype",
+])
+
+function mergeExtraRequestBody(config: LlmConfig, body: Record<string, unknown>): void {
+ if (config.provider !== "custom" || config.apiMode === "anthropic_messages") return
+ for (const [key, value] of Object.entries(config.extraRequestBody ?? {})) {
+ if (!PROTECTED_EXTRA_BODY_FIELDS.has(key)) body[key] = value
+ }
}
function isKimiEndpoint(config: LlmConfig): boolean {
@@ -385,7 +396,7 @@ function isOpenAiStrictCompletionModel(config: LlmConfig): boolean {
const model = config.model.trim().toLowerCase()
const strictModel =
- /^gpt-5(?:[.\-_]|$)/.test(model) || /^o\d+(?:[.\-_]|$)/.test(model)
+ /^gpt-(?:[5-9]|\d{2,})(?:[.\-_]|$)/.test(model) || /^o\d+(?:[.\-_]|$)/.test(model)
if (!strictModel) return false
if (config.provider === "openai" || config.provider === "azure") return true
return config.provider === "custom" && isAzureOpenAiEndpoint(config.customEndpoint)
@@ -460,6 +471,7 @@ function buildOpenAiCompatibleBody(
stripWireAgnosticOverrides(overrides),
streaming,
)
+ mergeExtraRequestBody(config, body)
adaptOpenAiStrictCompletionBody(config, body)
adaptKimiBody(config, body)
adaptXiaomiMimoBody(config, body, reasoning)
@@ -519,9 +531,14 @@ function buildOpenAiCompatibleBody(
return body
}
- if (config.provider === "openai" && reasoning.mode !== "auto" && reasoning.mode !== "off") {
+ if (config.provider === "openai" && reasoning.mode === "off"
+ && /^gpt-(?:[6-9]|\d{2,})(?:[.\-_]|$)/i.test(config.model.trim())) {
+ body.reasoning_effort = "none"
+ } else if (config.provider === "openai" && reasoning.mode !== "auto" && reasoning.mode !== "off") {
if (reasoning.mode === "low" || reasoning.mode === "medium" || reasoning.mode === "high") {
body.reasoning_effort = reasoning.mode
+ } else if (reasoning.mode === "max") {
+ body.reasoning_effort = "xhigh"
}
}
diff --git a/src/lib/reasoning-capabilities.test.ts b/src/lib/reasoning-capabilities.test.ts
index e8b40a67..76bca379 100644
--- a/src/lib/reasoning-capabilities.test.ts
+++ b/src/lib/reasoning-capabilities.test.ts
@@ -47,6 +47,13 @@ describe("reasoning capabilities", () => {
.toEqual({ mode: "auto" })
})
+ it("supports off and maximum effort for future OpenAI model families", () => {
+ expect(resolveReasoningCapabilities(config("openai", "gpt-6-luna")).modes)
+ .toEqual(["auto", "off", "low", "medium", "high", "max"])
+ expect(resolveReasoningCapabilities(config("openai", "gpt-4.1")).modes)
+ .toEqual(["auto"])
+ })
+
it("normalizes custom budgets to positive integer values", () => {
const cfg = config("anthropic", "claude-sonnet-4-5")
expect(normalizeReasoningForProvider(cfg, { mode: "custom", budgetTokens: 2048.9 }))
diff --git a/src/lib/reasoning-capabilities.ts b/src/lib/reasoning-capabilities.ts
index a10321d7..a95f8c83 100644
--- a/src/lib/reasoning-capabilities.ts
+++ b/src/lib/reasoning-capabilities.ts
@@ -10,6 +10,7 @@ export interface ReasoningCapabilities {
const AUTO_ONLY = ["auto"] as const
const OPENAI_LEVELS = ["auto", "low", "medium", "high"] as const
+const OPENAI_FUTURE_LEVELS = ["auto", "off", "low", "medium", "high", "max"] as const
const BUDGET_LEVELS = ["auto", "off", "low", "medium", "high", "max", "custom"] as const
const THINKING_REQUIRED_BUDGETS = ["auto", "low", "medium", "high", "max", "custom"] as const
const THINKING_REQUIRED_LEVELS = ["auto", "low", "medium", "high", "max"] as const
@@ -51,7 +52,11 @@ function isGemini3(model: string): boolean {
function isOpenAiReasoningModel(config: LlmConfig): boolean {
if (config.provider === "azure" && config.azureModelFamily === "gpt5") return true
const model = config.model.trim().toLowerCase()
- return /^(?:gpt-5|o\d+)(?:[.\-_]|$)/.test(model)
+ return /^(?:gpt-(?:[5-9]|\d{2,})|o\d+)(?:[.\-_]|$)/.test(model)
+}
+
+function isOpenAiFutureReasoningModel(config: LlmConfig): boolean {
+ return /^gpt-(?:[6-9]|\d{2,})(?:[.\-_]|$)/.test(config.model.trim().toLowerCase())
}
export function isOpenRouterEndpoint(endpoint: string): boolean {
@@ -89,6 +94,7 @@ export function resolveReasoningCapabilities(config: LlmConfig): ReasoningCapabi
}
if (config.provider === "minimax") return capabilities(AUTO_ONLY)
if (config.provider === "openai" || config.provider === "azure") {
+ if (isOpenAiFutureReasoningModel(config)) return capabilities(OPENAI_FUTURE_LEVELS)
return capabilities(isOpenAiReasoningModel(config) ? OPENAI_LEVELS : AUTO_ONLY)
}
if (config.provider === "custom") {
diff --git a/src/stores/wiki-store.ts b/src/stores/wiki-store.ts
index 32831468..dee8cd75 100644
--- a/src/stores/wiki-store.ts
+++ b/src/stores/wiki-store.ts
@@ -58,6 +58,8 @@ interface LlmConfig {
streamingEnabled?: boolean
/** Optional headers added to every HTTP request for this provider preset. */
customHeaders?: Record<string, string>
+ /** Optional provider-specific fields merged into custom OpenAI-compatible request bodies. */
+ extraRequestBody?: Record<string, unknown>
}
export type SearchProvider =
@@ -349,6 +351,7 @@ export interface ProviderOverride {
requestTimeoutMinutes?: number
streamingEnabled?: boolean
customHeaders?: Record<string, string>
+ extraRequestBody?: Record<string, unknown>
}
export type ProviderConfigs = Record<string, ProviderOverride>