#!/usr/bin/env node import 'express-async-errors'; export type Role = 'user' | 'assistant' | 'system'; export type Action = 'next' | 'variant'; export interface APIMessage { role: Role; content: string; } export interface APIRequest { model: string; action: Action; prompt?: string | string[]; messages: APIMessage[]; stream?: boolean; } export interface APIResponse { whisper?: string; usage?: { prompt_tokens: number; completion_tokens: number; total_tokens: number; }; choices: { text: string; delta?: APIMessage; message: APIMessage; finish_reason?: string; }[]; } /** curl http://127.0.0.1:8000/api/completions \ -H "accept: text/event-stream" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-3.5", "messages": [{"role": "user", "content": "hello"}] }' */