Skip to content

v0.12.1 – /v1/messages accepts Claude Code's system messages (router 0.6.1)

Choose a tag to compare

@psewar psewar released this 01 Oct 07:36
· 9 commits to main since this release

Router 0.6.1, agent unchanged (0.16.0). Fix for /v1/messages with Claude Code 2.x, found in the first acceptance run against the real CLI.

  • What went wrong: Claude Code sends a message with role: system inside messages (hints to the model after the first user turn, text blocks with cache_control). The public Messages API has no such role, and router 0.6.0 rejected the request with 400 messages.1: role must be 'user' or 'assistant'.
  • Now: such a message goes on to Ollama as a system message at the same position; empty ones are dropped.
  • thinking: {type: adaptive, display: omitted}, as Claude Code sends it, gives think: true. With display: omitted the router returns thinking blocks without text, as the API does, and sends ping events while the model thinks, so the stream does not go silent for minutes.
  • Selftest and end-to-end suite cover the request shape Claude Code 2.1 sends (?beta=true, context_management, output_config).
Deutsch

Router 0.6.1. Claude Code 2.x schickt innerhalb von messages eine Nachricht mit role: system, die es in der öffentlichen API nicht gibt; 0.6.0 lehnte die Anfrage mit 400 ab. Solche Nachrichten gehen jetzt an derselben Stelle als system-Nachricht an Ollama. thinking: {type: adaptive, display: omitted} ergibt think: true und Denkblöcke ohne Text, mit ping-Ereignissen, solange das Modell denkt.