expect(res.status).toBe(400);
});
+
+ test("accepts developer role (GPT-5.x compatibility)", async () => {
+ const res = await app.request("/openai/v1/chat/completions", {
+ method: "POST",
+ body: JSON.stringify({
+ messages: [
+ { role: "developer", content: "You are a helpful assistant" },
+ { role: "user", content: "Hello" },
+ ],
+ model: "gpt-5.2",
+ }),
+ headers: { "Content-Type": "application/json" },
+ });
+
+ // Should not be 400 (validation passed)
+ // Will be 401/502 without API key, but that's fine - we're testing validation
+ expect(res.status).not.toBe(400);
+ });
});
describe("GET /openai/v1/models", () => {
.array(
z
.object({
- role: z.enum(["system", "user", "assistant", "tool"]),
+ role: z.enum(["system", "developer", "user", "assistant", "tool", "function"]),
content: z.union([z.string(), z.array(z.any()), z.null()]).optional(),
})
.passthrough(), // Allow additional fields like name, tool_calls, etc.
* Supports both text-only (content: string) and multimodal (content: array) formats
*/
export interface ChatMessage {
- role: "system" | "user" | "assistant";
+ role: "system" | "developer" | "user" | "assistant";
content: MessageContent;
}