summaryrefslogtreecommitdiffhomepage
path: root/packages/console/app/src/routes/zen/v1/chat/completions.ts
blob: e9e05197e2e266a175ce4d7d6e4d9c33522a90cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import type { APIEvent } from "@solidjs/start/server"
import { handler } from "~/routes/zen/util/handler"

export function POST(input: APIEvent) {
  return handler(input, {
    format: "oa-compat",
    modelList: "full",
    parseApiKey: (headers: Headers) => headers.get("authorization")?.split(" ")[1],
    parseModel: (url: string, body: any) => body.model,
    parseIsStream: (url: string, body: any) => !!body.stream,
  })
}