Skip to content

feat(model): wire anthropic temperature capability - #1479

Merged
zerob13 merged 1 commit into
devfrom
feat/anthropic-temperature-capability
Apr 17, 2026
Merged

feat(model): wire anthropic temperature capability#1479
zerob13 merged 1 commit into
devfrom
feat/anthropic-temperature-capability

Conversation

@yyhhyyyyyy

@yyhhyyyyyy yyhhyyyyyy commented Apr 17, 2026

Copy link
Copy Markdown
Collaborator

support claude-opus-4-7 and wire anthropic temperature capability

Summary by CodeRabbit

  • New Features

    • Added smart temperature control: the temperature setting now appears only for models that support it, removing the setting for incompatible models like Claude Opus 4.7.
  • Chores

    • Updated agent versions across multiple tools to latest releases.
    • Added new models: Claude Opus 4.7, GLM 5.1, Minimax M2.7, and others.
    • Refreshed model database entries with updated pricing and capability information.

@coderabbitai

coderabbitai Bot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Implemented temperature control capability detection across the system by adding query methods to ConfigPresenter and ModelCapabilities, with pattern matching for Anthropic models that don't support temperature. Updated agent registry versions and their distribution coordinates, and refreshed the model database with new models (Claude Opus 4.7, GLM 5.1, Minimax M2.7) and a new hpc-ai provider. Updated UI components and runtime to conditionally include temperature parameters based on capability detection.

Changes

Cohort / File(s) Summary
Registry & Model Database
resources/acp-registry/registry.json, resources/model-db/providers.json
Updated 15 agent versions with corresponding distribution packages; added new models (claude-opus-4-7, glm-5.1, minimax-m2.7, mercury-coder-small, deepseek-ocr); added hpc-ai provider block; removed deprecated models; updated timestamps and cost/limit configurations.
Temperature Capability Infrastructure
src/main/presenter/configPresenter/index.ts, src/main/presenter/configPresenter/modelCapabilities.ts, src/shared/types/presenters/legacy.presenters.d.ts
Added getTemperatureCapability() and supportsTemperatureControl() methods to detect temperature support per provider/model; pattern matching for unsupported Anthropic models (claude-opus-4-7); extended IConfigPresenter interface with optional capability query methods.
Runtime Temperature Handling
src/main/presenter/llmProviderPresenter/aiSdk/runtime.ts
Implemented conditional temperature parameter inclusion in AI SDK requests based on runtime capability checks; special-case fallback disabling temperature for specific Anthropic model IDs; updates request body and both generateText/streamText calls.
UI Components - Conditional Temperature Controls
src/renderer/src/components/chat/ChatStatusBar.vue, src/renderer/src/components/settings/ModelConfigDialog.vue
Made temperature control UI visibility dependent on supportsTemperatureControl() capability query; updated capability fetching and form validation logic to conditionally render/validate temperature fields.
Test Coverage
test/main/presenter/llmProviderPresenter/aiSdkRuntime.test.ts, test/renderer/components/ChatStatusBar.test.ts, test/renderer/components/ModelConfigDialog.test.ts
Added tests for temperature capability detection; validated request/trace payload exclusion of temperature for unsupported models; verified UI conditional rendering based on temperature capability flag.

Sequence Diagram

sequenceDiagram
    participant UI as UI Component
    participant ConfigPresenter as ConfigPresenter
    participant ModelCapabilities as ModelCapabilities
    participant Runtime as AI SDK Runtime

    UI->>ConfigPresenter: supportsTemperatureControl(providerId, modelId)
    ConfigPresenter->>ModelCapabilities: supportsTemperatureControl(providerId, modelId)
    ModelCapabilities->>ModelCapabilities: Check if model matches<br/>unsupported pattern
    ModelCapabilities-->>ConfigPresenter: boolean (capability support)
    ConfigPresenter-->>UI: boolean (display control?)
    
    alt Temperature Supported
        UI->>Runtime: Call with temperature parameter
        Runtime->>ConfigPresenter: Verify capability at runtime
        ConfigPresenter-->>Runtime: Confirmed true
        Runtime->>Runtime: Include temperature in request
    else Temperature Not Supported
        UI->>Runtime: Call without temperature
        Runtime->>ConfigPresenter: Verify capability at runtime
        ConfigPresenter-->>Runtime: false or undefined
        Runtime->>Runtime: Omit temperature from request
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #1040: Adds capability-query methods to ConfigPresenter following the same pattern (capability detection per provider/model), enabling different capability types (verbosity/effort).
  • PR #973: Implements reasoning and search capability methods in ConfigPresenter and ModelCapabilities, establishing the foundational pattern that this PR extends for temperature control.
  • PR #1443: Adds temperature-specific capability resolution and provider endpoint handling in ConfigPresenter, directly related to runtime capability-aware request construction.

