Skip to content

Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

serve: trigger Claude Code system-role fallback

Jacky Jiang7f3b9e74d209
diff --git a/c/openai_server.py b/c/openai_server.py
index 0d5d69d6..d49b7bc1 100644
--- a/c/openai_server.py
+++ b/c/openai_server.py
@@ -745,7 +745,7 @@ def anthropic_to_openai(body):
raise APIError(400, "Each message must be an object.", f"messages.{index}")
role = message.get("role")
if role not in ("user", "assistant"):
- raise APIError(400, f"Unsupported message role: {role!r}. Anthropic messages are "
+ raise APIError(400, f"Input message role {role!r} is not supported. Anthropic messages are "
"`user` or `assistant`; a system prompt goes in the top-level `system`.",
f"messages.{index}.role", "unsupported_role")
content = message.get("content")
diff --git a/c/tests/test_anthropic_messages.py b/c/tests/test_anthropic_messages.py
index fcb7088f..1118ac45 100644
--- a/c/tests/test_anthropic_messages.py
+++ b/c/tests/test_anthropic_messages.py
@@ -11,6 +11,7 @@ is the reference client from the issue — not merely that the handler returns 2
- the Anthropic error envelope, which is not the OpenAI one.
"""
import json
+import re
import threading
import unittest
from urllib.error import HTTPError
@@ -102,10 +103,15 @@ class TranslationTest(unittest.TestCase):
self.assertEqual(anthropic_tools({"tool_choice": {"type": "any"}})[1], "required")
self.assertEqual(anthropic_tools({"tool_choice": {"type": "auto"}})[1], "auto")
- def test_rejects_system_role_in_messages(self):
+ def test_system_role_rejection_triggers_claude_code_fallback(self):
with self.assertRaises(APIError) as caught:
anthropic_to_openai({"messages": [{"role": "system", "content": "no"}]})
- self.assertIn("system", caught.exception.message)
+ error = caught.exception
+ self.assertEqual(error.status, 400)
+ # Claude Code 2.1.212 retries without its model-gated mid-conversation
+ # system turn only when the upstream rejection matches this contract.
+ self.assertIn("not supported", error.message)
+ self.assertRegex(error.message, re.compile(r"role .{0,2}system", re.IGNORECASE))
class MessagesHTTPTest(unittest.TestCase):