feat(openai): add root route aliases

This commit is contained in:
NgoQuocViet2001
2026-04-30 01:24:53 +07:00
parent 85e256ad4d
commit 7dc3af40b2
8 changed files with 26 additions and 3 deletions

View File

@@ -98,6 +98,14 @@ func NewApp() (*App, error) {
r.Get("/v1/responses/{response_id}", responsesHandler.GetResponseByID)
r.Post("/v1/files", filesHandler.UploadFile)
r.Post("/v1/embeddings", embeddingsHandler.Embeddings)
// Root OpenAI aliases support clients configured with the bare DS2API service URL.
r.Get("/models", modelsHandler.ListModels)
r.Get("/models/{model_id}", modelsHandler.GetModel)
r.Post("/chat/completions", chatHandler.ChatCompletions)
r.Post("/responses", responsesHandler.Responses)
r.Get("/responses/{response_id}", responsesHandler.GetResponseByID)
r.Post("/files", filesHandler.UploadFile)
r.Post("/embeddings", embeddingsHandler.Embeddings)
claude.RegisterRoutes(r, claudeHandler)
gemini.RegisterRoutes(r, geminiHandler)
r.Route("/admin", func(ar chi.Router) {

View File

@@ -37,6 +37,13 @@ func TestAPIRoutesRemainRegistered(t *testing.T) {
"GET /v1/responses/{response_id}",
"POST /v1/files",
"POST /v1/embeddings",
"GET /models",
"GET /models/{model_id}",
"POST /chat/completions",
"POST /responses",
"GET /responses/{response_id}",
"POST /files",
"POST /embeddings",
"GET /anthropic/v1/models",
"POST /anthropic/v1/messages",
"POST /anthropic/v1/messages/count_tokens",