Skip to content

Thinking levels: per-model catalog metadata, API validation and SDK support #1087

Closed

Description

@AnthonyRonning

Context

Maple serves eight chat models through OpenSecret, routed to Tinfoil and Continuum (Privatemode). Most of them reason before answering, and each one takes a different set of thinking controls. Today no client can tell from the catalog which thinking levels a model supports: the only thinking field is capabilities.reasoning: bool. A client that guesses gets an HTTP 400 on some models and silently pays for maximum effort on others. On GLM, a "thinking off" control makes the model's reasoning come back as the answer text.

Maple Agent is adopting Pi's thinking-level model: named levels (off, minimal, low, medium, high, xhigh, max), a per-model map from each level to its wire value, and clamping of unsupported levels to the nearest supported one. To do that cleanly, the backend and SDKs first need to publish and accept levels correctly. This issue is that backend and SDK work. It stands on its own and helps every client, including Research and API users. The Agent's UI and runtime integration are separate and come later.

The work has three parts, in order:

  1. Verify the findings below live on Dev, and check them against the relevant standards (see Verification).
  2. Settle the decisions.
  3. Implement the backend and SDK changes in their own PR.

What we found

Researched on 2026-10-06 from public source: vLLM at each deployed version, Tinfoil's and Privatemode's public deployment repositories, vendor READMEs, vLLM's recipes, and Maple at c61712a. Engine versions were read from public container image metadata. No inference was run, so everything here needs live confirmation. A second review re-derived each model's controls from source and found nothing that changes the approach.

Providers and routing

  • Tinfoil serves all eight chat models. Continuum also serves glm-5-3 and glm-5-3-flash, and takes 75% of account buckets for them (provider weight 30 × route weight 700, against 70 × 100).
  • Routes are sticky per account for an hour, and health checks can move an account to the other provider mid-session. A level must therefore mean the same thing on both providers' builds.
  • Auto aliases fall back across model families. Paid Quick falls back from glm-5-3-flash to deepseek-v4-1-flash, and paid Powerful from glm-5-3 to kimi-k3. One alias request can land on models with different controls.
  • Both catalog endpoints are built from the static MODEL_CONFIGS table. The provider field is single-valued, so it does not describe per-route behavior.

Engines

Every chat model runs on vLLM; none runs on SGLang.

Model Provider (share) vLLM build Confidence
gpt-oss-120b, gpt-oss-safeguard-120b Tinfoil 0.22.0 High
gemma4-31b Tinfoil 0.25.1, plus patches High
kimi-k3 Tinfoil 0.29.0 High
glm-5-3 Continuum (75%) / Tinfoil (25%) 0.28.0 / 0.29.0 Medium-high / High
glm-5-3-flash Continuum (75%) / Tinfoil (25%) a fork build, 0.1.dev20051+g487ecf187 / vLLM main at 385dce36 Medium / High
deepseek-v4-1-flash Tinfoil a pre-release build, 0.1.dev20904+g179dd0fa9; behavior inferred from the support that shipped in v0.30.0 Medium
llama3-3-70b Tinfoil 0.22.0 High

This assumes the latest Tinfoil release tags and Privatemode v1.58.0 are live; that was not verified. The two Medium builds have source commits that are not in public vLLM refs.

What each model does with each control

vLLM 0.22–0.31 accepts a top-level reasoning_effort of none, minimal, low, medium, high, xhigh or max (protocol). It passes the value to the chat template or renderer. Unless the caller set enable_thinking, it also derives enable_thinking = (reasoning_effort != "none") (build_chat_params). What happens next depends on the model:

Model reasoning_effort accepted Any other effort none Template switch off (enable_thinking: false or thinking: false) Nothing sent
gpt-oss (Harmony) low, medium, high 400 400 ignored medium
Gemma 4 any value but none turns thinking on; no tiers — off off off
Kimi K3 low, high, max 400 thinking off thinking off on, at max
GLM-5.3 and GLM-5.3-Flash low, high, max silently max reasoning leaks into content leaks max
DeepSeek V4.1 Flash low, high, xhigh, max (25/50/75/100); also 1–100 through template keywords 400 chat mode (off) chat mode (off) on, at 50 (high)
Llama 3.3 ignored — ignored ignored no thinking

