Skip to content

[Bug]: anthropic.rs has same temperature: f64 shape as Bedrock pre-#6144 — verify whether native Anthropic API rejects for opus-4-7 #6147

@JordanTheJet

Description

@JordanTheJet

Affected component

provider

Severity

S2 - degraded behavior

Conservative — would escalate to S1 if confirmed, since it'd block opus-4-7 on the native Anthropic provider exactly the way #6095 blocked it on Bedrock. May also be a non-issue if Anthropic's native API is more permissive than Bedrock's Converse API.

Current behavior

Suspected — needs reproduction. PR #6144 (just merged as 5d31172) fixed crates/zeroclaw-providers/src/bedrock.rs where InferenceConfig.temperature: f64 was always serialized, causing a non-retryable Bedrock 400 (temperature is deprecated for this model) on claude-opus-4-7.

The Anthropic native provider has the structurally identical shape on master at the time of #6144 merge:

// crates/zeroclaw-providers/src/anthropic.rs:32
struct NativeChatRequest {
    ...
    temperature: f64,  // not Option, no skip_serializing_if
}

// crates/zeroclaw-providers/src/anthropic.rs:64 — second request struct, same shape

Both are reachable from chat_with_system (anthropic.rs:799) and chat (anthropic.rs:872) production paths via let temperature = temperature.unwrap_or(self.default_temperature()) followed by unconditional inclusion in the request body. There is no code path that can omit temperature for any model.

Unknown: whether the native Anthropic API (api.anthropic.com/v1/messages) actually rejects temperature for claude-opus-4-7 the way Bedrock does. Bedrock and the native API use different infrastructure and may not share the deprecation. Need a live repro to confirm.

Expected behavior

If the native Anthropic API also rejects temperature for claude-opus-4-7:

If the native API accepts temperature for claude-opus-4-7:

  • Document the divergence between Bedrock and native (one rejects, one accepts) so future contributors don't get surprised.
  • Close this issue as "not a bug, divergence documented".

Steps to reproduce

# 1. Build current master (post-#6144)
cargo build --release

# 2. Configure native Anthropic provider with opus-4-7
# ~/.zeroclaw/config.toml:
#   [providers.models.anthropic]
#   model = "claude-opus-4-7"
# Set ANTHROPIC_API_KEY in env.

# 3. Send any message
zeroclaw  # interactive mode, send "hi"

# 4. Observe whether the request 400s with "temperature is deprecated for this model"
#    or completes successfully.

If the request 400s with the temperature-deprecation message, this issue is confirmed at S1 and needs the same fix shape as #6144. If it completes, close as non-issue + add a comment to the divergence (Bedrock rejects, native accepts).

Impact

No response

Logs / stack traces

No response (pending repro)

ZeroClaw version

master post-#6144 (squash commit 5d31172)

Rust version

No response

Operating system

No response (any — bug is in serialization, OS-independent)

Regression?

Unknown

Additional context

Pre-flight checks

  • I reproduced this on the latest master branch or latest release.
  • I redacted secrets, tokens, and personal data from all submitted content.

Note: first checkbox is technically inaccurate — this is a suspected-issue file, not a confirmed repro. Will edit with confirmed/refuted status once someone runs the repro.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:p1High priorityproviderAuto scope: src/providers/** changed.provider:anthropicAuto module: provider/anthropic changed.risk: lowAuto risk: docs/chore-only paths.status:acceptedRFC or work item accepted and ratified by the team.status:no-staleExempt from the 60-day stale auto-close policy.

    Type

    No type

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions