You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Claude models behind OpenAI-compatible proxies get 400 prefill errors #20415
Claude models routed through non-native SDK paths (@ai-sdk/openai-compatible, GitHub Copilot, Azure AI / LiteLLM) fail with:
[400]: This model does not support assistant message prefill.
The conversation must end with a user message.
This is likely the shared root cause behind #19517 and #13768.
Root Cause
ProviderTransform in transform.ts uses three different conditions to detect Claude models, and they disagree:
Transform
Condition
Lines
Empty content stripping
api.npm === "@ai-sdk/anthropic"
L56
Tool call ID scrubbing
api.id.includes("claude")
L76
Prompt caching
providerID || api.id || model.id || api.npm
L282-287
When a Claude model uses any SDK other than @ai-sdk/anthropic — proxies, Copilot, Azure AI — caching activates but empty-content stripping does not. Empty assistant messages survive, get cache metadata, and Anthropic rejects them as prefill.
Reproduction
Configure a Claude model through an OpenAI-compatible proxy with a model name containing "claude"
Use it in a multi-agent conversation with tool calls
After several turns, the request fails with the prefill error
Fix
PR #20414 — extracts isClaudeModel() helper used at all three detection sites.
Activity
github-actions commentedon Apr 1, 2026
This issue might be a duplicate of existing issues. Please check:
github-actions commentedon Jul 4, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.