mirror of
https://github.com/better-auth/better-auth.git
synced 2026-10-19 11:24:57 -05:00
22 lines
571 B
TypeScript
22 lines
571 B
TypeScript
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
|
|
import { convertToModelMessages, streamText } from "ai";
|
|
|
|
const inkeep = createOpenAICompatible({
|
|
name: "inkeep",
|
|
baseURL: "https://api.inkeep.com/v1",
|
|
apiKey: process.env.INKEEP_API_KEY,
|
|
});
|
|
|
|
export async function POST(req: Request) {
|
|
const { messages } = await req.json();
|
|
|
|
const result = streamText({
|
|
model: inkeep.chatModel("inkeep-qa-expert"),
|
|
messages: await convertToModelMessages(messages, {
|
|
ignoreIncompleteToolCalls: true,
|
|
}),
|
|
});
|
|
|
|
return result.toUIMessageStreamResponse();
|
|
}
|