mirror of
https://github.com/ollama/ollama.git
synced 2026-04-19 22:54:32 +02:00
24 lines
433 B
Go
24 lines
433 B
Go
package usage
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
// API type constants
|
|
const (
|
|
APITypeOllama = "ollama"
|
|
APITypeOpenAI = "openai"
|
|
APITypeAnthropic = "anthropic"
|
|
)
|
|
|
|
// ClassifyAPIType determines the API type from the request path.
|
|
func ClassifyAPIType(path string) string {
|
|
if strings.HasPrefix(path, "/v1/messages") {
|
|
return APITypeAnthropic
|
|
}
|
|
if strings.HasPrefix(path, "/v1/") {
|
|
return APITypeOpenAI
|
|
}
|
|
return APITypeOllama
|
|
}
|