Suggested reviewers

  • zerob13

Poem

🐰 With whiskers twitching, we now know,
Which models dare the temperature flow,
Opus-4-7 says "not today!"
While others embrace the warmth we send their way,
Smart controls, no stone left unturned—
More elegant logic we've earned! 🌡️

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary change: wiring Anthropic temperature capability support into the model layer, which is the core feature addition across multiple files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/anthropic-temperature-capability

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (2)
test/renderer/components/ModelConfigDialog.test.ts (1)

71-73: Fallback path not exercised by this mock shape.

supportsTemperatureControl always resolves to a boolean (options.temperatureCapability ?? true), so the component code only ever takes the first branch of the typeof === 'boolean' check. The fallback to getTemperatureCapability is never verified. If you want to keep the fallback path meaningful, consider having one mock return undefined/non-boolean and asserting the other is consulted — otherwise the getTemperatureCapability mock is effectively dead code in every test.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/renderer/components/ModelConfigDialog.test.ts` around lines 71 - 73, The
mock for supportsTemperatureControl always returns a boolean, so the component's
typeof === 'boolean' branch always runs and the fallback to
getTemperatureCapability is never exercised; change the mock shape in
ModelConfigDialog tests so one scenario returns a non-boolean/undefined from
supportsTemperatureControl (via vi.fn().mockResolvedValue(undefined) or similar)
and assert that getTemperatureCapability (mocked by getTemperatureCapability) is
then called/used; alternatively add an explicit test case that stubs
supportsTemperatureControl to a non-boolean and verifies
getTemperatureCapability is consulted.
src/main/presenter/configPresenter/modelCapabilities.ts (1)

509-512: getTemperatureCapability only looks up the exact provider/model pair.

Unlike getReasoningPortrait which falls back across providers via getModel/registry lookups, getTemperatureCapability uses getProviderMatch only. When a model is defined in the DB under a canonical provider but queried via an alias (or via a provider that hosts a proxied model without its own DB entry), the capability will be undefined and the code will rely on the name-pattern fallback. If that's the intended behavior (avoid mixing temperature rules across vendors), it's worth a short comment; otherwise consider delegating to getModel like the reasoning lookups.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/presenter/configPresenter/modelCapabilities.ts` around lines 509 -
512, getTemperatureCapability currently calls getProviderMatch(providerId,
modelId) and only returns a temperature when there's an exact provider/model DB
entry, which misses canonical-provider or alias lookups; either update
getTemperatureCapability to delegate to getModel(providerId, modelId) (the same
lookup used by getReasoningPortrait) so aliases and registry fallbacks are
honored, or if exact-provider semantics are intentional add a concise comment
above getTemperatureCapability explaining that it deliberately avoids
cross-provider/alias fallbacks; reference getTemperatureCapability,
getProviderMatch, getModel, and getReasoningPortrait when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@resources/model-db/providers.json`:
- Around line 192720-192763: Add the missing "temperature": false flag to the
Claude Opus 4.7 provider entry (identify by id "claude-opus-4-7" / display_name
"claude-opus-4-7") so it matches other Anthropic Claude Opus 4.7 variants;
update the JSON object for that provider to include "temperature": false at the
same top-level position used by other Anthropic entries to ensure the runtime
capability check treats temperature as unsupported.
- Around line 186475-186497: The entry for id
"meta-llama/llama-guard-4-12b:free" is incorrectly marked as "type":
"imageGeneration"; change its "type" to a text/guard/classification type (e.g.,
"text" or "classification") so it is routed to the text/guard pipeline in the
UI, leaving modalities, tool_call, and reasoning unchanged; update only the
"type" field for the object where id equals "meta-llama/llama-guard-4-12b:free".
- Around line 183945-183988: The provider entry for anthropic/claude-opus-4.7 is
incorrectly labeled as an image generation model and missing the temperature
flag; update the object with id "anthropic/claude-opus-4.7" to use the correct
type for chat/reasoning models (change "type": "imageGeneration" to the
chat/text-completion type used elsewhere in the catalog) and add "temperature":
false to the top-level properties so temperature controls are disabled; ensure
reasoning-related fields remain unchanged and that the entry matches the
structure of other chat models in providers.json.
- Around line 164355-164444: The two AIHubMix provider entries with id
"claude-opus-4-7" and "claude-opus-4-7-think" are missing the temperature
capability flag; add "temperature": false to each provider object (same place
other Claude Opus 4.7 entries set it) so the runtime won’t send a temperature
field for these Anthropic-backed models; locate the objects by their id fields
and insert the flag alongside the other top-level provider properties.

In `@src/main/presenter/llmProviderPresenter/aiSdk/runtime.ts`:
- Around line 41-50: The hasAnthropicTemperatureFallback function currently
inspects only modelId and a narrow regex; change its signature to accept the
context (e.g., ModelCapabilities or a small object containing
capabilityProviderId) and early-return false unless capabilityProviderId ===
'anthropic', then broaden ANTHROPIC_TEMPERATURE_UNSUPPORTED_MODEL_PATTERN to
match date-suffixed and optional "-think" variants (suggested pattern:
/^claude-opus-4-7(?:-\d{8})?(?:-think)?$/) and update all call sites to pass the
context so the provider check is enforced; keep the function name and constant
(ANTHROPIC_TEMPERATURE_UNSUPPORTED_MODEL_PATTERN) but update usages accordingly.

---

Nitpick comments:
In `@src/main/presenter/configPresenter/modelCapabilities.ts`:
- Around line 509-512: getTemperatureCapability currently calls
getProviderMatch(providerId, modelId) and only returns a temperature when
there's an exact provider/model DB entry, which misses canonical-provider or
alias lookups; either update getTemperatureCapability to delegate to
getModel(providerId, modelId) (the same lookup used by getReasoningPortrait) so
aliases and registry fallbacks are honored, or if exact-provider semantics are
intentional add a concise comment above getTemperatureCapability explaining that
it deliberately avoids cross-provider/alias fallbacks; reference
getTemperatureCapability, getProviderMatch, getModel, and getReasoningPortrait
when making the change.

In `@test/renderer/components/ModelConfigDialog.test.ts`:
- Around line 71-73: The mock for supportsTemperatureControl always returns a
boolean, so the component's typeof === 'boolean' branch always runs and the
fallback to getTemperatureCapability is never exercised; change the mock shape
in ModelConfigDialog tests so one scenario returns a non-boolean/undefined from
supportsTemperatureControl (via vi.fn().mockResolvedValue(undefined) or similar)
and assert that getTemperatureCapability (mocked by getTemperatureCapability) is
then called/used; alternatively add an explicit test case that stubs
supportsTemperatureControl to a non-boolean and verifies
getTemperatureCapability is consulted.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 298ae968-5098-49b9-b53d-173f33591f11

📥 Commits

Reviewing files that changed from the base of the PR and between 06c9ddb and 443b82c.

📒 Files selected for processing (11)
  • resources/acp-registry/registry.json
  • resources/model-db/providers.json
  • src/main/presenter/configPresenter/index.ts
  • src/main/presenter/configPresenter/modelCapabilities.ts
  • src/main/presenter/llmProviderPresenter/aiSdk/runtime.ts
  • src/renderer/src/components/chat/ChatStatusBar.vue
  • src/renderer/src/components/settings/ModelConfigDialog.vue
  • src/shared/types/presenters/legacy.presenters.d.ts
  • test/main/presenter/llmProviderPresenter/aiSdkRuntime.test.ts
  • test/renderer/components/ChatStatusBar.test.ts
  • test/renderer/components/ModelConfigDialog.test.ts

Comment on lines +164355 to +164444
"id": "claude-opus-4-7",
"name": "claude-opus-4-7",
"display_name": "claude-opus-4-7",
"modalities": {
"input": [
"text",
"image"
]
},
"limit": {
"context": 8192,
"output": 8192
"context": 200000,
"output": 200000
},
"tool_call": false,
"tool_call": true,
"reasoning": {
"supported": false
"supported": true,
"default": true
},
"extra_capabilities": {
"reasoning": {
"supported": true,
"default_enabled": false,
"mode": "budget",
"budget": {
"min": 1024,
"unit": "tokens"
},
"interleaved": true,
"summaries": true,
"visibility": "summary",
"continuation": [
"thinking_blocks"
],
"notes": [
"Anthropic uses thinking budget tokens"
]
}
},
"cost": {
"input": 2,
"output": 0,
"cache_read": 0
"input": 5,
"output": 25,
"cache_read": 0.5
},
"type": "imageGeneration"
"type": "chat"
},
{
"id": "qwen-image-2.0-pro",
"name": "qwen-image-2.0-pro",
"display_name": "qwen-image-2.0-pro",
"id": "claude-opus-4-7-think",
"name": "claude-opus-4-7-think",
"display_name": "claude-opus-4-7-think",
"modalities": {
"input": [
"text",
"image"
"image",
"text"
]
},
"limit": {
"context": 8192,
"output": 8192
"context": 200000,
"output": 200000
},
"tool_call": false,
"tool_call": true,
"reasoning": {
"supported": false
"supported": true,
"default": true
},
"extra_capabilities": {
"reasoning": {
"supported": true,
"default_enabled": false,
"mode": "budget",
"budget": {
"min": 1024,
"unit": "tokens"
},
"interleaved": true,
"summaries": true,
"visibility": "summary",
"continuation": [
"thinking_blocks"
],
"notes": [
"Anthropic uses thinking budget tokens"
]
}
},
"cost": {
"input": 2,
"output": 0,
"cache_read": 0
"input": 5,
"output": 25,
"cache_read": 0.5
},
"type": "imageGeneration"
"type": "chat"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Missing "temperature": false on AIHubMix claude-opus-4-7 and claude-opus-4-7-think.

These are Anthropic Claude Opus 4.7 variants proxied via AIHubMix. All other Claude Opus 4.7 entries added in this PR (e.g., hunks 2, 3, 8, 11, 18-19, 92) correctly set "temperature": false, matching the temperature-capability wiring introduced in modelCapabilities.ts/runtime.ts. These two AIHubMix entries omit the flag, so the runtime will still send temperature for them via AIHubMix, which contradicts the PR's objective and may be rejected by the upstream Anthropic API.

🐛 Proposed fix
         {
           "id": "claude-opus-4-7",
           "name": "claude-opus-4-7",
           "display_name": "claude-opus-4-7",
           "modalities": {
             "input": [
               "text",
               "image"
             ]
           },
           "limit": {
             "context": 200000,
             "output": 200000
           },
+          "temperature": false,
           "tool_call": true,
           "reasoning": {
             ...
           },
           ...
           "type": "chat"
         },
         {
           "id": "claude-opus-4-7-think",
           ...
           "limit": {
             "context": 200000,
             "output": 200000
           },
+          "temperature": false,
           "tool_call": true,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"id": "claude-opus-4-7",
"name": "claude-opus-4-7",
"display_name": "claude-opus-4-7",
"modalities": {
"input": [
"text",
"image"
]
},
"limit": {
"context": 8192,
"output": 8192
"context": 200000,
"output": 200000
},
"tool_call": false,
"tool_call": true,
"reasoning": {
"supported": false
"supported": true,
"default": true
},
"extra_capabilities": {
"reasoning": {
"supported": true,
"default_enabled": false,
"mode": "budget",
"budget": {
"min": 1024,
"unit": "tokens"
},
"interleaved": true,
"summaries": true,
"visibility": "summary",
"continuation": [
"thinking_blocks"
],
"notes": [
"Anthropic uses thinking budget tokens"
]
}
},
"cost": {
"input": 2,
"output": 0,
"cache_read": 0
"input": 5,
"output": 25,
"cache_read": 0.5
},
"type": "imageGeneration"
"type": "chat"
},
{
"id": "qwen-image-2.0-pro",
"name": "qwen-image-2.0-pro",
"display_name": "qwen-image-2.0-pro",
"id": "claude-opus-4-7-think",
"name": "claude-opus-4-7-think",
"display_name": "claude-opus-4-7-think",
"modalities": {
"input": [
"text",
"image"
"image",
"text"
]
},
"limit": {
"context": 8192,
"output": 8192
"context": 200000,
"output": 200000
},
"tool_call": false,
"tool_call": true,
"reasoning": {
"supported": false
"supported": true,
"default": true
},
"extra_capabilities": {
"reasoning": {
"supported": true,
"default_enabled": false,
"mode": "budget",
"budget": {
"min": 1024,
"unit": "tokens"
},
"interleaved": true,
"summaries": true,
"visibility": "summary",
"continuation": [
"thinking_blocks"
],
"notes": [
"Anthropic uses thinking budget tokens"
]
}
},
"cost": {
"input": 2,
"output": 0,
"cache_read": 0
"input": 5,
"output": 25,
"cache_read": 0.5
},
"type": "imageGeneration"
"type": "chat"
"id": "claude-opus-4-7",
"name": "claude-opus-4-7",
"display_name": "claude-opus-4-7",
"modalities": {
"input": [
"text",
"image"
]
},
"limit": {
"context": 200000,
"output": 200000
},
"temperature": false,
"tool_call": true,
"reasoning": {
"supported": true,
"default": true
},
"extra_capabilities": {
"reasoning": {
"supported": true,
"default_enabled": false,
"mode": "budget",
"budget": {
"min": 1024,
"unit": "tokens"
},
"interleaved": true,
"summaries": true,
"visibility": "summary",
"continuation": [
"thinking_blocks"
],
"notes": [
"Anthropic uses thinking budget tokens"
]
}
},
"cost": {
"input": 5,
"output": 25,
"cache_read": 0.5
},
"type": "chat"
},
{
"id": "claude-opus-4-7-think",
"name": "claude-opus-4-7-think",
"display_name": "claude-opus-4-7-think",
"modalities": {
"input": [
"image",
"text"
]
},
"limit": {
"context": 200000,
"output": 200000
},
"temperature": false,
"tool_call": true,
"reasoning": {
"supported": true,
"default": true
},
"extra_capabilities": {
"reasoning": {
"supported": true,
"default_enabled": false,
"mode": "budget",
"budget": {
"min": 1024,
"unit": "tokens"
},
"interleaved": true,
"summaries": true,
"visibility": "summary",
"continuation": [
"thinking_blocks"
],
"notes": [
"Anthropic uses thinking budget tokens"
]
}
},
"cost": {
"input": 5,
"output": 25,
"cache_read": 0.5
},
"type": "chat"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@resources/model-db/providers.json` around lines 164355 - 164444, The two
AIHubMix provider entries with id "claude-opus-4-7" and "claude-opus-4-7-think"
are missing the temperature capability flag; add "temperature": false to each
provider object (same place other Claude Opus 4.7 entries set it) so the runtime
won’t send a temperature field for these Anthropic-backed models; locate the
objects by their id fields and insert the flag alongside the other top-level
provider properties.

