Skip to content

feat: allow user-declared thinkingOptions for openai-compatible connections #2220

Closed

Description

@cat0825

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):

  1. packages/core/src/model-thinking.ts — thinkingVariantsForModel(providerType, modelId) returns [] for openai-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).
  2. packages/core/src/llm-connections.ts — the connection model entry schema only has id / displayName / apiProtocol / contextWindow / maxOutputTokens / capabilities / modalities; there is no field where reasoning capabilities can be declared.
  3. Validation layer apps/desktop/src/main/sessions-ipc-main.ts — normalizeSupportedSessionThinkingLevel() is based on the same thinkingVariantsForModel, 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-compatible supports the reasoningEffort provider option and maps it to the top-level reasoning_effort request 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_effort according 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):

  1. packages/core/src/llm-connections.ts: add an optional thinkingOptions?: ThinkingOptions field to the model entry (reusing the existing ThinkingOptions type: { efforts: [...], toggle? }). Backward compatible.
  2. packages/core/src/model-thinking.ts: add thinkingVariantsForConnection(connection, modelId) that falls back to connection.models[].thinkingOptions (normalized via deriveThinkingChoices) when the catalog misses; keep thinkingVariantsForModel unchanged.
  3. Switch sessions-ipc-main.ts validation, both thinkingVariantsForModel call sites in use-shell-chat-model.ts, and the subagent settings page to the new function.
  4. Connection settings → model management: add a "thinking levels" editor (enable + multi-select levels).
  5. Tests: add openai-compatible declaration cases to model-thinking.test.ts and sessions-ipc-main tests.

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. Declaring xhigh yields the same result as high — a fake level.
  • Do not offer off: the ai-sdk openai-compatible adapter only maps reasoning_effort and has no thinking: {type: disabled} channel, and none is 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.json to 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

  1. changed the title [-]feat: 允许为 openai-compatible(中转站)连接手动声明 thinkingOptions,以启用思考深度调节[/-] [+]feat: allow user-declared thinkingOptions for openai-compatible connections[/+] on Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions