mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-02 04:20:50 +08:00
Add /v1/completions endpoint with OpenAI compatibility
- Implemented `/v1/completions` endpoint mirroring OpenAI's completions API specification. - Added conversion functions to translate between completions and chat completions formats. - Introduced streaming and non-streaming response handling for completions requests. - Updated `server.go` to register the new endpoint and include it in the API's metadata.
This commit is contained in:
@@ -104,6 +104,7 @@ func (s *Server) setupRoutes() {
|
||||
{
|
||||
v1.GET("/models", s.unifiedModelsHandler(openaiHandlers, claudeCodeHandlers))
|
||||
v1.POST("/chat/completions", openaiHandlers.ChatCompletions)
|
||||
v1.POST("/completions", openaiHandlers.Completions)
|
||||
v1.POST("/messages", claudeCodeHandlers.ClaudeMessages)
|
||||
}
|
||||
|
||||
@@ -123,6 +124,7 @@ func (s *Server) setupRoutes() {
|
||||
"version": "1.0.0",
|
||||
"endpoints": []string{
|
||||
"POST /v1/chat/completions",
|
||||
"POST /v1/completions",
|
||||
"GET /v1/models",
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user