mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-21 07:26:47 +08:00
feat: 支持Anthropic API协议 | support Anthropic API protocol
- 添加Anthropic适配器实现 | Add Anthropic adaptor implementation - 支持Anthropic消息格式转换 | Support Anthropic message format conversion - 添加Vertex AI Claude适配器支持 | Add Vertex AI Claude adapter support - 更新Anthropic的中继模式定义 | Update relay mode definitions for Anthropic - 添加Anthropic控制器和路由 | Add Anthropic controller and routing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: zgdmemail@gmail.com
This commit is contained in:
@@ -71,4 +71,16 @@ func SetRelayRouter(router *gin.Engine) {
|
||||
relayV1Router.GET("/threads/:id/runs/:runsId/steps/:stepId", controller.RelayNotImplemented)
|
||||
relayV1Router.GET("/threads/:id/runs/:runsId/steps", controller.RelayNotImplemented)
|
||||
}
|
||||
|
||||
// Anthropic API compatibility - https://docs.anthropic.com/claude/reference/
|
||||
anthropicRouter := router.Group("/anthropic")
|
||||
anthropicRouter.Use(middleware.RelayPanicRecover(), middleware.TokenAuth(), middleware.Distribute())
|
||||
{
|
||||
// Models API
|
||||
anthropicRouter.GET("/v1/models", controller.ListModels)
|
||||
anthropicRouter.GET("/v1/models/:model", controller.RetrieveModel)
|
||||
|
||||
// Messages API - main endpoint for chat completions
|
||||
anthropicRouter.POST("/v1/messages", controller.Relay)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user