DTSFO/dsh-model-modes

面向DeepSeek Harness的能力感知推理控制与快速模型路由

项目介绍Project Overview

DSH 插件 dsh-model-modes 为 Web 组合器引入基于能力的推理配置与各 provider 原生 Fast 模式。它在官方模型选择器中保留 reasoning 选择,将 reasoningProfiles.provider 通配符精准扩展到含确切模型 ID 的 llm-pi-ai provider,并独立暴露 gpt-5.6 的 Max 与 Ultra 档位。Fast 开关正交于推理,在 Models.streamSimple 边界注入 provider 原生参数,可与 Max/Ultra 自由组合。适用于需要多档推理与按需加速的场景。注意:Fast 状态为进程内,重启后默认关闭;服务等级可能需账户授权并产生额外计费。

dsh-model-modes is a DSH web-composer plugin that adds capability-aware reasoning profiles and provider-native Fast mode. It keeps reasoning selection in the official model selector, expands reasoningProfiles.provider: '*' only to llm-pi-ai providers containing the exact model id, and exposes Max/Ultra as independent choices for gpt-5.6. The Fast switch is orthogonal to reasoning, injecting the current provider's native fast/priority parameter at the final streamSimple boundary. Use it for multi-tier reasoning with optional native acceleration. Caveat: Fast state is process-local and resets to OFF on Host restart, and provider service tiers may require entitlement and extra billing.

或使用命令行安装(适合开发者)Or use CLI install (for developers)

命令行安装CLI Install

dsh plugin --profile web add \

DTSFO/dsh-model-modes 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-model-modes

Capability-aware reasoning profiles and provider-native Fast mode for the DeepSeek Harness web composer.

What it does

  • Keeps reasoning selection in DSH's official model selector.
  • Expands reasoningProfiles.provider: '*' to every llm-pi-ai provider that actually contains the exact model id; no myself hardcoding.
  • Exposes Max and Ultra as independent choices for gpt-5.6.
  • Adds a clearly differentiated Fast ON/OFF switch to the composer.
  • Applies the current provider's native fast/priority request parameter without lowering reasoning, changing model, or changing the DSH provider.
  • Tracks the official per-session ModelDirectory; unsupported routes are visibly unavailable and rejected by the Host.

Max + Fast and Ultra + Fast are both supported combinations.

Fast semantics

Fast is orthogonal to reasoning. It never selects a cheaper reasoning effort, a flash/turbo sibling model, or another DSH provider. Injection happens at the final llm-pi-ai Models.streamSimple() boundary and is isolated per concurrent session with AsyncLocalStorage.

Built-in provider contracts

DSH provider pi-ai API Fast wire parameter Default policy
openai OpenAI Responses / Chat Completions service_tier: "fast" Exact official model allowlist
openai-codex openai-codex-responses service_tier: "fast" Exact Codex allowlist: GPT-5.6 Luna/Sol/Terra, GPT-5.5, and GPT-5.4
xai OpenAI Responses / Chat Completions service_tier: "priority" All text models on this exact provider
google google-generative-ai config.serviceTier: "priority" Exact Gemini Developer API allowlist
openrouter OpenAI-compatible text APIs service_tier: "fast" All models on this exact provider; upstream may fall back to Standard
minimax / minimax-cn anthropic-messages service_tier: "priority" Exact MiniMax model allowlist
vercel-ai-gateway anthropic-messages providerOptions.gateway.speed: "fast" plus allowFallbackFromFast: false Exact live Fast-model intersection; fast-or-fail, with no silent Standard fallback
fireworks anthropic-messages / openai-completions service_tier: "priority" Exact nine-model allowlist; request-level Priority, not a Fireworks *-fast router/model switch
azure-openai-responses azure-openai-responses service_tier: "priority" Explicit opt-in only: deployment, API version, SKU, and region are not visible to the matcher
google-vertex google-vertex X-Vertex-AI-LLM-Shared-Request-Type: priority Explicit opt-in only: Priority PayGo requires a supported model and the global endpoint
amazon-bedrock bedrock-converse-stream serviceTier: { type: "priority" } Explicit opt-in only: support varies by model card, inference profile, and region

Nested objects are merged immutably, preserving fields such as Google config.thinkingConfig, Bedrock siblings, existing OpenRouter routing configuration, and Vercel Gateway options such as only, order, and models.

The default OpenAI allowlist follows the current Fast table, including the GPT-5.6 family, supported GPT-5.x/GPT-4.x models, o3, o4-mini, and gpt-5.3-codex. The separate openai-codex route uses its own exact Codex allowlist and API contract. Google defaults only to the current Gemini Developer API text-model intersection and deliberately excludes gemini-3.7-flash; Vertex documents 3.7 separately but remains explicit opt-in. MiniMax defaults to its documented M2/M3 priority models.

Vercel AI Gateway Fast mode is configured as fast-or-fail: allowFallbackFromFast: false prevents an unavailable Fast route from silently becoming Standard. Its defaults are an exact intersection of pi-ai's catalog and Vercel's live Fast metadata; already-fast *-fast model slugs are excluded because choosing one would be a model change.

Fireworks exposes request-level Priority through service_tier: "priority". Fireworks also offers distinct Fast serving paths that require selecting a different router/model, but this plugin never changes the selected model or route. Consequently, the Composer's Fast switch means Provider-native Priority on the documented nine-model Fireworks allowlist, not an implicit switch to a *-fast model.

Capability is evaluated from the live llm-pi-ai route and the selected model's actual pi-ai API id. A matching name on another adapter, a wrong API, a bridge installation failure, or a route without a precise profile is shown as N/A and cannot be enabled.

