AI model compatibility: temperature is always sent, but Claude Haiku 5.5 requires it omitted

Issue Description

Stalwart’s AI integration always includes a numeric temperature in completion requests. Claude Haiku 5.5 rejects this parameter, preventing its use through an otherwise compatible OpenAI-style endpoint.

Relevant implementation

In crates/common/src/enterprise/llm.rs, both ChatCompletionRequest and TextCompletionRequest define temperature as f64. Request construction uses:

temperature: temperature.unwrap_or(self.default_temperature),

Anthropic’s Haiku 5.5 migration guidance requires omitting temperature, top_p, and top_k.

Expected Behavior

Allow temperature to be omitted from requests for models that do not support it, while preserving existing behavior for other models.

Actual Behavior

Stalwart always sends a temperature parameter, the API call is rejected by Anthropic.

Reproduction Steps

  1. Configure an AiModel using an OpenAI-compatible endpoint routing to Claude Haiku 5.5.
  2. Invoke it with a synthetic prompt.
  3. The request includes temperature, and the provider rejects it.

Omitting temperature at the call site does not help: Stalwart substitutes the configured default. Setting it to 0 still sends the parameter.

Stalwart Version

v0.16.x

Installation Method

Binary (Linux)

Database Backend

PostgreSQL

Blob Storage

Filesystem

Search Engine

Meilisearch

Directory Backend

Internal

I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

I confirmed this against the current source and docs: temperature is indeed a required f64 field on AiModel, with no configuration option to omit it, and the request builder in crates/common/src/enterprise/llm.rs always sets temperature: temperature.unwrap_or(self.default_temperature) when serializing both ChatCompletionRequest and TextCompletionRequest. There’s no existing option to skip sending it for models like Claude Haiku that reject the field.

This is a legitimate gap rather than a documented setting I’m missing, so I can’t point you to a workaround in the docs.

This isn’t covered in the current docs. A community member or staff member will follow up.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

Yes, 0.16 always sends it. The field is a plain number in both request types and an empty value falls back to the model’s default temperature, so no setting gets it out of the request.

This is fixed in v1.0.0, which is out this week. Temperature on the AI model is optional there and left out of the request entirely when it’s empty, and 1.0 also adds a native Anthropic model type that talks to the Messages API directly (AI Models | Stalwart). Until you upgrade, the only workaround I know of is a small proxy in front of the endpoint that strips temperature.