e4e9eb0928becfa4e48484dde85ef5032671d582
5
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ac15036ab4 |
provider: a catalog entry points at its provider instead of copying it
Entry.Provider was a Provider value, 1,328 of an Entry's 1,760 bytes, copied into every model of every provider each time a catalog, an agent's list or a routing group's entries were built. It is now a *Provider: entriesOf and decide's list give every model of one provider the same one (sharedEntry), and a group's entry points at its first member's. It is read only; every place that hands it on as a value (Resolve, CanFast, ownAgent, modelAllowed, …) dereferences it, so what they get is a copy as before. entryFor keeps its signature for the one model ServedEntryOf builds; offEntries' entries now carry their provider too. Measured on mote with the owner's real accounts (acctp sandbox, page open for 2m32s, w40 = before, w41 = this, alternating): - catalogOf's allocations 106 MB -> 67 MB, providerEntries' 88 -> 78 MB - CPU at the page's settle mark 3.42/3.33 s -> 3.18/3.30 s - live heap unchanged (76.3/76.1 -> 76.7/75.9 MB): the lists are rebuilt, not kept, so the copies were churn for the GC, not held Run: go build and go vet ./... and the tests compiled (go test -run ^$) on mote; the full suite at this tree (d1e823d5f) on mica: 99 packages ok, 0 FAIL (agent 317s, gateway 972s, gui 188s, provider 220s, usage 56s). |
||
|
|
32ea16c5a4 |
gateway, provider: a model AgentRouter turns away on chat in Chinese is asked, and tested, on the next API (#3766)
char1eslu (#3766): AgentRouter answers gpt-5.6-sol, gpt-6-astra and gpt-6.1-sol on chat completions with a 400, "模型 gpt-5.6-sol 不支持 /v1/chat/completions 接口,请改用 /v1/responses(OpenAI Responses API)。", and serves them on Responses (gpt-5.6-sol on Messages too: the report's provider test has ✓ anthropic). wrongEndpoint, the gateway's word that a model is served on another API, which has the request asked there when the provider has a URL for it (and remembers it in unfit), read English alone. So while the provider had a Chat URL, a Chat client's request for these models got that 400 back, whatever other URLs it had. The report's 200 ("/v1/chat/completions → /v1/responses") is a request translated past chat, which |
||
|
|
0b72ccbeff |
agentplug: connect's models carry /v1/models' native_endpoints and pricing
cleary5779 on Discord builds an agent as an agent plugin and wants, in
connect({ gateway, model, models }), the API each model passes straight
through on and what it costs. Each entry of models (and model) now also
has, by the names /v1/models uses:
"native_endpoints": ["/v1/chat/completions"],
"pricing": {"prompt": "0.0000003", "completion": "0.0000012",
"input_cache_read": "0.00000003"}
Each is left out when not known: a group or a model translated anyway
has no native_endpoints, an unpriced model no pricing, never [] or 0.
The fields connect had (id, name, context, output, images, efforts) are
as they were.
No second lookup: nativeEndpoints moved from the gateway to
provider.NativeEndpoints, and openRouterPricing/perToken to
catalog.OpenRouterPricing/PerToken (internal/catalog/openrouter.go); the
gateway calls them as before. magpieModels already priced each model with
provider.EntryPricer, the price /v1/models gives (m.Price); it now also
keeps NativeEndpoints in catalog.Model.Endpoints (json:"-"), which
plugged's wire turns into the two keys.
Docs: reference.md's agent plugins section (what connect gets, with an
example), agent-wiring and gateway-routing subsystem pages, and the
site's Plugins page in en, zh and ja.
Run at this tree (on origin/main
|
||
|
|
9bf20dbfc1 |
gateway: a model a relay serves with tools on Responses alone goes to the provider's Responses URL (#1308, Stevenzc888)
A custom provider with the same relay as its OpenAI compatible and OpenAI
Responses URL: magpie asks a GPT on a relay on Chat Completions first (Pi is
wired on openai-completions for it), and the relay turned Pi's tools away with
400 "gpt-6.1-sol requires Responses for tool calls; this account only supports
Chat Completions". wrongEndpoint didn't know that wording, so the 400 reached
Pi instead of the request going on to the Responses URL. "requires responses"
is now one of its phrases: the model is remembered as not served on that
relay's Chat, and the request (relayed as Pi sent it, or translated from
Claude Code's Messages) is spoken as Responses there, later turns at once.
Where the provider has no Responses URL, the error now says so
("gpt-6.1-sol is served on /v1/responses, which <provider> has no URL for")
rather than the relay's word alone (wrongAPINote reads the error body).
Red before: TestToolsThatNeedResponsesGoThere failed with the user's exact
error ("status 400: ... requires Responses for tool calls; this account only
supports Chat Completions"); TestTranslatedToolsThatNeedResponsesGoThere,
TestToolsThatNeedResponsesNameTheMissingURL and TestWrongEndpoint's new case
failed too. With the phrase but without the note, the missing-URL test fails.
go test -tags nogui ./internal/gateway ./internal/provider pass, and
./internal/agent as a non-root user (as root in Docker its chmod-based
aside_offline tests fail, unrelated); go vet -tags nogui ./internal/gateway
for darwin, linux and windows, and gofmt -l pass (linux, golang:1.26.8 in
Docker: this Mac's syspolicyd is pegged and new binaries hang at launch).
Not tried against the reporter's real relay.
|
||
|
|
b0d456c3b2 |
providers: an OpenCode Go or Zen provider saved with its chat URL alone sends GPT, Grok, Muse Spark and MiniMax on the API OpenCode serves them on, not chat, and "Model does not support this protocol" says which URL was asked (#1215)
The reporter's "OpenCode Go 1x" had only chat=https://opencode.ai/zen/go/v1 and no models.dev catalog (its native_endpoints were /v1/chat/completions for every model). Go serves each model on one API of three, as models.dev's per-model provider.npm says and OpenCode itself asks it (@ai-sdk/openai -> /responses, @ai-sdk/anthropic -> /messages, the rest chat), so with chat the only URL, gpt-6-luna, gpt-5.6-luna, grok-4.6/4.7, minimax-m2.7 and muse-spark-1.2/1.3-contributor had nowhere else to go and Go answered 400 on all three of magpie's entry points. - normalize fills in the other two of Zen's or Go's APIs (/v1 for chat and Responses, the root for Messages) and its catalog, only where the provider has none of its own (openCodeEndpoints); other hosts unchanged. - ListedAPIs reads the per-model API from the list of the gateway the URL is at (opencode-go for /zen/go, opencode for /zen), whatever catalog was saved: Go and Zen serve MiniMax M2.7 on different APIs, and an import at /zen/v1 could be saved with opencode-go's. - A wrong-endpoint error with no other API left now ends "(asked at <url>; <model> is served on /v1/responses, which <provider> has no URL for)". Verified: TestOpenCodeGoModelsGoOnTheirOwnAPI (gateway, all 3 client APIs x 5 models through the handler) and TestOpenCodeEndpointsFilledIn fail without the change with the reporter's exact "OpenCode Go 1x: Model does not support this protocol."; TestOtherRelayKeepsItsOneAPI and the relay cases keep other providers as they were. go test -tags nogui ./... green under a temp HOME; go vet, go build, GOOS=linux/windows builds. Real upstream: probed https://opencode.ai/zen/go/v1 with no key only (grok-4.7 is "not supported for format oa-compat" on chat and "format anthropic" on messages, passes to the key check on responses); no keyed request was made. |