Sources: Harmony rejections, Gemma 4 template, Kimi K3 renderer and Moonshot's README, GLM recipe and Z.ai's README, DeepSeek V4.1 encoding.

  • The GLM leak. The GLM-5.3 templates have no thinking switch: they always open <think> and pick effort from a Reasoning Effort: header. The deployed glm45/glm47 reasoning parser still trusts enable_thinking and thinking. Any thinking-off control therefore starts the parser in content mode while the model keeps thinking at max. The reasoning text and </think> then land in content (parser).
    • vLLM fixed this in d95d1dc (PR #56994, 2026-09-29; issue #54744).
    • The fix is in no release up to v0.31.0, and in neither provider's build.
    • Maple's image describer already works around it by sending low for Flash.
  • GLM's silent max rests on Z.ai's README and vLLM's recipes. The deployed checkpoints' templates live on Hugging Face and were not read.
  • Hidden reasoning still costs. include_reasoning: false only hides reasoning. The model still generates it, and it is still billed.
  • Budgets. thinking_token_budget is accepted where a reasoning parser is configured, and is a 400 on gpt-oss and Llama. Whether it is honored well with these templates is untested.
  • Effort scales differ between hosts. DeepSeek's own API maps low/high/max to 50/75/100, while vLLM maps low/high/xhigh/max to 25/50/75/100 (recipe). Level tables published for hosted APIs do not apply to Maple's deployments.

Reasoning output

  • vLLM 0.16 and later return reasoning only in reasoning, on the message and on each delta.
  • Privatemode's proxy also copies it into reasoning_content, a field marked deprecated and slated for removal (proxy).`` A client must accept reasoning alone and must never concatenate the two fields.
  • OpenSecret passes Chat Completions bodies and chunks through unchanged, apart from model, the cache salt and stream_options.include_usage. Its Responses path reads delta.reasoning, then delta.reasoning_content.
  • The typed Rust SDK's ChatMessage has only reasoning_content, so typed non-streaming calls drop Tinfoil's reasoning.
  • vLLM builds from 0.28 on report completion_tokens_details.reasoning_tokens when a reasoning parser is configured. The 0.22.0 and 0.25.1 builds do not.

What Maple does today

  • Maple Agent sends thinking controls only for Gemma: on for primary turns, off for auxiliary calls. Every other model runs at its default, so GLM and Kimi K3 run at max, compaction included.
  • The Responses API (Research) adds per-model template keywords: Gemma on, clear_thinking for GLM, preserve_thinking for K3. It has no reasoning parameter, so a client's reasoning: {effort} is silently dropped.
  • The image describer sets explicit per-model controls: low for Flash, off for Gemma and K3.
  • The Maple proxy forwards the caller's body as is.

Pi's level model, the first consumer

  • Each model has a thinkingLevelMap. A string is the wire value, and null marks a level as unsupported. xhigh and max are opt-in: they need an explicit entry.
  • An unsupported level clamps upward first, then downward. Pi's default level is medium.
  • On an OpenAI-compatible endpoint, Pi sends reasoning_effort with the mapped value. For off it sends the map's off value only if it is a string; otherwise it sends nothing.
  • Without per-model maps, Pi would send medium: a 400 on K3 and DeepSeek, and silently max on GLM. Maple has to publish the data that builds these maps.
  • Pi runs compaction at the session's level, and on this path reasoning shares max_tokens with the answer. A small output cap at max effort can end before the answer.

Requirements

  1. Discoverable levels.
    • The catalog states, for each model:
      • which levels it supports;
      • what it does when nothing is sent;
      • the wire value of each level, where it differs from the level's name.
    • Aliases state which levels they accept.
    • The catalog also publishes each model's maximum output tokens.
    • capabilities.reasoning stays for older clients.
  2. One request control. Top-level reasoning_effort on Chat Completions, and reasoning.effort on Responses, are the supported ways to choose a level. Template keywords such as enable_thinking and thinking are not part of the contract.
  3. Validated per resolved model and route. OpenSecret checks the level after alias resolution, against every route that may serve it. A level then means the same thing on both providers and across Auto fallbacks.
  4. Safe on GLM. No thinking-off control reaches a GLM build without the parser fix.
  5. Consistent output. Reasoning comes back in a documented field, and Continuum's duplicate reasoning_content is handled on purpose.
  6. SDKs. The Rust and TypeScript SDKs model the new catalog fields, and the Rust ChatMessage reads reasoning. Both SDKs are released.
  7. Standard where a standard exists.
    • Request, response and error shapes follow OpenAI's API wherever OpenAI defines them.
    • Anything Maple adds is documented as an extension, citing prior art where it exists.
  8. Verified live. Every model, route and level is verified on Dev before release, and again after.

Likely approach

To confirm through verification:

Model Levels to publish Default when nothing is sent Wire values
gpt-oss, gpt-oss-safeguard low, medium, high medium the level names
Gemma 4 off and on off off → none, on → high
Kimi K3 low, high, max; off is decision 2 max the level names; off → none if exposed
GLM-5.3, GLM-5.3-Flash low, high, max; no off max the level names
DeepSeek V4.1 Flash off, low, high, xhigh, max high (effort 50) the level names; off → none
Llama 3.3 none (reasoning: false) — —
auto:quick and auto:powerful (paid) low, high, max — translated per resolved model
auto:quick (free) low, medium, high medium the level names

Every wire value equals its level's name, except off → none. A possible catalog shape, with field names still open:

{
  "id": "glm-5-3",
  "capabilities": { "chat": true, "vision": false, "reasoning": true, "tool_use": true },
  "max_output_tokens": 131072,                // illustrative value
  "thinking": {
    "levels": ["low", "high", "max"],        // ordered from lowest to highest
    "default": "max",                        // what the model does when nothing is sent
    "parameter": "reasoning_effort",
    "values": { "low": "low", "high": "high", "max": "max" },
    "response_field": "reasoning"
  }
}

What likely works:

  • top-level reasoning_effort, the one control every deployed build honors;
  • one catalog entry per model, carrying its levels;
  • validation in OpenSecret per resolved model and route;
  • aliases that publish only the levels all their possible targets support.

What likely doesn't work:

  • Template keywords as the client contract (chat_template_kwargs.enable_thinking, thinking). They trigger the GLM leak, and gpt-oss ignores them.
  • DeepSeek- and Z.ai-style thinking: {type: ...} objects. vLLM ignores them.
  • include_reasoning: false to save cost. It only hides the reasoning.
  • Separate thinking and non-thinking model IDs.
    • A level change would become a model change.
    • Each ID would need its own routes.
    • Pi turns reasoning from a different model into plain text.
  • Token budgets. They are untested; leave them out until verified.
  • Hosted-API level tables (DeepSeek's API, Fireworks, Baseten). Their mappings differ from Maple's deployments.

Decisions to make

The recommendations below are open to change from the verification results.

  1. An unsupported level on an explicit model: reject or clamp?
    • Recommendation: reject with a 400, as OpenAI does for unsupported values; the standards check should confirm this. Pi clamps on the client, so the Agent never sends one.
    • For Auto aliases, translate to the resolved model's nearest supported level, so a fallback never fails mid-task.
  2. Kimi K3's off. Recommendation: leave it out of the catalog, since Moonshot documents K3 as always thinking. Maple's own side calls may still use it, as the image describer does.
  3. Defaults. Publish each model's own default. Whether to also publish a Maple-recommended level per model is an open product question.
  4. The duplicate reasoning_content. Pass it through as is, or normalize responses to reasoning only.
  5. Per-route engine metadata.
    • Record each route's engine, version, checkpoint and last verification date, so drift is visible. Tinfoil ships new model releases without any Maple change.
    • Optionally, a route that lacks a requested level drops out of eligibility.
  6. Levels in the Research UI. A follow-up issue, once Responses accepts reasoning.effort.

Verification

Two independent agents should do this before the decisions are locked, and post their reports on this issue or commit them with the PR.

A. Live verification against Dev

Call the real API on Dev, never production, and record what actually happens.

  • Matrix. Cover every combination of:
    • every chat model, and each GLM model on both providers;
    • every control: nothing sent, each of the seven reasoning_effort values, and both template switches off;
    • streaming and non-streaming;
    • at least one turn with a tool call, and one multi-turn case that replays earlier reasoning.
  • Record per cell:
    • the HTTP status and the error body's shape;
    • which fields carry reasoning: reasoning, reasoning_content or content;
    • whether reasoning text or </think> appears in content;
    • usage.completion_tokens and completion_tokens_details.reasoning_tokens;
    • finish_reason under a small max_completion_tokens, since reasoning counts against it.
  • Also check:
    • which levels survive an Auto fallback;
    • whether each model accepts the developer role;
    • whether thinking_token_budget is accepted, and whether it actually bounds reasoning;
    • reasoning.effort on the Responses API, which is expected to be dropped today;
    • which provider releases are live. Tinfoil's router publishes each model's release tag at /.well-known/tinfoil-proxy; Privatemode's is its release version.
  • Routes. The GLM models must be exercised on both providers. Find a safe way to reach each route, for example test accounts in different routing buckets. Do not add a route override reachable in production without review.
  • Hygiene.
    • Use synthetic prompts only.
    • Record statuses, field presence and token counts, not full responses.
    • Never record keys, tokens or account identifiers.
    • Keep token use small.
  • Re-run the same matrix on Dev after the change lands.

B. Standards check

Compare every field Maple sends, returns or publishes against the published specifications:

  • OpenAI Chat Completions:
    • reasoning_effort: its values, per-model support, and the error for an unsupported value;
    • max_completion_tokens;
    • the developer role;
    • usage.completion_tokens_details.reasoning_tokens.
  • OpenAI Responses:
    • reasoning.effort and reasoning.summary;
    • reasoning output items and their streaming events;
    • usage.output_tokens_details.reasoning_tokens.
  • The error format for unsupported parameters and values.
  • Reasoning text from OpenAI-compatible servers, which OpenAI does not define: vLLM's reasoning, DeepSeek's reasoning_content, OpenRouter's reasoning, and any others in common use.
  • Model-capability metadata:
    • what OpenAI's /v1/models exposes;
    • prior art for publishing supported levels, such as OpenRouter's supported_parameters.

The output is a table of every field: whether it is an OpenAI standard, a de-facto convention or a Maple extension, with a source link and a recommendation. Flag every place where this issue's proposal invents a shape that a standard or common convention already covers.

Acceptance criteria

  • Report A (live verification) and report B (standards) are posted, and the decisions above are recorded.
  • Catalog:
    • Each model publishes its thinking metadata and maximum output tokens, generated from one per-model table.
    • Each alias publishes only the levels all its possible targets support.
    • capabilities.reasoning is unchanged.
  • Chat Completions:
    • reasoning_effort is validated per resolved model and route, with the agreed reject or clamp behavior.
    • Thinking-off controls never reach GLM.
    • Tests cover every model's accepted and rejected values, and alias fallback.
  • Responses: accepts reasoning.effort, validates it the same way and passes it into the built request, with tests.
  • Reasoning output: the field is documented, and the reasoning_content decision is implemented.
  • SDKs:
    • The Rust SDK gains the catalog types and ChatMessage.reasoning.
    • The TypeScript SDK gains the catalog types.
    • Both SDKs are released, or their releases are prepared.
  • Docs: the API documentation covers thinking levels.
  • Re-verification: the live matrix is re-run on Dev after the change.

Non-goals

  • Maple Agent's thinking UI and its runtime integration. Those are separate and come later.
  • Thinking controls in the Research UI (a follow-up).
  • Token budgets (thinking_token_budget), until they are verified.
  • Changing provider weights, routing or the order of Auto candidates.
  • Separate thinking and non-thinking model IDs.
  • Upgrading providers' vLLM builds. Asking Tinfoil and Edgeless to pick up vLLM d95d1dc is worth doing, but is tracked outside this issue.

Current implementation references

Line references are at c61712a; re-check them on current master.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions