cloud_proxy: send ollama client version (#14769)

This was previously included in the user agent, and we've made use of it
in the past to hotpatch bugs server-side for particular Ollama versions.
This commit is contained in:
Devon Rifkin
2026-03-10 15:53:25 -07:00
committed by GitHub
parent bc72b14016
commit 8c4d5d6c2f
3 changed files with 18 additions and 4 deletions

View File

@@ -20,13 +20,15 @@ import (
"github.com/ollama/ollama/auth"
"github.com/ollama/ollama/envconfig"
internalcloud "github.com/ollama/ollama/internal/cloud"
"github.com/ollama/ollama/version"
)
const (
defaultCloudProxyBaseURL = "https://ollama.com:443"
defaultCloudProxySigningHost = "ollama.com"
cloudProxyBaseURLEnv = "OLLAMA_CLOUD_BASE_URL"
legacyCloudAnthropicKey = "legacy_cloud_anthropic_web_search"
defaultCloudProxyBaseURL = "https://ollama.com:443"
defaultCloudProxySigningHost = "ollama.com"
cloudProxyBaseURLEnv = "OLLAMA_CLOUD_BASE_URL"
legacyCloudAnthropicKey = "legacy_cloud_anthropic_web_search"
cloudProxyClientVersionHeader = "X-Ollama-Client-Version"
)
var (
@@ -181,6 +183,9 @@ func proxyCloudRequestWithPath(c *gin.Context, body []byte, path string, disable
}
copyProxyRequestHeaders(outReq.Header, c.Request.Header)
if clientVersion := strings.TrimSpace(version.Version); clientVersion != "" {
outReq.Header.Set(cloudProxyClientVersionHeader, clientVersion)
}
if outReq.Header.Get("Content-Type") == "" && len(body) > 0 {
outReq.Header.Set("Content-Type", "application/json")
}