mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-26 00:29:06 +02:00
[proxy] Keep the Vertex model id out of the count-tokens method segment
Vertex hangs token counting off the model as its own path segment, and the parser split the tail on the final colon alone. A count-tokens request therefore reported its model as "claude-sonnet-5/count-tokens", which no route claims, so the request denied as not-routable and the access log recorded a model that does not exist. Stop at the first "/" after the model id so the method segment stays out of it, leaving the client free to price its context against the dedicated endpoint instead of the billable inference one.
This commit is contained in:
@@ -257,6 +257,12 @@ func parseVertexPath(reqPath string) (vertexRequest, bool) {
|
||||
if c := strings.LastIndex(rest, ":"); c >= 0 {
|
||||
model, action = rest[:c], rest[c+1:]
|
||||
}
|
||||
// Token counting hangs off the model as its own path segment
|
||||
// (".../models/{model}/count-tokens:rawPredict"), so anything past the
|
||||
// first "/" belongs to the method rather than the model id.
|
||||
if slash := strings.Index(model, "/"); slash >= 0 {
|
||||
model = model[:slash]
|
||||
}
|
||||
model = llm.NormalizeVertexModel(model)
|
||||
if model == "" {
|
||||
return vertexRequest{}, false
|
||||
|
||||
Reference in New Issue
Block a user