Skip to content

Commit d5de398

Browse files
committed
feat: v1 compat routes
1 parent cba9b91 commit d5de398

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/routes/chat-completions/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { handlerStreaming } from "./handler-streaming"
99

1010
export const completionRoutes = new Hono()
1111

12-
completionRoutes.post("/chat/completions", async (c) => {
12+
completionRoutes.post("/", async (c) => {
1313
try {
1414
if (APP_CONFIG.EMULATE_STREAMING) {
1515
return await handler(c)

src/routes/models/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { getModels } from "~/services/copilot/get-models/service"
66

77
export const modelRoutes = new Hono()
88

9-
modelRoutes.get("/models", async (c) => {
9+
modelRoutes.get("/", async (c) => {
1010
try {
1111
const models = await getModels()
1212
return c.json(models)

src/server.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,10 @@ server.use(logger())
1111
server.use(cors())
1212

1313
server.get("/", (c) => c.text("Server running"))
14-
server.route("/", completionRoutes)
15-
server.route("/", modelRoutes)
14+
15+
server.route("/chat/completions", completionRoutes)
16+
server.route("/models", modelRoutes)
17+
18+
// Compatibility with tools that expect v1/ prefix
19+
server.route("/v1/chat/completions", completionRoutes)
20+
server.route("/v1/models", modelRoutes)

0 commit comments

Comments
 (0)