Comment on lines +183945 to +183988
{
"id": "anthropic/claude-opus-4.7",
"name": "Anthropic: Claude Opus 4.7",
"display_name": "Anthropic: Claude Opus 4.7",
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 1000000,
"output": 128000
},
"tool_call": true,
"reasoning": {
"supported": true,
"default": true
},
"extra_capabilities": {
"reasoning": {
"supported": true,
"default_enabled": false,
"mode": "budget",
"budget": {
"min": 1024,
"unit": "tokens"
},
"interleaved": true,
"summaries": true,
"visibility": "summary",
"continuation": [
"thinking_blocks"
],
"notes": [
"Anthropic uses thinking budget tokens"
]
}
},
"type": "imageGeneration"
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Wrong type — Claude Opus 4.7 marked as imageGeneration.

anthropic/claude-opus-4.7 is a chat/reasoning model, but this entry sets "type": "imageGeneration". This will cause the model to be mis-routed in the UI and in the providers that consume this catalog (it will appear under image generation rather than chat, and temperature/reasoning wiring for chat paths won't apply). Note this entry also lacks the "temperature": false flag that's central to this PR.

🐛 Proposed fix
           "notes": [
             "Anthropic uses thinking budget tokens"
           ]
         }
       },
-      "type": "imageGeneration"
+      "temperature": false,
+      "type": "chat"
     },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
