ac4af582301a4e8a29245dbba767eba31334ddf9
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
10f1e97883 |
search: a GLM Coding Plan searches its own models with the plan's web search MCP
young02036 on Discord asked for the GLM Coding Plan's Web Search MCP in
magpie's web search. The plan's key is given for that server, so magpie
now asks it with the provider's own key, with nothing to set up: a
Streamable HTTP session at <host>/api/mcp/web_search_prime/mcp
(open.bigmodel.cn or api.z.ai, docs.bigmodel.cn/cn/coding-plan/mcp/
search-mcp-server and docs.z.ai/devpack/mcp/search-mcp-server), the key
as a Bearer, initialize, one tools/call of webSearchPrime with
{"search_query"}, then the session's DELETE.
- provider.ZhipuCodingSearch: only a provider or key on the plan's
/api/coding/paas/v4 (Zhipu's or Z.ai's host, or the zhipu/zai preset).
A pay-as-you-go key isn't served by the server and never asks it.
ZhipuSearches reads p.Keys itself, since KeysOn is counted per list and
searchesOwn runs on every request. ZhipuSearchKeys lists the plan's
keys, which are asked in turn.
- searchesOwn/ownSearch: the plan's own models search there first, as
with Kimi Code and WorkBuddy, and fall to magpie's searcher and the
search APIs when it fails. This happens only while Settings names no
searcher (glmSearches): a searcher the user named still searches for
every model, which is a value the user set.
- It is not offered as a searcher for other providers' models. A plan
with the Responses base (/api/v1) already searches natively there
(searchHosts, #660), and making it a no-model service would change the
searcher those users have now.
- The reply's text is read as a list of results, a list in a JSON
string, or a list under search_result/results/items/data. isError, or
words with no results, is an error with the key masked. The query is
masked as Settings > Privacy says (maskedQuery). Each ask is a request
log row (logOwnSearch).
- No GUI change: the setting has no switch, the same as WorkBuddy's.
- docs/subsystems/gateway-routing.md has a section on it, and the
searchesOwn lists there and in plugin-runtime.md name it.
Run (mote, at this tree):
- go test -count=1 ./internal/provider ./internal/settings
- go test -count=1 -run 'Search|GLM|Zhipu|Kimi|LoopGuard|Docs|Guard|WorkBuddy'
./internal/gateway: ok
- GOOS=linux and GOOS=windows go vet ./internal/gateway ./internal/provider:
ok
- gofmt -l: clean
The tests use a fake server only and never reach the network:
- TestGLMCodingPlanSearchesForItsModels: Claude Code's literal WebSearch
request to a plan's model. The fake gives an event-stream reply with
a progress notification before the result, and a double-stringified
result. Then a refusal, an unnamed versus a named searcher beside a
search API, and a pay-as-you-go key.
- TestReadGLMSearch: each reply shape, and prose.
- TestZhipuCodingSearchAddress: hosts, presets, a plan key beside a
pay-as-you-go one, a key that's off.
Broken by hand:
- With the old searchesOwn/ownSearch, TestGLMCodingPlanSearchesForItsModels
is red: the model had no search, 400 "no search tool".
- With glmSearches ignoring a named searcher, the test is red at the
named-searcher step: the MCP was asked and the named searcher wasn't.
Not tried:
- No real GLM Coding Plan key was available, so nothing was sent to the
real open.bigmodel.cn or api.z.ai server. The docs give neither the
tool's argument names nor its reply's shape. search_query and the
result fields come from Zhipu's Web Search API and a third-party npm
wrapper (web-search-zaimcp 0.1.2). If the real reply differs, a search
falls to magpie's other searcher or the search APIs and says why.
- The plan's MCP quota, and how a spent quota is worded.
- A GUI hint in Settings > Web search.
|
||
|
|
488569227e |
zhipu: a GLM Coding Plan key at the pay-as-you-go endpoint is asked again at the plan's, and the provider moves there
@cleverpigo on X: "glm coding plan放在codex/chatgpt里显示余额不足没法用". The editor
showed OpenAI https://open.bigmodel.cn/... red with 429 · 余额不足或无可用资源包,
请充值。 next to a green Anthropic https://open.bigmodel.cn/api/anthropic.
Root cause: the zhipu and zai presets start on their first region, Pay as
you go, whose OpenAI URL is /api/paas/v4. The Anthropic URL is the same in
both regions, and it bills the Coding Plan when the account has one. So a
Coding Plan key left at the default works in Claude Code, while Codex goes
to /api/paas/v4 and Zhipu answers 429 code 1113 (no balance). A provider
made by pasting the paas/v4 URL hits the same wall. Nothing in the key
says which kind it is. LESSONS.md's
|