Repository navigation
Description
Problem
On openai-compatible (relay / aggregate gateway) connections there is no way to control the model's thinking depth: the Composer does not show a "Thinking level" selector, and the runtime never sends reasoning_effort even when the underlying model explicitly supports it.
Typical scenario: the user reaches DeepSeek V4 (e.g. deepseek-v4-flash / deepseek-v4-pro) through an OpenAI-compatible relay. The DeepSeek official API already supports reasoning_effort: low/high/max and thinking: {type: enabled/disabled}; a pass-through relay only needs to forward the parameter as-is for it to take effect. The blocker is purely on Maka's side: there is no declaration entry point at all.
Root cause (verified against 0.1.5 source):
packages/core/src/model-thinking.ts—thinkingVariantsForModel(providerType, modelId)returns[]foropenai-compatible. The backing model is user-configured inside the connection, so the catalog cannot declare its reasoning capabilities (the code comment explicitly calls this the conservative strategy).packages/core/src/llm-connections.ts— the connection model entry schema only hasid / displayName / apiProtocol / contextWindow / maxOutputTokens / capabilities / modalities; there is no field where reasoning capabilities can be declared.- Validation layer
apps/desktop/src/main/sessions-ipc-main.ts—normalizeSupportedSessionThinkingLevel()is based on the samethinkingVariantsForModel, so even hand-editing the config gets rejected with "当前模型不支持思考级别" (model does not support thinking level).
The wire layer is already in place; only the declaration entry point is missing:
@ai-sdk/openai-compatiblesupports thereasoningEffortprovider option and maps it to the top-levelreasoning_effortrequest body field.packages/runtime/src/model-factory.ts—buildFamilyWire()already has an openai-compatible branch:{ [connection.slug]: { reasoningEffort } }.
Desired outcome
The user can manually declare reasoning capabilities (which effort levels are supported) for a specific model under an openai-compatible connection. Once declared:
- The Composer shows the "Thinking level" selector and the session can switch levels;
- The runtime sends
reasoning_effortaccording to the selected level; - Switching models validates against the declaration, so a level is never sent to a model that does not support it.
Proposed design (per-model declaration, not connection-level guessing):
packages/core/src/llm-connections.ts: add an optionalthinkingOptions?: ThinkingOptionsfield to the model entry (reusing the existingThinkingOptionstype:{ efforts: [...], toggle? }). Backward compatible.packages/core/src/model-thinking.ts: addthinkingVariantsForConnection(connection, modelId)that falls back toconnection.models[].thinkingOptions(normalized viaderiveThinkingChoices) when the catalog misses; keepthinkingVariantsForModelunchanged.- Switch
sessions-ipc-main.tsvalidation, boththinkingVariantsForModelcall sites inuse-shell-chat-model.ts, and the subagent settings page to the new function. - Connection settings → model management: add a "thinking levels" editor (enable + multi-select levels).
- Tests: add openai-compatible declaration cases to
model-thinking.test.tsandsessions-ipc-maintests.
For the DeepSeek scenario, declare only low / high / max:
- Official mapping: requested
low→ v4-flash: low / v4-pro: high;high→ high on both;xhigh→ high on both;max→ max on both. Declaringxhighyields the same result ashigh— a fake level. - Do not offer
off: the ai-sdk openai-compatible adapter only mapsreasoning_effortand has nothinking: {type: disabled}channel, andnoneis not in DeepSeek's accepted value set. Disabling thinking on DeepSeek is a separate path via an Anthropic-protocol connection (reasoning: {effort: none}).
Alternatives or workarounds
- Use the official DeepSeek connection (baseURL
https://api.deepseek.com): the built-in catalog already declares V4's thinkingOptions, so the selector works immediately (Default / High / Max). But relay users (aggregated keys, per-usage billing, multi-model switching) cannot use this. - Hand-editing
llm-connections.jsonto add unknown fields: the schema does not accept it and the runtime ignores it. - Heuristic model-name matching (plan B): not recommended — relay model names are unreliable and false positives hurt; it also conflicts with the existing conservative "never guess on catalog miss" policy.
Maintainer feedback
The maintainer confirmed in the developer group: declaration of thinking options and round-tripping are required; the models.dev thinking-strength round-trip was just fixed yesterday (i.e. the catalog-metadata round-trip is now wired; what is missing here is only the user-declared entry point for openai-compatible connections).
Environment
- Maka 0.1.5 (desktop)
- macOS Apple Silicon (arm64)
- Connection type: openai-compatible (baseURL points to a third-party relay, e.g. a DeepSeek aggregate gateway)
Activity
[-]feat: 允许为 openai-compatible(中转站)连接手动声明 thinkingOptions,以启用思考深度调节[/-][+]feat: allow user-declared thinkingOptions for openai-compatible connections[/+]