"id": "anthropic/claude-opus-4.7",
"name": "Anthropic: Claude Opus 4.7",
"display_name": "Anthropic: Claude Opus 4.7",
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 1000000,
"output": 128000
},
"tool_call": true,
"reasoning": {
"supported": true,
"default": true
},
"extra_capabilities": {
"reasoning": {
"supported": true,
"default_enabled": false,
"mode": "budget",
"budget": {
"min": 1024,
"unit": "tokens"
},
"interleaved": true,
"summaries": true,
"visibility": "summary",
"continuation": [
"thinking_blocks"
],
"notes": [
"Anthropic uses thinking budget tokens"
]
}
},
"type": "imageGeneration"
},
{
"id": "anthropic/claude-opus-4.7",
"name": "Anthropic: Claude Opus 4.7",
"display_name": "Anthropic: Claude Opus 4.7",
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 1000000,
"output": 128000
},
"tool_call": true,
"reasoning": {
"supported": true,
"default": true
},
"extra_capabilities": {
"reasoning": {
"supported": true,
"default_enabled": false,
"mode": "budget",
"budget": {
"min": 1024,
"unit": "tokens"
},
"interleaved": true,
"summaries": true,
"visibility": "summary",
"continuation": [
"thinking_blocks"
],
"notes": [
"Anthropic uses thinking budget tokens"
]
}
},
"temperature": false,
"type": "chat"
},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@resources/model-db/providers.json` around lines 183945 - 183988, The provider
entry for anthropic/claude-opus-4.7 is incorrectly labeled as an image
generation model and missing the temperature flag; update the object with id
"anthropic/claude-opus-4.7" to use the correct type for chat/reasoning models
(change "type": "imageGeneration" to the chat/text-completion type used
elsewhere in the catalog) and add "temperature": false to the top-level
properties so temperature controls are disabled; ensure reasoning-related fields
remain unchanged and that the entry matches the structure of other chat models
in providers.json.

Comment on lines +186475 to +186497
{
"id": "meta-llama/llama-guard-4-12b:free",
"name": "Meta: Llama Guard 4 12B (free)",
"display_name": "Meta: Llama Guard 4 12B (free)",
"modalities": {
"input": [
"image",
"text"
],
"output": [
"text"
]
},
"limit": {
"context": 163840,
"output": 65000
},
"tool_call": false,
"reasoning": {
"supported": false
},
"type": "imageGeneration"
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Wrong type — Llama Guard 4 12B is not an image-generation model.

meta-llama/llama-guard-4-12b:free is a text classification/guard model (text+image input, text output) with tool_call: false and no reasoning. Marking it as "type": "imageGeneration" will misclassify it in the UI and route it through the wrong pipeline.

🐛 Proposed fix
           "reasoning": {
             "supported": false
           },
-          "type": "imageGeneration"
+          "type": "chat"
         },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
"id": "meta-llama/llama-guard-4-12b:free",
"name": "Meta: Llama Guard 4 12B (free)",
"display_name": "Meta: Llama Guard 4 12B (free)",
"modalities": {
"input": [
"image",
"text"
],
"output": [
"text"
]
},
"limit": {
"context": 163840,
"output": 65000
},
"tool_call": false,
"reasoning": {
"supported": false
},
"type": "imageGeneration"
},
{
"id": "meta-llama/llama-guard-4-12b:free",
"name": "Meta: Llama Guard 4 12B (free)",
"display_name": "Meta: Llama Guard 4 12B (free)",
"modalities": {
"input": [
"image",
"text"
],
"output": [
"text"
]
},
"limit": {
"context": 163840,
"output": 65000
},
"tool_call": false,
"reasoning": {
"supported": false
},
"type": "chat"
},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@resources/model-db/providers.json` around lines 186475 - 186497, The entry
for id "meta-llama/llama-guard-4-12b:free" is incorrectly marked as "type":
"imageGeneration"; change its "type" to a text/guard/classification type (e.g.,
"text" or "classification") so it is routed to the text/guard pipeline in the
UI, leaving modalities, tool_call, and reasoning unchanged; update only the
"type" field for the object where id equals "meta-llama/llama-guard-4-12b:free".