These entries mean the request contract is known. Account entitlement, regional capacity, deployment support, fallback, and billing remain provider decisions.

Fail-closed in this release

The pi-ai 0.82.1 built-in provider set has 38 ids (37 static catalog providers plus the dynamic radius gateway), all classified by this release: nine have default profiles, three deployment-dependent providers are explicit opt-in only, and the remaining 26 are rejected by configuration validation. The rejected built-in ids are ant-ling, anthropic, cerebras, cloudflare-ai-gateway, cloudflare-workers-ai, deepseek, github-copilot, groq, huggingface, kimi-coding, mistral, moonshotai, moonshotai-cn, nvidia, opencode, opencode-go, qwen-token-plan, qwen-token-plan-cn, radius, together, xiaomi, xiaomi-token-plan-ams, xiaomi-token-plan-cn, xiaomi-token-plan-sgp, zai, and zai-coding-cn.

  • anthropic: native Fast requires speed: "fast" plus a Fast beta header. pi-ai 0.82.1 assembles other Anthropic beta tokens after the plugin header seam, so this version cannot safely preserve every token.
  • mistral: its latency tier uses service_tier: "auto", not OpenAI fast or generic priority; the current serializer boundary is not proven safe for this field.
  • groq: Performance Tier uses service_tier: "performance", with enterprise and model constraints; it is not the OpenAI Fast contract.
  • cerebras: priority uses service_tier: "priority" only on eligible dedicated endpoints and is currently private preview.
  • deepseek: its official API documents service_tier as ignored.
  • Unknown or self-hosted compatible gateways: API compatibility does not prove paid Fast support; use an exact provider/API profile only after verifying the upstream contract.

These rejected built-in providers cannot be enabled by assigning them a generic OpenAI-style or custom strategy. Unknown or self-hosted providers remain unsupported by default and require an exact verified provider/model/API profile.

Configuration

Built-in contracts are enabled by default. fastProfiles is an additive/override layer; later exact provider/model/API matchers win.

- id: dsh-model-modes
  config:
    includeDefaultFastProfiles: true
    fastProfiles:
      # A verified self-hosted gateway. Provider and API must be exact;
      # use model: '*' only if every model on that route has the same contract.
      - provider: your-gateway
        model: gpt-5.6
        api: openai-responses
        strategy: openai-fast

      # Vertex is explicit because the matcher cannot inspect endpoint location.
      - provider: google-vertex
        model: gemini-3.7-flash
        api: google-vertex
        strategy: vertex-priority

Known strategies:

  • openai-fast
  • openai-codex-fast
  • service-tier-priority
  • fireworks-priority
  • google-priority
  • vertex-priority
  • bedrock-priority
  • openrouter-fast
  • vercel-gateway-fast
  • custom

Set includeDefaultFastProfiles: false to use only explicit profiles.

Use custom only for a verified gateway-specific contract:

fastProfiles:
  - provider: your-gateway
    model: your-model
    api: openai-responses
    strategy: custom
    body:
      acceleration:
        tier: turbo
    headers:
      X-Gateway-Fast: "1"

To keep Fast orthogonal, custom patches cannot modify model, provider, reasoning, reasoning_effort, thinking, thinkingConfig, effort, and related fields.

Generic reasoning profiles

The default profile is:

reasoningProfiles:
  - provider: '*'
    model: gpt-5.6
    efforts:
      minimal: minimal
      low: low
      medium: medium
      high: high
      xhigh: xhigh
      max: max
      ultra: ultra

The provider wildcard expands to every llm-pi-ai provider that actually contains the exact gpt-5.6 model id, regardless of whether it is official, local, or user-defined; myself is not special-cased. An exact provider profile wins the same route. Unknown models, providers owned by another adapter, and providers without that model are left untouched.

DSH rc.6 exposes seven native transport effort ids. The plugin leaves every existing persisted native mapping intact, adding only profile-declared native keys that are missing, and appends Ultra to the public selector. Only an explicit Ultra request gets a request-local model clone whose temporary carrier maps to the configured Ultra wire value. Max, Off, Provider Default, and every ordinary request keep the original model and settings.

For the default gpt-5.6 profile:

Official UI selection Final provider wire value
Max max
Ultra ultra

There is no persistent max -> ultra mapping: Max and Ultra are two independent public efforts and two independent final wire values. Version 0.1.2 also migrates the plugin's older generated max: ultra or off: ultra settings back to native mappings, so uninstalling or disabling the plugin cannot leave ordinary requests sending Ultra.

Existing manual reasoningEfforts remain authoritative for keys they already define. Profiles add only missing declared levels, so a provider-specific wire spelling is preserved while a route can gain an independent Ultra option. An exact provider/model profile may set overrideExisting: true to replace the complete map; wildcard provider profiles cannot, preventing accidental bulk takeover. Adapter-native capabilities remain authoritative unless an explicit model profile is needed.

Install

dsh plugin --profile web add \
  https://github.com/DTSFO/dsh-model-modes/archive/refs/tags/v0.1.3.tar.gz

Then run:

dsh web

Development:

pnpm install
pnpm run check
dsh plugin --profile web add /absolute/path/to/dsh-model-modes

Limitations

  • Fast state is process-local and defaults OFF after a Host restart. The final provider payload is not written back into session history.
  • Fast state is bound to the provider/model selected when enabled. A later selection refreshes capability; an in-flight iterable keeps its creation-time state.
  • Provider service tiers may require entitlement and additional billing.
  • The virtual Ultra and request bridge target DSH rc.6 / pi-ai 0.82.1; unsafe seams fail closed rather than lowering effort or changing route.

Provider references

MIT

上一个 Prev dsh-narrative-ledger 下一个 Next dsh-agent-astra