anomalyco / anomalyco/opencode

sap-ai-core: Claude models fail with 400 "does not support assistant message prefill"

Open
#45,313 1 comment 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Aug 26, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Bug Report

OpenCode Version: 1.18.23
Provider: sap-ai-core
Model: sap-ai-core/anthropic--claude-4.6-sonnet (affects all sap-ai-core/anthropic--* models)

Description

When using any Anthropic/Claude model through the SAP AI Core provider, every response is followed by a 400 error:

400 - LLM Module: This model does not support assistant message prefill.
The conversation must end with a user message.
Steps to Reproduce
  1. Configure OpenCode with sap-ai-core provider and any anthropic--* model
  2. Send any message (e.g. "Hi")
  3. Receive a response
  4. Observe 400 error immediately after
Root Cause

OpenCode appends a partial assistant message at the end of the conversation (assistant prefill) to steer the model's response. The SAP AI Core Orchestration API rejects this — it requires conversations to always end with a user message.

Relevant source file:
packages/opencode/src/provider/provider.tssap-ai-core custom loader

The fix requires stripping any trailing assistant message before sending to SAP AI Core, or disabling prefill specifically for this provider.

Expected Behavior

Messages to SAP AI Core Claude models should not include a trailing assistant message. The conversation should always end with a user message.

Workaround

None currently available via config. The only workaround is to not use Anthropic/Claude models through SAP AI Core.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.