Comment on lines +192720 to +192763
{
"id": "claude-opus-4-7",
"name": "claude-opus-4-7",
"display_name": "claude-opus-4-7",
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 1000000,
"output": 128000
},
"tool_call": true,
"reasoning": {
"supported": true,
"default": true
},
"extra_capabilities": {
"reasoning": {
"supported": true,
"default_enabled": false,
"mode": "budget",
"budget": {
"min": 1024,
"unit": "tokens"
},
"interleaved": true,
"summaries": true,
"visibility": "summary",
"continuation": [
"thinking_blocks"
],
"notes": [
"Anthropic uses thinking budget tokens"
]
}
},
"type": "chat"
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Missing "temperature": false on this claude-opus-4-7 entry.

Consistent with the critique on the AIHubMix entries: every Anthropic Claude Opus 4.7 variant in this file sets "temperature": false except this one. If this entry reaches an Anthropic-backed endpoint, the runtime will still include temperature because the capability check reads the flag from the catalog.

🐛 Proposed fix
           "limit": {
             "context": 1000000,
             "output": 128000
           },
+          "temperature": false,
           "tool_call": true,
           "reasoning": {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
"id": "claude-opus-4-7",
"name": "claude-opus-4-7",
"display_name": "claude-opus-4-7",
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 1000000,
"output": 128000
},
"tool_call": true,
"reasoning": {
"supported": true,
"default": true
},
"extra_capabilities": {
"reasoning": {
"supported": true,
"default_enabled": false,
"mode": "budget",
"budget": {
"min": 1024,
"unit": "tokens"
},
"interleaved": true,
"summaries": true,
"visibility": "summary",
"continuation": [
"thinking_blocks"
],
"notes": [
"Anthropic uses thinking budget tokens"
]
}
},
"type": "chat"
},
{
"id": "claude-opus-4-7",
"name": "claude-opus-4-7",
"display_name": "claude-opus-4-7",
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 1000000,
"output": 128000
},
"temperature": false,
"tool_call": true,
"reasoning": {
"supported": true,
"default": true
},
"extra_capabilities": {
"reasoning": {
"supported": true,
"default_enabled": false,
"mode": "budget",
"budget": {
"min": 1024,
"unit": "tokens"
},
"interleaved": true,
"summaries": true,
"visibility": "summary",
"continuation": [
"thinking_blocks"
],
"notes": [
"Anthropic uses thinking budget tokens"
]
}
},
"type": "chat"
},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@resources/model-db/providers.json` around lines 192720 - 192763, Add the
missing "temperature": false flag to the Claude Opus 4.7 provider entry
(identify by id "claude-opus-4-7" / display_name "claude-opus-4-7") so it
matches other Anthropic Claude Opus 4.7 variants; update the JSON object for
that provider to include "temperature": false at the same top-level position
used by other Anthropic entries to ensure the runtime capability check treats
temperature as unsupported.

Comment on lines +41 to +50
const ANTHROPIC_TEMPERATURE_UNSUPPORTED_MODEL_PATTERN = /^claude-opus-4-7(?:$|-think$)/

function hasAnthropicTemperatureFallback(modelId: string): boolean {
const normalizedModelId = modelId.toLowerCase()
const unprefixedModelId = normalizedModelId.includes('/')
? normalizedModelId.slice(normalizedModelId.lastIndexOf('/') + 1)
: normalizedModelId

return ANTHROPIC_TEMPERATURE_UNSUPPORTED_MODEL_PATTERN.test(unprefixedModelId)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

Anthropic Claude Opus 4 model id naming convention date suffix

💡 Result:

Anthropic's Claude model IDs, including for Claude Opus 4, follow a naming convention of "claude-[model_family]-[version]-[YYYYMMDD]" for specific versions, where the date suffix (YYYYMMDD) is a snapshot date indicating the exact model snapshot. This ensures models with the same snapshot date are identical across platforms and do not change, providing stable performance. For example, the initial Claude Opus 4 model ID is "claude-opus-4-20250514" (released May 22, 2025). Later Opus 4 variants include dated suffixes like "claude-opus-4-1-20250805" and "claude-opus-4-5-20251101". Newer models like "claude-opus-4-6" and "claude-opus-4-7" use a simplified "[family]-[version]-[subversion]" format without dates for aliases pointing to the latest, but specific pinned versions retain the date suffix. Aliases like "claude-opus-4-0" resolve to the dated ID "claude-opus-4-20250514".

Citations:


🏁 Script executed:

cat -n src/main/presenter/llmProviderPresenter/aiSdk/runtime.ts | head -60

Repository: ThinkInAIXYZ/deepchat

Length of output: 2775


🏁 Script executed:

rg 'hasAnthropicTemperatureFallback' --type ts --type tsx -A 5 -B 5

Repository: ThinkInAIXYZ/deepchat

Length of output: 92


🏁 Script executed:

rg 'ModelCapabilities' --type ts --type tsx -l | head -5

Repository: ThinkInAIXYZ/deepchat

Length of output: 92


🏁 Script executed:

rg 'hasAnthropicTemperatureFallback' -A 5 -B 5

Repository: ThinkInAIXYZ/deepchat

Length of output: 1943


🏁 Script executed:

rg 'ModelCapabilities' -B 3 -A 3

Repository: ThinkInAIXYZ/deepchat

Length of output: 11761


🏁 Script executed:

sed -n '52,75p' src/main/presenter/llmProviderPresenter/aiSdk/runtime.ts

Repository: ThinkInAIXYZ/deepchat

Length of output: 740


🏁 Script executed:

rg 'supportsTemperatureControl' -B 3 -A 3

Repository: ThinkInAIXYZ/deepchat

Length of output: 10190


Tighten fallback to Anthropic provider and broaden model pattern.

The hasAnthropicTemperatureFallback function has two fragility issues:

  1. Unverified provider: It matches model IDs without confirming the provider is Anthropic. A proxy provider exposing a model id containing claude-opus-4-7 will also strip temperature. Pass context to the function and gate on capabilityProviderId being Anthropic.

  2. Pattern too narrow: The regex /^claude-opus-4-7(?:$|-think$)/ misses date-suffixed variants like claude-opus-4-7-YYYYMMDD which Anthropic uses in production. Broaden to /^claude-opus-4-7(?:-\d{8})?(?:-think)?$/.

Since ModelCapabilities owns the proper capability logic, consider whether this regex fallback is still needed. If kept, scope it to Anthropic and widen the pattern.

🔧 Suggested fix
-function hasAnthropicTemperatureFallback(modelId: string): boolean {
-  const normalizedModelId = modelId.toLowerCase()
-  const unprefixedModelId = normalizedModelId.includes('/')
-    ? normalizedModelId.slice(normalizedModelId.lastIndexOf('/') + 1)
-    : normalizedModelId
-
-  return ANTHROPIC_TEMPERATURE_UNSUPPORTED_MODEL_PATTERN.test(unprefixedModelId)
-}
+const ANTHROPIC_TEMPERATURE_UNSUPPORTED_MODEL_PATTERN = /^claude-opus-4-7(?:-\d{8})?(?:-think)?$/
+
+function hasAnthropicTemperatureFallback(
+  context: AiSdkRuntimeContext,
+  modelId: string
+): boolean {
+  const providerId = (context.provider.capabilityProviderId || context.provider.id).toLowerCase()
+  if (!providerId.includes('anthropic')) {
+    return false
+  }
+  const normalizedModelId = modelId.toLowerCase()
+  const unprefixedModelId = normalizedModelId.includes('/')
+    ? normalizedModelId.slice(normalizedModelId.lastIndexOf('/') + 1)
+    : normalizedModelId
+
+  return ANTHROPIC_TEMPERATURE_UNSUPPORTED_MODEL_PATTERN.test(unprefixedModelId)
+}

Update the call site to pass context:

-  if (hasAnthropicTemperatureFallback(modelId)) {
+  if (hasAnthropicTemperatureFallback(context, modelId)) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const ANTHROPIC_TEMPERATURE_UNSUPPORTED_MODEL_PATTERN = /^claude-opus-4-7(?:$|-think$)/
function hasAnthropicTemperatureFallback(modelId: string): boolean {
const normalizedModelId = modelId.toLowerCase()
const unprefixedModelId = normalizedModelId.includes('/')
? normalizedModelId.slice(normalizedModelId.lastIndexOf('/') + 1)
: normalizedModelId
return ANTHROPIC_TEMPERATURE_UNSUPPORTED_MODEL_PATTERN.test(unprefixedModelId)
}
const ANTHROPIC_TEMPERATURE_UNSUPPORTED_MODEL_PATTERN = /^claude-opus-4-7(?:-\d{8})?(?:-think)?$/
function hasAnthropicTemperatureFallback(
context: AiSdkRuntimeContext,
modelId: string
): boolean {
const providerId = (context.provider.capabilityProviderId || context.provider.id).toLowerCase()
if (!providerId.includes('anthropic')) {
return false
}
const normalizedModelId = modelId.toLowerCase()
const unprefixedModelId = normalizedModelId.includes('/')
? normalizedModelId.slice(normalizedModelId.lastIndexOf('/') + 1)
: normalizedModelId
return ANTHROPIC_TEMPERATURE_UNSUPPORTED_MODEL_PATTERN.test(unprefixedModelId)
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/presenter/llmProviderPresenter/aiSdk/runtime.ts` around lines 41 -
50, The hasAnthropicTemperatureFallback function currently inspects only modelId
and a narrow regex; change its signature to accept the context (e.g.,
ModelCapabilities or a small object containing capabilityProviderId) and
early-return false unless capabilityProviderId === 'anthropic', then broaden
ANTHROPIC_TEMPERATURE_UNSUPPORTED_MODEL_PATTERN to match date-suffixed and
optional "-think" variants (suggested pattern:
/^claude-opus-4-7(?:-\d{8})?(?:-think)?$/) and update all call sites to pass the
context so the provider check is enforced; keep the function name and constant
(ANTHROPIC_TEMPERATURE_UNSUPPORTED_MODEL_PATTERN) but update usages accordingly.

@zerob13
zerob13 merged commit f838ef7 into dev Apr 17, 2026
6 checks passed
@zhangmo8
zhangmo8 deleted the feat/anthropic-temperature-capability branch April 21, 2026 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants