Skip to content

claude-opus-4-7 fails with 'temperature is deprecated for this model' #2939

@LegendAlessandro-Liguori

Description

Summary

Calls to claude-opus-4-7 (configured via provider: anthropic) consistently fail with HTTP 400:

{"error":{"code":"invalid_request_error","message":"temperature is deprecated for this model.","type":"invalid_request_error"}}

The claude-opus-4-7 family no longer accepts the temperature parameter — sending it (even at the picoclaw default 0.7) returns a 400 before the model is invoked. There is no per-model config knob to suppress the field today, so every request to this model fails.

Reproduce

  1. Add a model entry:
    {
      "model_name": "claude-opus-4.7",
      "provider": "anthropic",
      "model": "claude-opus-4-7",
      "api_base": "https://api.anthropic.com/v1"
    }
  2. Set a valid sk-ant-… Anthropic API key for that entry (no auth_method).
  3. Send any chat message → 400 from Anthropic with the message above.

Where temperature is injected

  • pkg/agent/instance.go:178 — defaults temperature to 0.7 when agents.defaults.temperature is unset.
  • pkg/providers/openai_compat/provider.go:178-184 — always writes requestBody["temperature"] for the chat-completions path that the anthropic protocol routes through.
  • pkg/providers/anthropic_messages/provider.go:176-179 — same unconditional write for the native Messages API.

A workaround exists (set thinking_level: "off" on the model entry — only works in some cases) but the root cause is the unconditional temperature send.

Suggested fix

Skip the field for models that deprecate it, mirroring the existing kimi-k2 special case in openai_compat. PR follows.

Environment

  • picoclaw v0.2.7 (git_commit 71c877a, built 2026-04-22)
  • Docker image sipeed/picoclaw:launcher
  • Anthropic API

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions