Commit Graph
78 Commits
Author SHA1 Message Date
Junjie Zhouandmultica-agent 12d823211e provider: a multi-protocol provider's model catalog keeps every endpoint's models (#1006)
* provider: a multi-protocol provider's catalog is the union of every endpoint's models

A provider whose protocols sit at bases of their own kept only the first
list that answered, so the models of every other endpoint were nowhere in
the product: not in the agents' model lists, not in the catalog the routing
and the per-model preferences read, and not fixable by pinning a model's
protocol, which setModelAPI refuses for a model the provider does not list.
nyownm reported it as #904 and worked around it with one provider per
protocol.

fetchOne now asks every endpoint the provider speaks and merges the lists
by model id, the way fetchPerKey merges the lists of a vendor's keys: the
first list's fields stand, and an image capability both lists answer is
merged. The base kept is still the first protocol's, the one the drawer
list is fetched beside and the models are saved with. A models URL is
still asked alone, one base two protocols share is still asked once, and
a provider with no endpoint answering still fails with every URL it asked
named in the error.

Verified with go test -tags nogui ./internal/provider ./internal/catalog
and ./internal/gateway ./internal/agent, all green. TestFetchUnionsProtocolLists
and TestFetchUnionsProtocolListsWithoutChat fail on the base commit with
the single list the first protocol answered.

* provider: an endpoint that can't be asked keeps the models it listed

A provider whose protocols sit at bases of their own is asked every base
and the lists are merged, so one read that failed saved the union of the
rest as the whole list: the models of the failed base read as gone,
dropGonePicks took them out of the user's picks and stored that, and
nothing brought them back when the endpoint recovered (yetone's review of
#1006, on nyownm's #904). A read that failed says nothing about what the
vendor serves today, the rule fetchPerKey's keys already follow.

fetchOne keeps what each base listed and saves it beside the merged list,
in a new "sides" part of the catalog's live file, and a base it could not
ask takes its own part back for that fetch. What is kept is that base's own
models alone: a model the bases that answered have dropped is dropped here
too, however many of them dropped it and however many bases are down.
Keeping the whole list saved before would bring such a model back, which is
the same fault the other way round. A list saved before this kept no parts,
so a base whose part is missing keeps what no answering base lists, until
the next fetch with every base answering says which they are.

The parts are kept only where more than one base was asked: a single one
that fails is the fetch that fails, and its list is kept as it is, so a
provider of one protocol's cache is the file it was.

fetchOne answers one fetched list now — the models, the base kept for
routing, the parts — rather than three values. fetchPerKey marks the parts
with the keys that saw them, and keeps a plan's own models out of them.

Verified with go test ./internal/provider ./internal/catalog, all green,
and ./internal/gateway ./internal/agent.
TestFetchKeepsTheModelsAFailedProtocolListed,
TestFetchDropsAGoneModelWhileAnotherProtocolFails and
TestFetchKeepsTheModelsAFailedProtocolListedPerKey fail on 952d0b00 with
the model of the failed protocol taken out of the picks.

Co-authored-by: multica-agent <github@multica.ai>

* provider: a base that never answered keeps nothing, and is not saved as one that listed nothing

keepDeadSides read a part missing from the saved sides as the whole list
saved before, and kept what no answering base lists from it. Two things
were wrong with that, and both were reported on #1006 (nyownm's #904):

A base in none of the saved parts is one that has never answered. The
whole list is not its own, so a model its vendor had already dropped was
kept for it, and the keepDeadSides result was saved as sides[base] —
from then on that base had a part, and the model could never be dropped
again. An Anthropic base answering 404 from the start of a provider's
life was enough: one round after the Chat base dropped a model, that
model stayed in the catalog, and dropGonePicks could not take it out of
the user's picks.

The saving is the other half of the same fault. A part is what a base
listed, so one that never answered has none, and writing an empty one
fixes the reading of "never answered" as "listed nothing" for good. Only
a part read out of the file is written back; the list saved without any
parts at all — before this kept them — is the one case where a base may
stand in for a missing part, and what it stands in for is kept for that
fetch alone, never saved as its own.

So keepDeadSides answers two lists now: the models this fetch's list is
made of, and the parts to write beside it. fetchPerKey keeps a model a
key that could not be asked at all owns to the bases that listed it,
read out of the parts saved beside the list: kept as a whole list with
no part saying where it came from it belonged to no base, and was read
as gone the first time that key answered half-way — the same permanent
deletion of a picked model, one round later and needing no new base.

Verified with go test ./internal/provider ./internal/catalog
./internal/gateway ./internal/agent, all green, and -race -count=3 over
./internal/provider with the four failures it already had.
TestFetchDropsAModelWhileAnEndpointHasNeverAnswered and
TestFetchKeepsAModelsBaseAfterItsKeyFailedWhole fail on 6621f73e.

Co-authored-by: multica-agent <github@multica.ai>

* provider: a base that answered without a model does not keep owning it

fetchPerKey gave every model kept for a key that could not be asked at all
to the bases that listed it last time, and a part there said what the
bases listed when one of them had answered this round without it (yetone's
review of #1006, nyownm's #904). With two keys where both were served a
Claude model, and the Anthropic base stopping both of them in the round
the second key was down, sides[anthropic] kept a model the base had
plainly dropped, and the fetch after that read it as a base that couldn't
be asked and held the model one round longer than it should have. It is
self-healing — the next round with the base answering settles it — and it
is the same fault c8fabd70 was written to undo, read from the other side.

sides may only say what the bases listed. A model kept for a failed key
belongs to a base that was not asked this round for any of the model's own
keys: one that was, and answered without the model, has said what it
serves today and no longer owns it. Which is per key, not per provider:
fetchOne answers which of its bases replied, which a model of the second
key alone never saw an answer from, so the base's saying nothing about it
for the first key leaves it that base's. The keys a model is kept under
are read from the list saved before, since add clears the ones of the model
it is adding.

TestFetchDropsAModelABaseStoppedServingWhileAKeyIsDown fails on c8fabd70
with the part holding claude-b, and TestFetchKeepsAModelsBaseAfterItsKeyFailedWhole
goes on passing: the same two keys, a model only one of them sees.

Co-authored-by: multica-agent <github@multica.ai>

* provider, catalog: a page of a model list is not the list (#904)

A /v1/models that answers with has_more is one page of the vendor's
catalog. Read as the whole list, every model of a later page reads as one
the vendor has dropped, and the user's pick of it goes for good, on a
list that never said so. Such a reply is no answer: the base is treated
as one that could not be asked, which keeps what it listed last time
(#904's review of #1006).

OpenRouter's Anthropic base is not asked for the list at all. With the
Anthropic version header its /models answers with the catalog again,
twenty newest first, every id namespaced under `anthropic/`, and the
cursors of the pages after. None of those twenty is an id in OpenRouter's
own catalog, so merged they are entries of the model picker that name no
model: the long, cluttered list #904's reporter wrote of. Its Chat base
is that catalog, whole, and the fetch is one request where it was two.
The rule is OpenRouter's, by host, as the ones after it are scoped to
their vendors.

Co-authored-by: multica-agent <github@multica.ai>

* provider: the OpenRouter rule reads the base being asked (0fb16990)

It read the Chat base's host, so a provider with a Chat base of
OpenRouter's and an Anthropic base of another vendor's had that other
base skipped: its models were in neither the union nor the sides nor the
bases that could not be asked, so no keepDeadSides path found them and
the user's picks of them went for good. `magpie provider set <id>
anthropic=<url>` reaches that shape from the CLI.

The rule is about the vendor whose base is being asked, so that is what
it now reads, together with whether the provider asks at a base of its
own besides it: an OpenRouter Anthropic base alone is still asked, its
reply being the only catalog there would otherwise be, and
catalog.fetchOne is what keeps a page of it from being read as the whole.

Five combinations of the two bases and openrouter.ai, one assertion each;
three of them fail on 0fb16990.

Co-authored-by: multica-agent <github@multica.ai>

* catalog, provider: a model list is followed to its last page, not read as a page (#1006)

A reply with has_more was refused as no answer at all, which is right for a
provider with several bases and wrong for one with a single base: Anthropic's
own preset has no other base to fall back on, so once its list passes twenty
models — about sixteen today — the fetch answered an error and no models,
where main listed the twenty of the first page, and a pick of a model on a
later page went with them. catalog.fetchOne now reads a list to its end: the
first page as the URL stands, and every page after it with limit=1000 and
the after_id the page before ended at, up to twenty pages.

Half a list is still no answer, and that is what the following ends on: a
page that fails, a list that pages without naming the id to carry on from,
one that answers the page just asked again under the same id, and one still
paging at the cap all leave the base as one that could not be asked, which
keeps what it listed last time. The rule lives in catalog.Paged, and the
Kilo gateway's list — OpenRouter's shape, which pages the same way — is paged
by it instead of refused by a guard of its own; the comment on that guard
claimed OpenRouter's /models pages, which neither api.kilo.ai nor
openrouter.ai was answering with on 2026-10-06, and now says so.

One assertion of TestFetchOpenRouterRuleOverTheFourBaseCombinations follows
the rule rather than the old count: OpenRouter's Anthropic base alone is
asked for its first page and the page after it, which is the same page
again, where before it was asked once and refused.

Tests: TestFetchFollowsThePagesOfAList, TestFetchFollowsAPageAListAnswersItsOwnWay,
TestFetchTakesAPagedListAsNoAnswerWhenAPageFails, TestFetchTakesAPagedListWithoutAnIdAsNoAnswer,
TestFetchTakesAListThatPagesWithoutEndAsNoAnswer (catalog);
TestFetchFollowsThePagesOfASingleAnthropicBase (provider, the Anthropic preset's
one base, 25 models 20 to a page) and TestKiloModelsFollowThePagesOfTheList.

Co-authored-by: multica-agent <github@multica.ai>

* provider: OpenRouter's Anthropic base alone is asked, and refused (#1006)

The fake that stands for openrouter.ai answered every cursor with the same
twenty ids under the same last_id, so following the pages of a list stopped
where the rule of catalog.Paged says a list stops being readable, and the
single-base case looked covered: the twenty were refused and the fetch
failed. The endpoint does not answer that way. Asked with the Anthropic
version header on 2026-10-06, /api/v1/models gave those twenty with
has_more and a cursor, and under the cursor 413 more ids with has_more
false — a different set, and the end of the list. The two pages share
nothing, and following them lands deeper in the `anthropic/` namespace
rather than back at the catalog it was namespaced from: of the 433 ids, 4
are in the 466 OpenRouter serves without that header.

So the twenty were not a page to be refused but the first half of a list
that reads to the end, and the end is still not a catalog of models to
serve. The base is still asked — it is the only base there is, and refusing
to ask would leave the provider with nothing at all — and the list it
answers with is now refused as a whole, which is what the old rule did with
one page of it. It fails the fetch like any other base that could not be
asked, so the provider keeps the models it listed last time (#904).

The two replies are kept as they came, under testdata, and a test reads
them back: twenty, then 413, the cursor the first ends at, has_more true
and then false, and not one id of either page in the catalog OpenRouter
serves. The fake pages with after_id, as the endpoint does.

Tests: TestOpenRouterNamespacedPagesAreTheEndpointShape (new),
TestFetchOpenRouterRuleOverTheFourBaseCombinations (the single-base case now
asks exactly the two pages it answers with, keeps no list, and fails),
TestFetchKeepsPicksWhenAModelListIsPaginated, TestFetchDoesNotMergeOpenRouter's
NamespacedList, TestFetchOpenRouterAddsNoNamespacedModelAndKeepsPicks,
TestFetchKeepsAnotherVendorsAnthropicList.

Co-authored-by: multica-agent <github@multica.ai>

* provider: the message for a namespaced list counts nothing (#1006)

The reason a provider whose only base is OpenRouter's Anthropic one is
refused is still the one it was, and the base is still asked and refused
exactly as before: what changed is the sentence the user is left with, and
the comments around it.

That sentence counted the list it refused — "433 of them, of which 4 are
ids OpenRouter serves" — and those counts are of whatever OpenRouter's
catalog was that day, so the number a user reads is wrong tomorrow without
anyone touching it. It now says why the answer is no good and what to do
instead: give this provider OpenRouter's Chat base, which lists those
models under the ids OpenRouter serves, or type the model ids in by hand,
which is what the caller already appends to every base it could not ask.

The comments said the same counts as fact, and cited a probe file that is
not in the repository. The counts stay, marked as what was observed on
2026-10-06, and what does not move is now the point: following the pages
of the list lands deeper in the namespace, not back at the catalog it was
namespaced from. The dead file references are gone, and one test checks
that the message counts nothing at all, so a count cannot creep back in.

Tests: TestFetchOpenRouterRuleOverTheFourBaseCombinations (the message names
the Chat base and the ids to type, and holds no number but the version in
that base's path).

Co-authored-by: multica-agent <github@multica.ai>

* provider: a multi-protocol provider's catalog is the union of every endpoint's models

A provider whose protocols sit at bases of their own kept only the first
list that answered, so the models of every other endpoint were nowhere in
the product: not in the agents' model lists, not in the catalog the routing
and the per-model preferences read, and not fixable by pinning a model's
protocol, which setModelAPI refuses for a model the provider does not list.
nyownm reported it as #904 and worked around it with one provider per
protocol.

fetchOne now asks every endpoint the provider speaks and merges the lists
by model id, the way fetchPerKey merges the lists of a vendor's keys: the
first list's fields stand, and an image capability both lists answer is
merged. The base kept is still the first protocol's, the one the drawer
list is fetched beside and the models are saved with. A models URL is
still asked alone, one base two protocols share is still asked once, and
a provider with no endpoint answering still fails with every URL it asked
named in the error.

Verified with go test -tags nogui ./internal/provider ./internal/catalog
and ./internal/gateway ./internal/agent, all green. TestFetchUnionsProtocolLists
and TestFetchUnionsProtocolListsWithoutChat fail on the base commit with
the single list the first protocol answered.

Co-authored-by: multica-agent <github@multica.ai>

* provider: an endpoint that can't be asked keeps the models it listed

A provider whose protocols sit at bases of their own is asked every base
and the lists are merged, so one read that failed saved the union of the
rest as the whole list: the models of the failed base read as gone,
dropGonePicks took them out of the user's picks and stored that, and
nothing brought them back when the endpoint recovered (yetone's review of
vendor serves today, the rule fetchPerKey's keys already follow.

fetchOne keeps what each base listed and saves it beside the merged list,
in a new "sides" part of the catalog's live file, and a base it could not
ask takes its own part back for that fetch. What is kept is that base's own
models alone: a model the bases that answered have dropped is dropped here
too, however many of them dropped it and however many bases are down.
Keeping the whole list saved before would bring such a model back, which is
the same fault the other way round. A list saved before this kept no parts,
so a base whose part is missing keeps what no answering base lists, until
the next fetch with every base answering says which they are.

The parts are kept only where more than one base was asked: a single one
that fails is the fetch that fails, and its list is kept as it is, so a
provider of one protocol's cache is the file it was.

fetchOne answers one fetched list now — the models, the base kept for
routing, the parts — rather than three values. fetchPerKey marks the parts
with the keys that saw them, and keeps a plan's own models out of them.

Verified with go test ./internal/provider ./internal/catalog, all green,
and ./internal/gateway ./internal/agent.
TestFetchKeepsTheModelsAFailedProtocolListed,
TestFetchDropsAGoneModelWhileAnotherProtocolFails and
TestFetchKeepsTheModelsAFailedProtocolListedPerKey fail on 952d0b00 with
the model of the failed protocol taken out of the picks.

Co-authored-by: multica-agent <github@multica.ai>

* provider: a base that never answered keeps nothing, and is not saved as one that listed nothing

keepDeadSides read a part missing from the saved sides as the whole list
saved before, and kept what no answering base lists from it. Two things
were wrong with that, and both were reported on #1006 (nyownm's #904):

A base in none of the saved parts is one that has never answered. The
whole list is not its own, so a model its vendor had already dropped was
kept for it, and the keepDeadSides result was saved as sides[base] —
from then on that base had a part, and the model could never be dropped
again. An Anthropic base answering 404 from the start of a provider's
life was enough: one round after the Chat base dropped a model, that
model stayed in the catalog, and dropGonePicks could not take it out of
the user's picks.

The saving is the other half of the same fault. A part is what a base
listed, so one that never answered has none, and writing an empty one
fixes the reading of "never answered" as "listed nothing" for good. Only
a part read out of the file is written back; the list saved without any
parts at all — before this kept them — is the one case where a base may
stand in for a missing part, and what it stands in for is kept for that
fetch alone, never saved as its own.

So keepDeadSides answers two lists now: the models this fetch's list is
made of, and the parts to write beside it. fetchPerKey keeps a model a
key that could not be asked at all owns to the bases that listed it,
read out of the parts saved beside the list: kept as a whole list with
no part saying where it came from it belonged to no base, and was read
as gone the first time that key answered half-way — the same permanent
deletion of a picked model, one round later and needing no new base.

Verified with go test ./internal/provider ./internal/catalog
./internal/gateway ./internal/agent, all green, and -race -count=3 over
./internal/provider with the four failures it already had.
TestFetchDropsAModelWhileAnEndpointHasNeverAnswered and
TestFetchKeepsAModelsBaseAfterItsKeyFailedWhole fail on 6621f73e.

Co-authored-by: multica-agent <github@multica.ai>

* provider: a base that answered without a model does not keep owning it

fetchPerKey gave every model kept for a key that could not be asked at all
to the bases that listed it last time, and a part there said what the
bases listed when one of them had answered this round without it (yetone's
review of #1006, nyownm's #904). With two keys where both were served a
Claude model, and the Anthropic base stopping both of them in the round
the second key was down, sides[anthropic] kept a model the base had
plainly dropped, and the fetch after that read it as a base that couldn't
be asked and held the model one round longer than it should have. It is
self-healing — the next round with the base answering settles it — and it
is the same fault c8fabd70 was written to undo, read from the other side.

sides may only say what the bases listed. A model kept for a failed key
belongs to a base that was not asked this round for any of the model's own
keys: one that was, and answered without the model, has said what it
serves today and no longer owns it. Which is per key, not per provider:
fetchOne answers which of its bases replied, which a model of the second
key alone never saw an answer from, so the base's saying nothing about it
for the first key leaves it that base's. The keys a model is kept under
are read from the list saved before, since add clears the ones of the model
it is adding.

TestFetchDropsAModelABaseStoppedServingWhileAKeyIsDown fails on c8fabd70
with the part holding claude-b, and TestFetchKeepsAModelsBaseAfterItsKeyFailedWhole
goes on passing: the same two keys, a model only one of them sees.

Co-authored-by: multica-agent <github@multica.ai>

* provider, catalog: a page of a model list is not the list (#904)

A /v1/models that answers with has_more is one page of the vendor's
catalog. Read as the whole list, every model of a later page reads as one
the vendor has dropped, and the user's pick of it goes for good, on a
list that never said so. Such a reply is no answer: the base is treated
as one that could not be asked, which keeps what it listed last time
(#904's review of #1006).

OpenRouter's Anthropic base is not asked for the list at all. With the
Anthropic version header its /models answers with the catalog again,
twenty newest first, every id namespaced under `anthropic/`, and the
cursors of the pages after. None of those twenty is an id in OpenRouter's
own catalog, so merged they are entries of the model picker that name no
model: the long, cluttered list #904's reporter wrote of. Its Chat base
is that catalog, whole, and the fetch is one request where it was two.
The rule is OpenRouter's, by host, as the ones after it are scoped to
their vendors.

Co-authored-by: multica-agent <github@multica.ai>

* provider: the OpenRouter rule reads the base being asked (0fb16990)

It read the Chat base's host, so a provider with a Chat base of
OpenRouter's and an Anthropic base of another vendor's had that other
base skipped: its models were in neither the union nor the sides nor the
bases that could not be asked, so no keepDeadSides path found them and
the user's picks of them went for good. `magpie provider set <id>
anthropic=<url>` reaches that shape from the CLI.

The rule is about the vendor whose base is being asked, so that is what
it now reads, together with whether the provider asks at a base of its
own besides it: an OpenRouter Anthropic base alone is still asked, its
reply being the only catalog there would otherwise be, and
catalog.fetchOne is what keeps a page of it from being read as the whole.

Five combinations of the two bases and openrouter.ai, one assertion each;
three of them fail on 0fb16990.

Co-authored-by: multica-agent <github@multica.ai>

* catalog, provider: a model list is followed to its last page, not read as a page (#1006)

A reply with has_more was refused as no answer at all, which is right for a
provider with several bases and wrong for one with a single base: Anthropic's
own preset has no other base to fall back on, so once its list passes twenty
models — about sixteen today — the fetch answered an error and no models,
where main listed the twenty of the first page, and a pick of a model on a
later page went with them. catalog.fetchOne now reads a list to its end: the
first page as the URL stands, and every page after it with limit=1000 and
the after_id the page before ended at, up to twenty pages.

Half a list is still no answer, and that is what the following ends on: a
page that fails, a list that pages without naming the id to carry on from,
one that answers the page just asked again under the same id, and one still
paging at the cap all leave the base as one that could not be asked, which
keeps what it listed last time. The rule lives in catalog.Paged, and the
Kilo gateway's list — OpenRouter's shape, which pages the same way — is paged
by it instead of refused by a guard of its own; the comment on that guard
claimed OpenRouter's /models pages, which neither api.kilo.ai nor
openrouter.ai was answering with on 2026-10-06, and now says so.

One assertion of TestFetchOpenRouterRuleOverTheFourBaseCombinations follows
the rule rather than the old count: OpenRouter's Anthropic base alone is
asked for its first page and the page after it, which is the same page
again, where before it was asked once and refused.

Tests: TestFetchFollowsThePagesOfAList, TestFetchFollowsAPageAListAnswersItsOwnWay,
TestFetchTakesAPagedListAsNoAnswerWhenAPageFails, TestFetchTakesAPagedListWithoutAnIdAsNoAnswer,
TestFetchTakesAListThatPagesWithoutEndAsNoAnswer (catalog);
TestFetchFollowsThePagesOfASingleAnthropicBase (provider, the Anthropic preset's
one base, 25 models 20 to a page) and TestKiloModelsFollowThePagesOfTheList.

Co-authored-by: multica-agent <github@multica.ai>

* provider: OpenRouter's Anthropic base alone is asked, and refused (#1006)

The fake that stands for openrouter.ai answered every cursor with the same
twenty ids under the same last_id, so following the pages of a list stopped
where the rule of catalog.Paged says a list stops being readable, and the
single-base case looked covered: the twenty were refused and the fetch
failed. The endpoint does not answer that way. Asked with the Anthropic
version header on 2026-10-06, /api/v1/models gave those twenty with
has_more and a cursor, and under the cursor 413 more ids with has_more
false — a different set, and the end of the list. The two pages share
nothing, and following them lands deeper in the `anthropic/` namespace
rather than back at the catalog it was namespaced from: of the 433 ids, 4
are in the 466 OpenRouter serves without that header.

So the twenty were not a page to be refused but the first half of a list
that reads to the end, and the end is still not a catalog of models to
serve. The base is still asked — it is the only base there is, and refusing
to ask would leave the provider with nothing at all — and the list it
answers with is now refused as a whole, which is what the old rule did with
one page of it. It fails the fetch like any other base that could not be
asked, so the provider keeps the models it listed last time (#904).

The two replies are kept as they came, under testdata, and a test reads
them back: twenty, then 413, the cursor the first ends at, has_more true
and then false, and not one id of either page in the catalog OpenRouter
serves. The fake pages with after_id, as the endpoint does.

Tests: TestOpenRouterNamespacedPagesAreTheEndpointShape (new),
TestFetchOpenRouterRuleOverTheFourBaseCombinations (the single-base case now
asks exactly the two pages it answers with, keeps no list, and fails),
TestFetchKeepsPicksWhenAModelListIsPaginated, TestFetchDoesNotMergeOpenRouter's
NamespacedList, TestFetchOpenRouterAddsNoNamespacedModelAndKeepsPicks,
TestFetchKeepsAnotherVendorsAnthropicList.

Co-authored-by: multica-agent <github@multica.ai>

* provider: the message for a namespaced list counts nothing (#1006)

The reason a provider whose only base is OpenRouter's Anthropic one is
refused is still the one it was, and the base is still asked and refused
exactly as before: what changed is the sentence the user is left with, and
the comments around it.

That sentence counted the list it refused — "433 of them, of which 4 are
ids OpenRouter serves" — and those counts are of whatever OpenRouter's
catalog was that day, so the number a user reads is wrong tomorrow without
anyone touching it. It now says why the answer is no good and what to do
instead: give this provider OpenRouter's Chat base, which lists those
models under the ids OpenRouter serves, or type the model ids in by hand,
which is what the caller already appends to every base it could not ask.

The comments said the same counts as fact, and cited a probe file that is
not in the repository. The counts stay, marked as what was observed on
2026-10-06, and what does not move is now the point: following the pages
of the list lands deeper in the namespace, not back at the catalog it was
namespaced from. The dead file references are gone, and one test checks
that the message counts nothing at all, so a count cannot creep back in.

Tests: TestFetchOpenRouterRuleOverTheFourBaseCombinations (the message names
the Chat base and the ids to type, and holds no number but the version in
that base's path).

Co-authored-by: multica-agent <github@multica.ai>

* provider: the list of a multi-protocol vendor is asked once (#1006)

The dedup added in 952d0b00 is keyed by the base URL as it is configured,
which is neither of the two things that decide whether a list is asked
again: which list URL the request goes to, and what it authenticates with.
Both of a vendor's ends were lost to it. A Chat base and the Anthropic
base of the same remote magpie are two strings, one list — GET /v1/models
— and it was fetched twice, which #1282 says a remote's test does not do.
And one base string serving Chat, Anthropic and Gemini is three requests:
the Chat request refused a 401 took the other two for lists already had,
so a vendor whose models were all there was reported as serving none.

The key is now the list URL and the authentication, in catalog.Listed, and
it gives two rules. A list URL this key has listed is not asked again by
any protocol — the answer is the answer, so …/v1 and the bare host beside
it are one request. And a request already made is not made again, but a
URL refused under one authentication is not refused under the next, so
the Gemini and Anthropic lists of a base whose Chat request was refused
are asked, each with its own. The base string is left out of the key on
purpose: Chat and Responses at one base are one request because both send
Bearer at the same URL, not because the strings match.

A base whose every list was asked already and none answered says so with
catalog.ErrAsked, which the caller reads as "nothing new here" rather
than as a second refusal to put in the message the user reads.

Tests: TestFetchAsksEachAuthenticationAtOneBase, TestFetchAsksOneListOnce
ForTwoBasesOfIt, TestFetchReportsOneRefusalForOneBaseAskedTwice.

Co-authored-by: multica-agent <github@multica.ai>

* provider: a Gemini base that fails once no longer deletes the picked model it listed

The union fetch merges a Gemini base's list like any other protocol's, but
it kept none of the fetch's bookkeeping for it: what it listed was in no
`side`, so the parts saved beside the catalog said no base listed it, and a
base that could not be asked was in no `dead` either, so `keepDeadSides`
never saw it. A picked Gemini model was therefore dropped from the user's
provider for good the first time the Gemini endpoint answered 502 or timed
out — the fault the Anthropic base of the same fetch was fixed for in
#904. A Gemini base also went uncounted in `asked`, so a two-base provider's
parts were saved on the strength of one base asked.

A Gemini base now joins `asked` before it is asked, joins `sides` and
`answered` with what it listed, and joins `dead` when it cannot be asked.
What a failed Gemini base keeps is its own models alone, so a model its list
has really dropped is still dropped from the picks.

Verified at 20ee273aaedc10ab0baf06cffbd826ddc367be3c + this commit, Go
1.26.8, darwin/arm64, under a temporary HOME with GOPATH, GOMODCACHE and
GOCACHE pinned.

Without the change (internal/provider/models.go put back):

    go test ./internal/provider -run 'TestFetchKeepsTheModelsAFailedGeminiBaseListed|TestFetchDropsAGoneGeminiModelWhileAnotherProtocolFails'
    multiproto_models_test.go:713: picks after the Gemini base failed: [gpt-a], want [gpt-a claude-b]
    multiproto_models_test.go:824: picks after the Gemini list dropped a model: [gpt-a gpt-b claude-b claude-c], want [gpt-a gpt-b claude-b]
    FAIL (exit 1)

With it:

    go test ./internal/provider -run 'TestFetchKeepsTheModelsAFailedGeminiBaseListed|TestFetchDropsAGoneGeminiModelWhileAnotherProtocolFails'
    ok (exit 0)

    go test -tags nogui ./internal/provider -count=1
    ok  github.com/yetone/magpie/internal/provider  109.187s (exit 0)

    gofmt -l internal/provider/models.go internal/provider/multiproto_models_test.go   (prints nothing)
    go vet ./internal/provider                                                       (exit 0)
    GOOS=linux go vet -tags nogui ./...                                               (exit 0)
    GOOS=windows go vet ./...                                                         (exit 0)
    go build ./...                                                                     (exit 0)
    GOOS=linux go build -tags nogui ./...                                              (exit 0)
    GOOS=windows go build ./...                                                        (exit 0)

The maintainer's own reproduction of the first failure, run on 20ee273a
before anything was changed, is the same one line and exits 1:

    --- FAIL: TestZZGeminiSideKept (0.04s)
        zz_gem_test.go:81: picks after a protocol failed: [gpt-a], want [gpt-a claude-b]

The whole-repository `go test -tags nogui ./...` was not run: the change
touches only internal/provider, and that package's full suite is green.

Co-authored-by: multica-agent <github@multica.ai>

---------

Co-authored-by: multica-agent <github@multica.ai>
2026-10-13 13:42:56 +08:00
Kenoia 7df0a5bf32 catalog: a vendor's own model name is kept ahead of the catalog's, and fallback names never collide (#1188, fixes #1119)
Command Code's Flash Fast showed the catalog's "Flash", the same name as
plain Flash, so the picker had two "Flash" rows. An unprefixed `name`
from a vendor's /models now wins over the catalog fallback
(magpie_label and display_name still come first). A `Vendor: Model`
name such as OpenRouter's falls through to the catalog as before, so
OpenRouter's names don't change.

A catalog fallback that would give two ids one name keeps the id
instead. Exposed fills names only for unlisted picks and checks every
available name and id for a collision; listed picks keep exactly what
Available returned, Antigravity's id-only names among them.
TestNameOf's case-variant expectation changes on purpose: glm-5-turbo
and GLM-5-Turbo together keep their own ids.

Kenoia's PR head f538b19e, which conflicted with main in
internal/catalog/live.go and live_test.go; the conflict was resolved
keeping both main's live-name changes and this one.

Run on this tree (origin/main 848d2ea9 + the PR): gofmt -l clean;
go vet darwin, GOOS=linux -tags nogui and GOOS=windows on
internal/catalog and internal/provider; go test -tags nogui
./internal/catalog/ ok and ./internal/provider/ ok (805s, full
package, on the same change over 5b14ebf4), and -run Name|Catalog|Live
again on 848d2ea9. With the live.go fallback reverted, the new
live_test and model_names tests go red. Not tried against Command
Code's live /models with a real account.
2026-10-13 11:43:54 +08:00
yetoneandwangru8080 b3805203d8 gateway: drawing reads a relay's whole model list for which key serves an image model, and a key's 404 about the model asks the next key (#1657)
What: Provider.Serves now reads a new catalog.LiveAll (the fetched list
with image and video models kept) instead of live(), which drops Draws and
Films models. The draw key loop and the custom video path move on to the
next key when a key answers 404 whose body says the model isn't served
(keyLacksModel = 404 + modelRefused's wording); any other 404 still stops.

Why: wangru8080's analysis on #1657. A relay whose per-key lists name
gpt-image-2 under one key only still had drawing try a key that lacks it:
Serves read a list with the image model filtered out, so every key looked
unlisted, and that key's 404 "Model ... is not supported by any configured
account in this group" ended the loop instead of asking the next key.
Embeddings already move on any error short of the last key.

Run (sandbox HOME, private GOCACHE, worktree at origin/main 97dfed0f3):
- TestDrawGoesPastAKeyTheRelayListsForText, TestCustomVideoGoesPastAKeyThatLacksTheModel.
  Break checks: old Serves -> subtest 1 asks key-a first; draw loop without
  keyLacksModel -> subtest 2 gets the 404; video loop off -> 404 on start.
  A bare 404 still never reaches key-b.
- gofmt -l; go vet ./... (darwin), GOOS=linux -tags nogui, GOOS=windows;
  go build for all three.
- go test -tags nogui ./internal/gateway ./internal/provider
  ./internal/catalog ./internal/codexcat: all ok.
Not tried against a real relay.

Co-authored-by: wangru8080 <22983744+wangru8080@users.noreply.github.com>
2026-10-13 05:05:23 +08:00
yetone 4c1e6db0fa gateway, provider: an image model the vendor turns away in chat, naming its images API, draws there (#1837)
What: when a drawing asked on chat completions comes back 400/422 with
the vendor's message naming images/generations, magpie asks the images
API with it (and the other way round: an images-API refusal naming
chat/completions goes to chat), and tells that second answer. Before,
only a 404/405 moved a drawing to the other API. The model test in the
provider editor does the same for an image model (DrawsID) refused in
chat that way, so it is tested where the gateway draws with it.
catalog.PointsToImagesAPI / PointsToChat are the one shared check.

Why: #1837, omp's generate_image with Settings > Image generation on
agnes-image-2.5-flash got 400 "Model agnes-image-2.5-flash is an image
model. Use /v1/images/generations". catalog.ImagesAPI goes by name, and
agnes-image-2.5-flash reads like gemini-*-flash-image, which chat, so it
went to chat completions and the vendor's 400 was passed on. The vendor's
own words are the rule now, not one more name in the list.

Run: TestDrawGoesWhereTheVendorPointsIt (gateway; the reporter's exact
400 body) and TestTestModelsGoesWhereTheVendorPointsIt (provider) both
fail on the old draw.go / test.go and pass now. gofmt -l clean; go vet
./... on darwin, linux (-tags nogui) and windows clean; go test
./internal/catalog ./internal/provider ./internal/gateway green.

Not run: against Agnes's real API (no account); the 400 text is the one
in the reporter's screenshot. Image models stay out of chat agents'
model lists as before (catalog.Chat / LiveDrawers): the omp error came
from magpie's image tool, not from omp's chat model list.
2026-10-13 00:00:06 +08:00
yetone f340aecabc provider, agent: a context window the user typed on a routing group or a provider is the one Codex and Claude Code run to, not magpie's default 272K (#1809)
A DeepSeek V4.1 Flash routing group set to 500K reached the catalog as
Context 500000, but magpie's default working window (settings.Working,
272K, #876) cut it: Codex's magpie-models.json said context_window
272000, max_context_window 500000, and Codex runs to 95% of
context_window, the ~258K in the report. Claude Code showed 500K
(CLAUDE_CODE_MAX_CONTEXT_TOKENS) while magpie also wrote
CLAUDE_CODE_AUTO_COMPACT_WINDOW=272000, so it compacted at 272K too and
only displayed the larger number.

From Codex's source (openai/codex @0c7362d, codex-cli 0.162.1):
config.toml's model_context_window sets context_window to
min(value, max_context_window); usable = context_window x
effective_context_window_percent (95 by default); the auto-compact
limit is min(model_auto_compact_token_limit, 90% of context_window).
magpie writes neither config key and still doesn't, so a user's own
model_context_window keeps working as before.

magpie's default compaction now gives way to a window the user typed,
as it already gives way to Claude Code's own autoCompactWindow
(602d4ec6):
- provider: Entry.WindowSet marks a window typed on the provider for
  the model or all its models (ContextOf) or on the group (a size).
  CompactFor answers the threshold Codex is told: a per-model or
  provider Compact at first (CompactSet), else that whole typed window
  when no size is typed in Settings, else 0 (the default). Used by the
  gateway's Codex list (codexListed) and WindowTyped for Claude Code.
- agent: magpie-models.json (and the WSL twin) take CompactFor, so the
  group says context_window 500000 with no max; Claude Code gets no
  AUTO_COMPACT_WINDOW on a typed window unless Compact at is typed in
  Settings.
- A model nobody typed a window for keeps 272K, and a Compact at size
  typed in Settings still comes before a typed window.
- gui: unchanged. f36e744c3 shortened Settings > Long conversations to
  one line upstream; it no longer spells out precedence.

Run:
- internal/agent TestTypedWindowReachesCodexAndClaudeCode: group 500K,
  provider per-model 400K, an untyped 1M model, then Compact at 300K;
  checks magpie-models.json, the gateway's Codex list and Claude Code's
  env. On the old code it fails 6 ways (272000/500000 and 272000/400000
  on disk, list Compact 0, Claude compact 272000), checked by reverting
  the non-test files.
- Sandbox HOME with the built binary and real codex 0.162.1
  (`codex debug models`): old binary group/ds-flash 272000 / max
  500000; new 500000, no max. A per-model `context` override of 1m:
  old 272000 / 1000000, new 1000000. `magpie model compact 300k`:
  300000 with the typed window as max. Claude Code in the sandbox: old
  wrote AUTO_COMPACT_WINDOW=272000 + MAX_CONTEXT_TOKENS=500000, new
  only MAX_CONTEXT_TOKENS=500000.
- gofmt -l, go vet (darwin, GOOS=linux -tags nogui, GOOS=windows), the
  three builds, go test -tags nogui ./...: 45 packages ok. At load
  average ~115 agent, gateway, library and provider hit the 10m
  timeout with no failure. Rerun with -timeout 40m, agent, library and
  provider pass. gateway failed three timing tests that pass 3 of 3
  alone: TestOTelWaterfallIncludesUnbilledFallback (#1794, already
  fixed on origin/main by 6ae6b3402), TestCodexHeardWithinItsIdleTimeout
  (#1800, open) and TestIntentClassifierFails (filed as #1829).

Not tried: a real `codex exec` turn against a sandbox gateway (the
catalog Codex reads was checked with `codex debug models` instead), and
Windows itself; the path is the same Go code on every OS.
2026-10-12 23:22:33 +08:00
yetone 77aabb9a46 agent, codexcat: the effort new sessions are set to lasts a switch of model in Codex, Claude Code and Grok Build, at the model's nearest level where it lacks it (Creat.wu on Discord)
Creat.wu set magpie's "New sessions" effort to the highest level. A new
session started at it, but picking another model (a routing group) dropped
the effort back to the model's default.

Codex: on a switch, the TUI's /model highlights and saves the picked model's
preset default_reasoning_effort. The desktop app keeps the current effort only
if the new model lists it, and otherwise uses defaultReasoningEffort. Both come
from magpie's catalog default_reasoning_level, which codexcat.DefaultEffort
always set to the middle level. A group's levels are the intersection of its
members' levels, so a group often lacks xhigh or max.
- The catalog default is now codexcat.ModelDefault: the model_reasoning_effort
  set in config.toml when the model takes it. Otherwise it is the model's
  nearest level (catalog.NearestEffort: by rank, a tie going up, never
  "none"), so xhigh on low/high/max gives max. When the effort is left at
  Default, the default is still the middle of the road.
- This covers both magpie-models.json and the list the gateway hands a
  signed-in Codex. The effort is now part of that list's tag, so Codex asks
  for the list again.
- Setting the effort in magpie rewrites the list, or marks Codex's cached
  list stale.
- An effort the model picked in magpie doesn't take now settles on the
  nearest level, not the middle.
- The gateway's fitEffort uses the same NearestEffort.

Claude Code: Opus 5.5 and later read only
modelSettings.<model>.effortLevel. A level set while on one of them was
written only there, so a routing group or another vendor's model picked
afterwards (which reads the top effortLevel) started at its own default.
- The top effortLevel is now written too.
- A reset takes the top one out only when it is the level written beside
  the model's own; a top level the user set themselves stays.
- max was already written to the env and applied to every model.

Grok Build: picking a model without the chosen default_reasoning_effort
deleted the key. It now keeps the model's nearest level.

Checked and not affected:
- WorkBuddy, ZCode, Kimi and MiniMax keep per-model levels (keptEffort).
- Qoder and Command Code keep one level for each model by their own design.
- AtomCode keeps one model table each.

What was run:
- Real codex 0.162.1, `codex debug models` with CODEX_HOME in the
  scratchpad, on a catalog from CatalogAt(..., "xhigh"). It renders
  default_reasoning_level max for low/high/max, high for a low/medium/high
  group and xhigh for a model that has xhigh.
- New tests TestCodex/Grok/ClaudeNewSessionEffortLastsModelSwitch,
  TestNearestEffort and TestModelDefault. The three agent tests, plus the
  updated TestCodexCustomProviderModelHasEfforts and
  TestClaudeEffortModelSettings, fail on the old code: the source files were
  checked out from the parent with the tests kept.
- gofmt -l is clean. go vet -tags nogui ./internal/... passes for GOOS
  darwin, linux and windows.
- go test -tags nogui: internal/agent, catalog, codexcat and provider pass in
  full before the rebase.
- In gateway, only TestOTelWaterfallIncludesUnbilledFallback failed. The
  root span was in a second export, which is #1794, fixed on main by
  6ae6b3402.
- After rebasing on origin/main, catalog and codexcat pass in full. gateway
  -run 'Effort|OTel|Reasoning' and agent -run 'Effort|Codex|Claude|Grok'
  pass.

Not tried: the Codex desktop app's picker by hand. Its behaviour was read
from ChatGPT.app's app.asar.
2026-10-12 23:18:32 +08:00
yetone b0a904bd9a provider, catalog: a model listed with a 512-token window is told to agents at models.dev's window, or none, never 512 (H20 on Discord)
H20 and others saw free models (hy3, Cline's free ones) at a 512-token
context window, and Claude Code and Codex then treated them as unusable:
they compact at once. Every agent and the gateway read a model's window
from its catalog entry (Entry.Context, from WindowOf and ListedWindow),
which took any positive window the vendor's or plugin's list gave as said.

Where the 512 itself comes from isn't seen here: models.dev's cache
(2026-10-12), Cline's live /ai/cline/models and recommended feed, the
WorkBuddy and Cline plugins' static lists and magpie's own code give no
window under 4095 for any of these models. It is in a vendor's live list
read at run time (WorkBuddy's /v3/config maxInputTokens or a plugin's
list); so the floor is where every listed window is read:

- catalog.LeastWindow (2048) and catalog.Window: a window under it is not
  known. The smallest real chat windows are about 4096
  (gpt-3.5-turbo-instruct's 4095, mythomax's 4096) and stand.
- mdModel.window: a models.dev limit under it doesn't vote, so the other
  limit, or nothing, answers.
- ListedWindow: a vendor's window under it falls back to models.dev's
  for the model, else 0 (the agent's default).
- pluginCatalog: a plugin's input or context under it is none, so a
  512 prompt cap under a 192K window leaves 192K.
- planModels (Cline): a free model's 512 takes models.dev's too.
- A window the user sets (Contexts) is theirs, however small.

Tests, with the literal 512: TestTinyListedWindowIsUnknown (a Cline
plugin listing cline-free/mimo-v2.6-flash and cline-free/hy3 at 512 is
served at models.dev's 1048576 and 192000; one nothing knows at 0; a real
4096 stands; ListedWindow on a built-in's hy3 at 512 gives 192000; a
user-set 1024 stands) and four new cases in
TestWindowClampsInputAboveContext. Both fail on the code before (512, want
1048576 / 192000 / 0) and pass with it.

Not verified: the reporter's own list, so which vendor sent 512 is
inferred, not seen; not tried in a real Claude Code or Codex.

Run for both commits, on origin/main 94aa15397, sandbox HOME,
private GOCACHE (the shared one was being emptied under the build), load
average 70-86: gofmt -l clean; go vet ./... (darwin) and go vet -tags nogui
./... with GOOS=linux and GOOS=windows pass; go build -tags nogui ./...
passes. go test -tags nogui: catalog, agent, plugin, library pass;
provider -run 'Window|Listed|Plugin|Cline|Free|Catalog|Models' passes, and
the whole of provider passed before the rebase (794s) but for
TestCopilotSecretToolUsername, which fails only inside the command sandbox
(its secret-tool script can't run there) and passes outside it; gateway
-run 'TestVertex|Credit|Rest|Quota|Rate|Free|Plugin' passes. The whole
gateway and provider packages hit their 25m and 9m timeouts on this
machine's load, with stacks in tests still running (vertex, signin_proxy),
not stuck; those two packages weren't run whole at this head.
Rebased again onto 24350a372 (the doc's Verification list took both
lines): go vet -tags nogui ./internal/... and go test -tags nogui -run
'Credit|Rest|Quota|Rate|Free|Group|Window|Listed|AutoMode|Codex' on
gateway, catalog and provider pass.
2026-10-12 22:33:07 +08:00
yetone f8214ec972 provider: a third-party Anthropic API that refuses x-api-key and Authorization together is sent one, picked in the editor or learned from its 401 (Aloha on Discord)
magpie sends a user's own Anthropic-compatible provider its key in both
x-api-key and Authorization: Bearer. Some relays answer 401 "鉴权 header,
x-api-key 和 Authorization 不可以同时存在", so every request failed.

- Provider.AuthHeader ("" both, "x-api-key", "bearer") picks which
  AuthHeaders sends on the Anthropic protocol. Anthropic's own API,
  Bedrock, Azure, Vertex and subscription accounts are untouched: they
  send x-api-key alone (or their own) whatever it says, and BothAuth()
  is false for them.
- Left at both, a 401 whose body catalog.BothAuthRefused tells as that
  refusal (names both headers and says they can't be together, Chinese or
  English) is asked once more with x-api-key alone, then Bearer alone
  (RetryOneAuth, in the gateway's forwardOnce and the provider test's
  probe; the model-list fetch through catalog.fetchOne too). The first not
  answered 401/403 is saved (LearnAuthHeader), never over a pick the user
  made. A request carrying the user's own Authorization/x-api-key header
  is never retried; any other 401 is passed on as it came, asked once.
- The editor has a "Key header" row (Both / x-api-key /
  Authorization: Bearer, the app's segmented control) while the provider
  has a third-party Anthropic URL; strings in zh, zh-TW, ja, de.
- docs/subsystems/providers-accounts.md: an "Anthropic key header" row.

Run (sandbox HOME, GOCACHE/GOMODCACHE pinned, set -o pipefail):
- gofmt -l; go vet ./...; GOOS=linux go vet -tags nogui ./...;
  GOOS=windows go vet ./...; GOOS=linux/windows go build.
- go test -tags nogui ./...: 47 packages ok; agent and gateway timed out
  at 10m under load average ~50-98 (other sessions' test runs), so rerun
  with -p 1 -timeout 60m: agent ok; gateway ok but for
  TestOTelWaterfallIncludesUnbilledFallback, a load flake unrelated to
  this (it reads only the first 200ms OTel export; passes 5/5 alone),
  filed as #1794.
- New tests: internal/provider/authheader_test.go (official Anthropic and
  Bedrock unchanged for every pick; Aloha's 401 body retried with
  x-api-key and kept; Bearer-only relay learns bearer; the model list
  learns; another 401 and the user's own header aren't retried; a user's
  pick isn't overwritten), internal/gateway/authheader_test.go (a
  /v1/messages turn through the gateway to such a relay succeeds and the
  next Chat Completions turn goes with one header first).
- Broken by hand: RetryOneAuth returning at once and AuthHeaders ignoring
  the pick -> TestAuthHeaderChoice, TestRetryOneAuthLearns,
  TestRetryOneAuthBearer, TestOneAuthHeaderRelay FAIL; the list retry off
  in live.go -> TestListLearnsOneAuth FAIL.
- GUI: provider-auth-header.test.cjs 20/20 in chromium and webkit, en and
  zh, 390px wide; the editor's other tests (provider-*, nokey-editor,
  editor-short-window, segs-*, vertex-editor) 439/440, the one
  (provider-discovery, chromium zh) passing 26/26 alone.

Not tried: a real relay of Aloha's; the retry is built from the body the
user quoted.
2026-10-12 20:18:31 +08:00
yetone 9964535adc provider: a model models.dev has just listed without its reasoning levels takes its family's, so Codex's picker offers them for a relay's gpt-6.1-sol (NextCommit on Discord)
NextCommit's Codex showed no reasoning-effort picker for a relay's (an
OpenAI-compatible key provider) gpt-6.1-sol, while gpt-6-astra had one, and
magpie's log said the effort went from none to low. models.dev had listed
gpt-6.1-sol as a reasoning model but without reasoning_options yet, or not
at all, so magpie knew no levels for it: Codex's catalog got
supported_reasoning_levels [] (no picker), and the gateway, not knowing
"none" was one of the model's levels, sent Codex's "none" as "low" (#899).

What changed:
- catalog: a thinking model with no levels of its own and no budget takes
  the levels of the newest model of its models.dev family (same provider,
  thinking, with levels) released on or before it (mdProvider.levels).
  Used by Provider and ListedBy. A model with its own levels, a budgeted
  one, one that doesn't think, or one with no family is as before.
- catalog.KinEfforts: for an id no provider lists, the levels of the newest
  listed model of the same shape with the version numbers left out
  (gpt-6.1-sol -> gpt-#-sol), never a budgeted or non-thinking one.
- provider.borrowedEfforts: tries ListedBy, then EffortsOf, then
  KinEfforts. Entry.Efforts, which every agent's model list is built from
  (Codex, Claude Code, OpenCode, dsh, ...), goes through it, as do Known,
  Levelless, groups and plugins.
- Xiaomi's mimo, which takes a thinking switch only (#214), still gets no
  levels; gpt-4.1 gets none.

With levels known, an effort the user picks in Codex goes through as
picked. The none->low mapping remains for models whose levels are still
unknown (#899).

What was run:
- New tests: TestFamilyLevels (catalog) and
  TestNewModelTakesItsFamilysLevels (provider, Codex catalog levels for
  relay/gpt-6.1-sol). Both fail with levels() and the KinEfforts call
  neutered (levels "" against the family's), and pass with them.
- Real Codex CLI 0.162.1 under a sandbox HOME against a sandbox magpie
  gateway (127.0.0.1:3592) and a fake relay (127.0.0.1:3591) listing
  gpt-6.1-sol and gpt-6-astra. The models.dev cache had reasoning_options
  stripped from every gpt-6.1-sol entry to match the reporter's.
  - Built from origin/main: magpie-models.json gave relay/gpt-6.1-sol
    default None, levels [].
  - With this change: default medium, levels none..max,ultra.
  - Codex /model showed "Select Reasoning Level for GPT-6.1 Sol · relay".
    Picking Medium, High and None sent reasoning_effort "medium", "high"
    and "none" to the relay.
- gofmt -l; go vet ./...; GOOS=linux go vet -tags nogui ./...;
  GOOS=windows go vet ./...; GOOS=linux and GOOS=windows builds: all
  clean.
- go test ./... under a temp HOME, with GOCACHE and GOMODCACHE
  pinned. Every package passed except four that hit the 10-minute default
  timeout with load average ~40 (TestCopilotSecretToolUsername's 5s
  secret-tool wait as well). Rerun with -timeout 40m -p 2, internal/agent,
  gateway, library and provider all passed.

Not tried: the Claude Code, OpenCode and dsh model files written for the
same relay model; they take Entry.Efforts like Codex.
2026-10-12 19:02:25 +08:00
yetone 2df2e0886d plugin, provider, gateway: a plugin's model is listed with every kind it takes and gives (audio, video, pdf), not image alone (#1595, tkhs101)
The plugin host read a model's capabilities.input only for "image", and
fromModelsDev hard-coded output to text, so /v1/models listed
opencode-zen-free's muse-spark-1.3-contributor-free (models.opencode.ai:
input text/image/audio/video/pdf) as ["text","image"] with no output.

- host.js: fromModelsDev and the config merge keep modalities.input and
  .output whole; the listing sends inputs/outputs, the kinds the
  capabilities object marks true, in OpenCode's order.
- plugin.Model gets Inputs/Outputs; pluginCatalog puts them on
  catalog.Model's new InputModalities/OutputModalities (input only where
  the plugin said what it takes, as ImageInput already is).
- catalog: models.dev entries and a vendor's live list (now reading
  modalities.output) fill the same fields; Decorate carries the catalog's
  when the live list says nothing, beside ImageInput.
- provider.Entry.Modalities() is what the gateway lists: the source's
  kinds, with "image" still decided by Images, so the user's own
  "takes images" override still wins and the other kinds stay.

Not changed: the 7 models the report lists as having lost their levels
have reasoning_options [] upstream (models.opencode.ai), so "reasoning,
no levels" is what they are; mimo-v2.6-flash turns away levels (#214).
DSH's model kinds and Muse's list still say text/image only.

Tests: TestPluginModelModalities (gateway) with the reporter's literal
metadata: muse-spark's config as opencode-zen-free 0.1.3's configModels
writes it, and mimo-v2.6-flash-free's capabilities as its models hook
lists them; a model said nothing of stays unlisted, and the image
override drops image only. TestFetchedModalitiesKeepEveryKind (catalog).
Broken by hand: host.js without inputs gives the report's [text image]
(red); Entry.Modalities without the Inputs branch (red); Decorate
without the fill (red). Run: go test catalog, plugin, provider, gateway;
gofmt -l; GOOS=linux and windows go vet on the four; go test ./...
green on 76db4c6c2+this; after rebasing on e9b16ca18 the four packages
again: catalog, plugin and gateway green; provider red once in a run of
all four together (the failing test's name was cut off by a tail), then
green 3 runs of 3, two of them concurrent.
2026-10-11 20:56:21 +08:00
ggbdpqandfactory-droid[bot] d1ddb7defe catalog: a model no catalog lists by its id has what its maker's entry says of it — window, thinking, images, name — not just a price (#1565, ggbdpq)
What changed: #1520 prices the id an entry names as its
canonical_model_id, but the capability tables only counted entries
listed by an id, so the model behind the id was unknown all the same:
gpt-5.6-cyber (OpenAI's gpt-daybreak-red-latest, canonical
openai/gpt-5.6-cyber) had no window, reply limit, thinking, images or
name — asked as given (WorkBuddy's shape) or behind a relay's prefix.
An entry now votes for the canonical id it names too, when no catalog
lists that id: one listed by its id keeps the answers it has. The
per-entry vote moved into a closure (vote) whose branches are the ones
it replaces, keyed the same for a listed id.

Review (yetone's session): TestCanonicalOnlyIDCarriesItsMakerWord and
the updated TestCanonicalIDIsNeverTakenForAnother fail on the previous
catalog.go (window, reply limit, thinking, images and name all empty for
gpt-5.6-cyber and claude-gpt-5.6-cyber; 0 and "" for claude-sonnet-4-0)
and pass with it. The expectations were moved to the literal catalog:
Daybreak Red's window is its input limit, 272000, not the 400000 context
(as every listed model's is), and Cortecs's name is "Claude Sonnet 4
(latest)". A sweep of every listed and canonical id (plain, claude-,
[1m]) through ContextOf, OutputOf, Thinks, SeesImages, NameOf,
EffortsOf, Knows and PricedBy on the local models.dev cache, before and
after: no answer for a listed id changed; the 23 canonical-only ids
and their renames gained theirs. The full suite, gofmt and the cross-OS
vets were run on the series.

Author's run: the red/green above; go test -tags nogui
./internal/catalog ./internal/usage ./internal/provider green; go test
-tags nogui ./... green but TestOffline (red on the baseline too) and
TestSearchFollowsTheSearchersProxy (green alone); gofmt -l clean; go
vet, GOOS=linux and GOOS=windows vet on internal/catalog clean.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-10-11 13:35:56 +08:00
ggbdpqandfactory-droid[bot] 43b6959fcd catalog: a relay's rename of a model models.dev knows only as another entry's canonical_model_id is that model now (#1564, ggbdpq)
What changed: renamed, which takes a relay's prefix and a window mark off
an id, knew only ids models.dev lists. A model no catalog lists by its id
— OpenAI's gpt-5.6-cyber, served as gpt-daybreak-red-latest whose
canonical_model_id is openai/gpt-5.6-cyber (23 such ids in today's
api.json) — stayed unknown to the rename, so claude-gpt-5.6-cyber (a
relay's, #1383) had no price, no window, no name and no capabilities,
though #1520 prices the id when asked as given. The rename now reaches
what models.dev knows as an entry's canonical_model_id, and a canonical
id is never taken for another, as a listed one never is: cortecs's
claude-sonnet-4 is claude-sonnet-4-0, and were a catalog to list a
sonnet-4-0 of its own, Claude's model would not become it.

Review (yetone's session): the two tests fail on the old catalog.go
(PricedBy of the three renamed spellings false, ContextOf 0; Drift's 99,
32000 and "Drift Sonnet" for claude-sonnet-4-0) and pass with it. The
23 canonical-only ids were counted in the local models.dev cache
(gpt-5.6-cyber only under openai's gpt-daybreak-red-latest,
claude-sonnet-4-0 under cortecs and requesty). The cortecs fixture was
made literal (name "Claude Sonnet 4 (latest)", pdf input, output 65000)
and the Daybreak Red one given its input limit 272000. A sweep of every
listed and canonical id, plain, with claude- and with [1m], through
PricedBy, ContextOf, OutputOf, Thinks, SeesImages, NameOf, EffortsOf
and Knows on the real catalog: no answer for a listed id changed; only
canonical-only ids and their renames gained one. The full suite, gofmt
and the cross-OS vets were run on the series.

Author's run: the red/green above; go test -tags nogui
./internal/catalog ./internal/usage ./internal/provider green; gofmt -l
clean.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-10-11 13:35:56 +08:00
yetone d5bb1a2b13 catalog: a model its vendor lists under another id is priced by its canonical_model_id (#1520, liuweifeng)
workbuddy/deepseek-v4.1-flash had no price in `magpie model price`, the
Usage page or the ledger. models.dev's DeepSeek catalog has no
deepseek-v4.1-flash: it sells V4.1 Flash as deepseek-flash (and the
deprecated deepseek-v4-flash, deepseek-v4-flash-vision-exp), each with
canonical_model_id deepseek/deepseek-v4.1-flash. magpie never read that
field, and #1498's served fallback can't help since the reply names the
model as asked.

PricedBy, which every price path goes through (ListPrice, MakerPrice,
EffectivePrice and so the CLI, ledger, Usage page, routing cost, session
totals), now asks last, after every id spelling and before a relay's
rename: an entry whose canonical names the asked id. Scoped so nothing
priced today changes:
- only an entry whose canonical's maker is the catalog listing it
  (deepseek's own alias), never a reseller's: OpenCode's
  mimo-v2.6-flash-free ($0), Baseten's DeepSeek V4.1 Flash Fast (2x),
  Neuralwatt's -flex all name a model they are a variant of;
- never a $0 entry (NVIDIA's own nemotron-ultra-253b-v1);
- several entries under one canonical at different prices price none.

Run: against models.dev api.json of 2026-10-10, PricedBy over every
canonical id (448) for the maker list and each of the 150+ catalogs, old
vs new: no price changed or lost; 12 newly priced, all maker lists:
deepseek-v4.1-flash, deepseek-v4-pro-0813, gpt-5.6-cyber and three
ministral-3-*-instruct-2512. Built binary in a sandbox HOME with that
catalog: `model price <relay>/deepseek-v4.1-flash` "no price" -> $0.15/$0.6,
cache read $0.003; deepseek-v4-pro, claude-opus-4-6, openrouter's
unchanged; hy3 still unpriced (tencent is no maker preset).
Tests (fixtures are models.dev's literal bytes): TestPricedByCanonicalID
and TestLedgerPricesAModelListedUnderItsCanonicalID (the reporter's
record) fail on the old code; maker scope, $0 guard, two-price guard and
listed-before-canonical order each broken by hand turn a test red.
gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui on
internal/catalog, internal/usage; go test -tags nogui ./internal/catalog
./internal/usage pass; go test -tags nogui ./... green (47 packages)
after rebasing on cc2092a4b.
2026-10-11 00:35:29 +08:00
yetone d47c0fea0b agent, provider: with CODEX_HOME set, a model picked for Codex goes to $CODEX_HOME/config.toml, the file Codex reads, and its sign-in is read and switched there (#1513, Wakkana, sunxwei)
Wakkana on Discord (macOS, Codex CLI 0.162.1) keeps Codex in a CODEX_HOME
of their own. Picking a model in magpie wrote ~/.codex/config.toml and
~/.codex/magpie-models.json, which Codex never reads, while magpie read the
pick back from the same file and showed it applied.

Checked each claim in the source: codexIn built its folder from
filepath.Join(at.home, ".codex"); so did StandIn, the compact-window tune
and KeepCodexDaemonCurrent; codexAuthPath (logins.go), codexAccount
(account.go) and the Usage card's auth.json (subscription_usage.go) read a
hardcoded ~/.codex, and since the app-server restart takes its home from
codexAuthPath, it restarted ~/.codex's daemon too. sessions.CodexDir,
catalog.CodexHome, library's codexDir and import_codex's config path
already read CODEX_HOME, each with its own copy of the rule.

Now there is one rule, appdir.CodexHome / CodexHomeIn: $CODEX_HOME through
appdir.LookupEnv (so the value proc.UserPath lends the desktop app from the
login shell counts, and a relative one reads as unset), else ~/.codex.
Every place that reads or writes Codex's files goes through it:
config.toml and the catalog (codexIn, so detection, Dir, models_cache,
history, logs, threads too), StandIn, tune, the daemon check, auth.json
read/switch/sign-in/sign-out, the import's own-catalog check, sessions,
the models cache, library targets (AGENTS.md, skills, MCP, rtk). A WSL
distro's Codex keeps ~/.codex (place.codexHome), since magpie can't read
a distro's variables. Left as they are, on purpose: library's project-level
.codex/config.toml (Codex reads that in the project whatever CODEX_HOME
is), sessions/wsl.go and wsl.go's distro probes, cliupdate's standalone
install path, and gateway/prompt.go's "/.codex/" path heuristic for a
Claude Code memory file. Codex itself doesn't expand "~" in CODEX_HOME
(0.162.0: 'CODEX_HOME points to "~/x", but that path does not exist').

Tests:
- TestCodexHomeEnvTakesThePick (agent): CODEX_HOME set, pick fakeup/m1:
  config.toml and magpie-models.json land in CODEX_HOME, Get reads it back,
  StandIn and tune use it, nothing exists under ~/.codex. Old codexIn:
  FAIL "Codex's files at …/001/.codex/config.toml, want under
  …/codex-home"; old tune.go: FAIL "tune didn't write
  $CODEX_HOME/config.toml"; old StandIn: FAIL "stand-in … is """.
- TestCodexHomeEnvSignIn (provider): auth.json, config import path and
  daemon home are CODEX_HOME's; two accounts listed from it; SwitchLogin
  writes it; ~/.codex never created. Old account.go: FAIL "sign-in in
  $CODEX_HOME not read"; old codexAuthPath: FAIL "auth.json at
  …/.codex/auth.json".
- TestRestartCodexDaemon and gui's TestCodexDaemonRestartRoute asserted the
  old ~/.codex daemon under CODEX_HOME=/somewhere/else; they now want
  /somewhere/else. TestFolderVarsAreListed scans appdir/codex.go too, so
  its CODEX_HOME canary still finds the read.

Real use, sandbox HOME + CODEX_HOME=<sb>/custom-codex, MAGPIE_ADDR on a
free port with a stand-in listener: `magpie codex fakeup/m1` (this build)
wrote custom-codex/config.toml + magpie-models.json, no <sb>/home/.codex;
real codex 0.162.0 with that CODEX_HOME: `codex debug models` listed
fakeup/m1, `codex exec` sent POST /v1/responses model=fakeup/m1 to magpie's
address. The origin/main build in the same sandbox wrote
<sb>/home/.codex/{config.toml,magpie-models.json} and left
custom-codex/config.toml at model = "gpt-5.5" (the report). The GUI app
was not run.

#1513 (sunxwei, native Windows 0.1.1157, CODEX_HOME=F:\codex-home) is the
same bug. Windows has no shell to borrow from: a user-level variable is in
the environment Explorer hands the Start-menu app, which is what
appdir.LookupEnv reads, and a drive-letter path is rooted. On the Windows
box: the agent, provider and appdir test binaries (GOOS=windows) pass
TestCodexHomeEnvTakesThePick and TestCodexHomeEnvSignIn with CODEX_HOME a
C:\ temp folder; this build's magpie.exe codex fakeup/m1 in a sandbox
USERPROFILE with CODEX_HOME=D:\codexhome-sb\custom-codex wrote config.toml
(model, magpie provider, catalog) and magpie-models.json there and created
no %USERPROFILE%\.codex. Codex itself isn't installed there, so it was
not run on Windows.

Run: go test -tags nogui ./... in a temp HOME (all ok after the three test
updates above; re-ran agent, provider, gui, catalog, sessions, library,
appdir, usage, codexcat after rebase; gateway after rebase hit the 10m
default timeout at load ~150 and passed with -timeout 25m in 656s),
gofmt -l clean, go vet +
GOOS=linux + GOOS=windows go vet -tags nogui on the touched packages.
2026-10-10 22:36:28 +08:00
yetone 7450fa5f27 provider: a request header typed in lower case is sent once and is the user's, on the model list, the tests and requests (#1487, Dudung1018)
A provider's own headers were written into the request as typed
(req.Header[k] = …) to keep their case, beside magpie's own written with
Header.Set under the canonical name. A "user-agent" or "authorization"
typed in lower case, as devtools show headers, therefore went out next
to magpie's: two User-Agents, magpie's (or Go's Go-http-client/1.1, which
Go's HTTP/1 writer adds when it finds no canonical "User-Agent") first.
The reporter's relay checks the client and answered every probe 401
"unauthorized client detected", so the headers looked ignored.

catalog.PutUserHeader now takes every header of the same name in any
case off before writing the user's, and keeps User-Agent under its
canonical name so Go adds none. It is used everywhere the provider's
headers are applied as typed: Sign (forwarded calls, endpoint tests,
detection), the model lists (catalog FetchURL/FetchAt, Gemini pages),
Kilo's list and the Gemini image path. Azure's list merge drops an
api-key of another case too. The balance read already used Header.Set.

Run: curl against the reporter's relay (ps.air-outer.com, HTTP/1.1):
User-Agent "claude-cli/2.1.0 (external, cli)" alone gets past its client
check (to "无效的令牌" for a fake key); curl/8, or Go-http-client/1.1
ahead of the claude-cli one, gets "unauthorized client detected". A
scratch Go client confirmed Go sends "User-Agent: Go-http-client/1.1"
beside a lower-case "user-agent". TestUserHeadersInLowerCaseAreSentOnce
(HTTP/1.1 httptest server that refuses two User-Agents or two
Authorizations) fails without the change on list, endpoints and detect
(User-Agent ["Go-http-client/1.1" "claude-cli/…"], Authorization
["Bearer sk-test" "Bearer relay-own"]) and passes with it. Not tried
through a built magpie against the relay with the reporter's key.
2026-10-10 18:31:32 +08:00
yetone fcae505ff7 gateway, codexcat: Codex is offered Fast on a remote magpie's model where that magpie offers its own Codex Fast, and the tier asked reaches it (#1234, PennyVibe)
remote-magpie/codex/gpt-6.1-sol had service_tiers [] in the local
/v1/codex/models while the remote's own codex/gpt-6.1-sol had Fast: the
local catalog only gave tiers to a provider added by its address
(OwnTier, Preset == ""), and the gateway sent service_tier only to one.

Now a remote magpie's /v1/models (asked with X-Magpie-Drawers) tells each
model's service_tiers as its own Codex catalog offers them
(codexcat.ServiceTiers over the same CodexCatalog/Entries as its
/v1/codex/models). The local keeps the ids (catalog.Model.Tiers ->
Entry.Tiers), codexListed hands them on for the remote's models, and
codexcat.Entries offers them with Codex's own names. The gateway sends the
tier Codex asked for to a remote magpie as it was asked (OwnTier, still
dropped and remembered if refused); the remote serves it as its own
Codex's turn. A remote from before this sends no tiers: unchanged.

Run:
- TestRemoteMagpieOffersItsTiers (gateway, the gateway as both computers
  over HTTP): fails without the codexListed change with
  `office/relay/gpt-6.1-sol offered "" ..., want "priority:Fast "`, and
  without the gateway change with `tier sent to the remote magpie [(none)],
  by it to its vendor [(none)]; want priority, priority`.
- TestServiceTiersGoOnToAnotherMagpie (codexcat): a ChatGPT account's
  model with Codex's own entry tells priority+ultrafast, a relay's GPT
  Fast, glm none; fails when either the own-entry branch of ServiceTiers
  or the namedTiers branch of Entries is taken out.
- gofmt -l clean; go vet -tags nogui for darwin, linux, windows on
  gateway, provider, codexcat, catalog, agent; go test -tags nogui of those
  five packages under a temp HOME: ok.
Not tried with a real ChatGPT account behind a real remote magpie.
2026-10-10 17:55:14 +08:00
yetone 4df1402d10 provider: Provider in model names Off names a remote magpie's models alone, not with the other magpie's provider or "routing group" after them (ARNO on Discord)
A remote magpie's list names each model by its label there (magpie_label),
which carries that magpie's provider, or "· routing group", by that
magpie's own setting. Here it was taken as the model's name, so turning
Provider in model names Off on this computer still left "DeepSeek Chat ·
Relay A" and "Fast · routing group" in every agent's list.

The list's display_name, the name there alone, is now kept beside it
(catalog.Model.Plain, Entry.Plain). provider.Labels names an entry by it
under Off, and under own for a name the user gave; two that would read the
same keep their labels as before. On is unchanged ("DeepSeek Chat · Relay A
· Remote magpie"). /v1/models' display_name is that name alone too, as it
is for every other model, so a magpie chained after this one gets it. The
provider editor's Names & levels line says the same ("plain" in the
provider's model JSON).

Reproduced in a sandbox: fake vendor on :3571, magpie A on :3572 with it
and a group, magpie B on :3573 with remote-magpie → A and `model suffix
off`: B's /v1/models said "DeepSeek Chat · Relay A", "Fast · routing
group". With the fix: "DeepSeek Chat", "Fast"; on: "DeepSeek Chat · Relay
A · Remote magpie".

Run:
- TestRemoteMagpieSuffixOff (internal/gateway, A's list bytes as served)
  fails on the old code (off: "DeepSeek Chat · Relay A", "Fast · routing
  group"), passes with the fix.
- name-suffix-remote.test.cjs, Chromium and WebKit, en/zh/zh-TW/ja/de at
  420px: 10/10; on the old app.js it fails ("… · Relay A"). Sibling
  name-suffix-*.test.cjs and names-fold: 86/86.
- go test -tags nogui ./internal/{catalog,provider,gui,agent,gateway}
  under a temp HOME with pinned caches: ok. gofmt -l clean; go vet
  darwin/linux/windows on the touched packages: ok. Full suite before push.
2026-10-10 15:08:14 +08:00
a998a36367 provider, gateway: remote magpie serves decision and retrieval APIs (#1282)
* provider, gateway: remote magpie serves decision and retrieval APIs

Configure System One from the remote address and discover explicitly marked
decision models, including Clef and custom names. Keep exposed retrieval
models when importing the remote catalog, without treating decisions as
chat or image generators. Refresh removes stale decisions and the editor
receives an explicit empty decision list when none remain.

Forward caller/session attribution for decision, retrieval and media APIs.
Preserve TUI model-list errors for a remote that cannot be reached. Document
the HTTP API surface and old-peer compatibility.

Verified with the full nogui Go suite, focused race checks, go vet, native
macOS and Linux/Windows cross-builds, and the Remote magpie browser tests in
Chromium and WebKit in English and Chinese. The new System One integration
test fails on the old code with an empty model list, and the retrieval test
fails because the remote embedding model is filtered out. Integration tests
exercise two gateways and simulated upstreams; live vendor accounts were
not used.

* gateway, provider: remote forwards keep official client headers

Claude Code and Codex keep their User-Agent through both gateways, so a
relay behind the remote that admits only official clients accepts their
requests. Only decision, retrieval and media calls set magpie's User-Agent
at their own call sites. The two-hop test covers Messages, Responses, Chat
Completions and a Codex originator with another User-Agent.

Keep entryFor limited to remote decision providers. Test rejection of
unlisted remote decisions and remove the redundant resolveDecideModel
early return: the explicit model marker and list-only Jev already exclude
vendor aliases. Document retrieval entries remaining in the shared agent
catalog and TUI list errors being shown for other mixed providers too.

Verified with the Remote magpie provider/gateway tests. Before the fix,
TestRemoteMagpieClientHeaders fails all four cases with the relay receiving
magpie/dev and returning 403 official client required; all pass after it.
Follow-up to yetone's review of #1282.

* provider, gateway, gui: remote discovery reports only the decisions it lists (#1282)

Show CLI list failures and catalog counts for mixed providers. Derive the
remote decision endpoint from its one editable address, name custom decisions
by their ids, and reuse successful discovery in endpoint tests without an
empty decide OK row. Bare-provider decision selection is documented.

Simplify decision classification around the explicit remote list and reuse
model markers while building Available, Catalog and Deciders, avoiding a
whole-list copy and scan for every model. Other providers keep their rules.

The regression tests failed before the fixes on swallowed CLI errors, blank
labels, extra endpoint fields, empty decide results and repeated discovery.
Deliberately removing retrieval/video User-Agent or System One caller
attribution makes all three receiving-side tests fail with lost agent/via.

Verified with sandboxed Go tests, targeted race checks, Linux GUI/nogui and
Windows vet/build, Chromium/WebKit en/zh browser tests and zh-TW/ja/de checks.
The two-hop tests use real gateway handlers with simulated vendor replies;
real vendor accounts and native Windows/macOS runs were not used.

Co-authored-by: XYenon <register@xyenon.bid>
Amp-Thread-ID: https://ampcode.com/threads/T-01a11cd6-93aa-767c-9d6e-f0db2a9c5bab

* gui, gateway tests: remote decision refresh leaves only its current model choices (#1282)

The empty-decision browser fixture cleared deciders but kept decision
entries in models, so its screenshot still showed the same chips. Remove
those entries and assert the visible choices in both states. Check the
real providerInfo model list after refresh too, with Jev Router retained
as chat, and verify an unnamed remote decision reaches the local picker
with its id and provider label.

No production code changes. Verified all Remote magpie tests in root,
provider, gateway and gui under a sandbox HOME with -race; the new
assertions in gateway/gui pass. Chromium and WebKit pass all six browser
cases in English and Chinese; the corrected screenshot run passes 3/3.
Targeted Linux and Windows nogui vet and gofmt are clean.

Amp-Thread-ID: https://ampcode.com/threads/T-01a11cd6-93aa-767c-9d6e-f0db2a9c5bab
Co-authored-by: XYenon <register@xyenon.bid>

---------

Co-authored-by: Amp <amp@ampcode.com>
2026-10-10 03:55:45 +08:00
yetone 68aab298d3 gateway, codex: a provider the user added by its address is sent the service_tier Codex asks for, and offered Fast and Ultrafast (hsiangron on X)
Codex's Fast (service_tier=priority) and Ultrafast (ultrafast) were dropped
on the way to a custom provider: the gateway only passed a tier on to
chatgpt.com and Cursor, and magpie's models.json entries for such a
provider's models offered no tiers, so the user's own picks were written
over.

- Request.Tier keeps the client's service_tier as sent; for a provider with
  no preset and no account (OwnTier) both buildResponses and buildChat send
  it as it is. One that refuses the field by name is asked again without it
  and remembered as unfit for it, as the other optional fields are.
- codexcat offers such a provider's model the tiers Codex's own entry gives
  the same slug (dated snapshot and provider prefix stripped), Fast on
  another GPT model, none otherwise. Presets and groups are unchanged.

Run: TestOwnProviderGetsTier (Responses/Chat x priority/ultrafast/flex),
TestPresetProviderGetsNoTier, TestOwnProviderRefusingTier,
TestOwnProviderTiers; the gateway ones fail without the gateway change and
TestOwnProviderTiers fails without the codexcat change. go test gateway,
codexcat, catalog, provider; go vet darwin/linux/windows; gofmt -l clean.
Not tried against the reporter's relay.
2026-10-09 14:16:53 +08:00
yetone 1069785dc7 catalog: a model a relay renamed (claude-deepseek-v4.1-flash[1M]) gets its levels, window, images, name and price from the model it is (#1383, uWydnA)
Relays rename models for Claude Code with a "claude-" prefix and/or a
window mark ("[1M]", "[200K]"). Every capability getter looked the bare id
up exactly, so such a model had an empty reasoning menu, no images (the
gateway's vision stand-in described pictures to a model that sees them)
and a 0 window.

Now every getter shares one lookup (lookup -> found -> renamed):
- found is the chain EffortsOf and ContextOf already had (exact, a Bedrock
  geography, "(variant)", ":tag"), now also used by Thinks, SeesImages,
  NameOf and OutputOf, which matched the exact id only.
- renamed applies only when models.dev lists no model by the id at all
  (a new `listed` set of every bare id, whatever it says of it): a window
  mark comes off first, and if what is left is listed it is the model
  (Claude Code's claude-opus-5[1m] stays claude-opus-5, never "opus-5");
  else a "claude-" prefix comes off when the rest is listed and names a
  version, so the reporter's counter-example claude-auto[1M] is not
  models.dev's router "auto".
- ContextOf gives a mark's window (what the relay serves it at, as Claude
  Code takes [1m] for 1M); NameOf keeps the mark ("DeepSeek V4.1 Flash
  [1M]") so two models apart by window alone read apart.
- Siblings: PricedBy (last, after the dot/dash match) and ListedBy take
  the rename too; Knows follows from ContextOf/EffortsOf/Thinks.

Ran: the reporter's TestRelayRenamedIDLosesCapabilities verbatim, plus
tests for every getter on the renamed forms, Claude [1m] ids, a listed
claude-glm-5 keeping its own (empty) levels over glm-5's, near misses
(claude-auto, -flashy, [fast], [infm], anthropic- prefix) matching
nothing, gpt-5.5/auto/opus-5/glm-5 unchanged. Broken by hand seven ways
(no rename, no listed gate, no version check, mark window ignored, prefix
before the mark-stripped id, PricedBy or ListedBy without the rename):
each FAILs naming the getter. Against today's models.dev api.json:
claude-deepseek-v4.1-flash[1M] -> low,high,max, 1M, images; claude-auto[1M]
-> nothing; claude-code (listed) as before. gofmt -l clean; go vet,
GOOS=linux go vet -tags nogui, GOOS=windows go vet ./...; go build for
darwin, linux (nogui), windows; go test -tags nogui ./... in a temp HOME
all ok.
2026-10-09 13:35:14 +08:00
yetone 58ba737811 remote magpie: a remote magpie's model prices are this magpie's list prices for its models, so both Usage pages count a call at one cost (Sorghum on Discord: 希望本地 magpie 可以自动集成 remote magpie 手动设置的模型价格)
What changed
- The local magpie asks a remote magpie's /v1/models with a new header,
  X-Magpie-Prices (provider.PricesHeader, beside the Drawers and
  Videomakers headers in listHeaders).
- The remote answers each model's "magpie_price": what its own Usage page
  counts the model at (provider.EntryPriceIn: the price its user set by
  hand, else its provider's list price at its price rate; a routing group
  only when every member costs the same). EntryPriceIn is agent/route.go's
  entryPrice moved into provider unchanged, so the agents' cost and the
  remote's price are one rule.
- It tells prices only to a request from its own computer or one let in
  with a gateway key (local || sharedWith), and only when asked: a machine
  let in without a key (MAGPIE_ADDR open, not shared) and an older magpie
  or an agent that sends no header get nothing new.
- The local keeps the price with the fetched list (catalog.Model.Price; read
  raw, so an odd value or a negative part drops the price and keeps the
  model and the list) and uses it as that provider's list price
  (ListPrice -> remotePrice). A price the local user set (provider/model,
  provider/*, */model) still comes first, and the local provider's own
  price rate still applies on top.
- Old remote <-> new local: no field, models priced as before.
  Old local <-> new remote: no header, nothing new sent (and an unknown
  field would be ignored by encoding/json anyway).
- The model editor's price tooltip and `magpie model price` say the greyed
  price is what the other magpie counts the model at (remoteList; new
  string in zh, zh-TW, ja, de).
- Side effect: smallModel/cheapest picks over a remote's models (image
  description, web search) now see these prices, where every remote model
  was unpriced before.
- docs/subsystems/providers-accounts.md: a row for it.

What was run
- New TestRemoteMagpiePrices (real gateway handler behind lanGuard as the
  remote, a local remote-magpie provider fetching it): the remote's hand-set
  price is the local's price; a real chat call through it costs $9 on both
  the local's and the remote's usage records; the local's own price wins
  and survives a refetch; an old remote's list leaves the model unpriced.
  New TestRemoteMagpiePricesTold: priced for loopback asking, not without
  the header, not for a keyless LAN caller with MAGPIE_ADDR open, priced
  with a gateway key. New TestLiveMagpiePrice in catalog.
- Broken by hand, each red: no remotePrice in ListPrice (FAIL: priced
  false); remote price over the user's (FAIL: remote's price won); the
  local/sharedWith gate removed (FAIL: keyless machine priced); the header
  gate removed (FAIL: told to a list that didn't ask); sane() always true
  (FAIL: a/negative priced). A string-typed magpie_price first failed the
  whole list ("not a model list"), hence the raw read.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: clean; go build, GOOS=linux -tags nogui and
  GOOS=windows builds OK; go test -tags nogui ./... green under a temp HOME
  with pinned caches.
- GUI: model-price-edit (new remote-title check), model-price-tiers,
  provider-price-rate, gui-ja, gui-de, gui-zh-tw, i18n-keys: 18/18 in
  Chromium and WebKit; the title check goes red with the remoteList branch
  removed.
- Not tried between two real magpie binaries on two computers, nor in the
  real window.
2026-10-09 09:43:54 +08:00
yetone 844b9ca3ac provider, gateway, gui: a custom provider's Base URL can be a Gemini API (generateContent): …/v1beta, its models listed from it, the key sent in x-goog-api-key (#1346, NagaseMinato)
The custom provider editor's Base URL has a fifth API, "Gemini compatible"
(Gemini 兼容 / Gemini 互換 / Gemini-kompatibel), beside OpenAI, Anthropic and
Responses; More endpoints has a Gemini URL; the CLI takes gemini=. A
Gemini URL is kept as its base (…/v1beta, a relay's path prefix kept, a
pasted models/…:generateContent cut off). Every client's request, Chat,
Messages, Responses or Gemini, streamed or not, goes upstream to
models/{model}:streamGenerateContent?alt=sse under it, with no model in
the body and the key in x-goog-api-key; models are listed from its
/models, a page at a time, keeping those that serve generateContent.
Detect doesn't ask a Gemini API and is hidden while it is picked.
Factory's Gemini route and Bearer token are unchanged.

With five APIs the pick no longer fits a 900px editor in English and
German, so it wraps to a second row, and its thumb now follows the
picked option onto that row.

Verified against fake httptest upstreams only; no real Gemini key or
relay was tried:
- TestCustomGeminiUpstream (gateway): chat, chat stream, messages, a
  Gemini client's stream and non-stream, behind /proxy/v1beta. Fails with
  "chat: 404" without the gateway.go change.
- TestCustomGeminiProvider, TestGeminiBase, TestFactoryGeminiUnchanged
  (provider).
- go vet, HOME=$(mktemp -d) go test -tags nogui ./... (44 packages ok),
  GOOS=linux and GOOS=windows go vet on the touched packages.
- provider-gemini.test.cjs (new, en/zh/ja/de, Chromium + WebKit, 8 pass;
  fails with "900px: the thumb is 22px off" without the slide() fix),
  and in both engines: provider-base-api, provider-detect,
  provider-detect-models, provider-add-models, provider-output-picks,
  provider-search, provider-url-each-api, seg-contrast, settings-groups,
  menu-scroll, click-scroll, ledger-hscroll, strip-scrollbar,
  view-scrollbar, usage-ledger-chart, system-one, gui-ja, gui-de,
  gui-zh-tw: all pass.
2026-10-09 01:10:25 +08:00
yetoneandClaude 5ba0601fda gateway: Codex's Ultrafast goes first to a ChatGPT account whose own model list offers it, and one whose plan doesn't is asked for Fast instead of being sent a tier it may refuse (yxinyu715 on X)
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-08 22:51:58 +08:00
Charan Rathore 5f0490a4ad provider, catalog: a prompt cap above a model's window is held to the window (#1286) — a catalog row with limit.input over limit.context (opencode/hy3-free's 192K over 190K, Cloudflare AI Gateway's gpt-5 at 272K over 128K, venice/openai-gpt-52) was served past its window, to the gateway's /v1/models and to every agent compacting at it. The input limit still wins wherever it sits under the window (gpt-5's 272K of its 400K, a real prompt cap; OpenCode's own client compacts at input too), and a row naming only one number keeps it. TestPluginCatalogClampsInputAboveWindow and TestWindowClampsInputAboveContext fail without the change. go vet, go build -tags nogui and go test -tags nogui ./internal/provider ./internal/catalog under a temp HOME pass. (#1288) 2026-10-08 18:45:13 +08:00
yetone e0bf3e61ed catalog: a model the provider's catalog doesn't list is named as the other providers name it (John on Discord #feedback: GLM Coding Plan and ZCode name the same models in different case, in the provider list and the group picker) — the Coding Plan's /models (open.bigmodel.cn and api.z.ai, read with a real key) gives ids alone, glm-5-turbo, glm-5.3-flashx …; catalog.Decorate names only those Zhipu's models.dev entry (zhipuai) lists, so glm-5-turbo kept its id as its name beside ZCode's GLM-5-Turbo. models.dev's load now keeps each model's name as most providers serving it give it (a name that is only the id casts no vote), catalog.NameOf reads it by bare id in any case, and catalog.Named fills it in for a model still named by its id: in Available's live list and for a pick the list doesn't have. Ids, and what is sent upstream, are unchanged; a name the user gave stays theirs (Catalog's Name, with the new one as Default); an Azure provider is left out, its deployments named as their owner named them. TestModelNamedAsElsewhere (the Coding Plan's real ids, a user name, an Azure deployment) fails without the provider change and passes; TestNameOf is new. TestSearcherChosen read whatever catalog an earlier test had left loaded, and now resets it: with none, its lists' models go by their ids, as it expects. go test ./internal/catalog/ ./internal/provider/ ./internal/gateway/ ./internal/gui/ . pass; -race -count=5 for the two new tests; go vet, linux(nogui)/windows builds pass. No GUI change (the GUI and the group picker show name || id). 2026-10-06 13:09:40 +08:00
yetone 3ab27186c9 cleanup: drop eight functions nothing calls — catalog.ProviderEnv/ProviderAvailable, subscriptionRun.attached, hasTool, kiroSignedIn, SetModelSame (SetModelPrefs calls setModelSame itself; the comments name it), sessions.claudeFiles and plugin.SetConfig. Found with deadcode -test -tags nogui and checked by git grep across .go and .js; the ones only the GUI build or one platform calls stay. vet on darwin, linux, windows; catalog, gateway, provider, sessions and plugin tests pass. 2026-10-06 05:34:29 +08:00
yetone 3a30ac87c2 catalog, gui: a 1-hour cache write is 2× input for a Claude model only, any other's unset is its 5-minute price and isn't shown (PAMI on Discord)
v0.1.1032 counted a 1-hour cache write left out at 2× input for every
model, so gpt-6-astra priced 10,50,1,12.5 showed "$20 (1 hour) at 2×
input", a write OpenAI has no price for. OneHourFor gives a Claude model's
price, listed or given by the user, its 2× input; any other model's 1-hour
writes count at the 5-minute price, magpie model price shows only its cache
write, and the app shows the 1-hour box only for a Claude model or one
priced with one.
2026-10-05 22:55:30 +08:00
yetone 71d2da1f42 catalog, usage, gateway, gui: a price can have a long-context tier and a 1-hour cache write, and the price boxes take decimals (PAMI on Discord)
OpenAI bills gpt-6-astra, gpt-6.1-sol and gpt-6-luna over 272K input at 2× input and cache and 1.5× output, for the whole request. A price now has tiers: `magpie model price <m> 10,50,1,12.5 --tier 272k 20,75,2,25` (--tier can repeat). A tier applies when input + cache reads + cache writes is over its size, so 272,000 is not over and 272,001 is. The built-in prices take tiers only where models.dev lists one (cost.tiers of type "context"), and it does list one for those three. The ledger, each request and OTLP are costed at the tier the call reached. Session and day totals sum many calls, so they stay at the base price.

Anthropic bills a cache write kept for an hour at 2× input and one kept for 5 minutes at 1.25×. Its usage reports which is which in cache_creation.ephemeral_5m/1h_input_tokens. The gateway (API and Claude subscription) and Claude Code's transcripts now keep that split. A price's fifth part is the 1-hour write. When it isn't given, it is 2× input: that is Anthropic's rule, and only Anthropic reports 1-hour writes. Claude list prices carry the 2× too. cache_write_tokens is still the total, and the usage CSV adds cache_write_5m_tokens and cache_write_1h_tokens at the end. The app shows the split on a request's Cache and on the usage tooltips. Old prices and old records, which have no 1-hour part, read as before. The sessions cache (18) and the call cache (calls-v8) are re-read once.

In the GUI, the price boxes were number inputs and dropped what they didn't parse ("0,25"). They are now decimal text boxes that take both "0.25" and "0,25". A model's price row has a 1-hour box (empty means 2× input) and a quiet Long-context price row. That row shows the list's tier greyed in, or sits behind a link when the list has none. A bad size is refused by name. en/zh/ja/de.

Tests:
- New: TestPriceTiers, TestCostSplit, TestPriceJSON, TestModelPriceTiers, TestModelPriceTierCmd, TestAnthropicCacheWriteSplit and TestClaudeCacheWriteSplit. The ledger CSV test expects the new columns.
- model-price-tiers.test.cjs is new; model-price-edit and provider-price-rate are updated. All of them fail against the old assets and pass in WebKit. Chromium couldn't be launched here.
- go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass.
2026-10-05 21:56:59 +08:00
yetone 1cf07610c2 gateway: a Remote magpie searches the web for its own models, and Settings may name it to search with (Player on Discord) — Claude Code's WebSearch on remoteMagpie/glm-5.3 was judged unsearchable here (its host is no search vendor's) and went to this magpie's searcher, another model, and Settings' Searcher never listed the remote's models. Its list now tells another magpie, of each model, how it searches (web_search: native, by the vendor, or magpie, with its own searcher); a web search offered to such a model goes on to it as offered (Chat's as web_search_options), and the remote magpie, with the models it searches natively for, is a searcher. A search run for another model is marked (X-Magpie-Searching) and the other magpie then lets only the model search, so two magpies naming each other never ask each other in turn. TestRemoteMagpieSearches fails without the change; go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass (4 load-timeouts in agent/gui/provider pass alone). 2026-10-05 16:41:41 +08:00
yetone 1aaac93b52 provider, gui: Compact at — where Codex and Claude Code compact a long conversation, set per provider or per model in its editor and to any size in Settings → Long conversations (#876, hisiling)
Until now the only choice was 272K for every model or Full window for every model. The 272K default stays as it is (e950eb08: OpenAI runs its own 1M models at 272K in Codex, and Chen saw 70–90s to a first token at 550K).

What changes:

- A provider's editor has Compact at beside Context window and Max output, in the same form: "500k" for all of its models, "deepseek-v4-flash=272k" for one, and empty to follow Settings. A size at or above a model's window means the whole window. The values are kept in settings.ModelCompacts.
- Settings → Long conversations takes a size of its own beside Compact at / Full window (settings.CompactAt).
- `magpie model compact` takes a size such as 500k.

Order: the model's own value, then its provider's "*", then Settings. Full window turns off only the Settings value. A group uses the smallest value among its members.

Where it applies:

- Codex's model_catalog is told the threshold as context_window, with the whole window as max_context_window.
- Claude Code's CLAUDE_CODE_AUTO_COMPACT_WINDOW follows the main model. A Claude model now takes its provider's value when one is set.
- The Codex list tag changes when the Settings size or Full window changes.

Tests:

- New: TestModelCompactsSetFromTheEditor, TestSetCompactAt, TestCodexCatalogCompactAt and TestClaudeCompactAt.
- TestSettingsSaveKeepsWhatItDoesNotSend now covers the two new fields.
- compact-at.test.cjs (WebKit, en/zh) checks the editor field (shown, refused, chips, saved) and the Settings size (posted, hidden under Full window, no scroll).
- go vet ./..., go test -tags nogui of the root package, provider, codexcat, agent, gui, gateway, settings and catalog under a temp HOME, and GOOS=linux/windows builds all pass.
2026-10-05 15:20:05 +08:00
yetone 41ed1c95bc gui, provider: the request log scrolls sideways from a bar at the window's foot and a request's detail opens with its status, duration and a View routing link (mintonight, #799); a provider has a price rate its costs are counted at (ITea312, #819) — #799: the request table, wider than the window, could only be scrolled sideways from the scrollbar at its very end, below 40+ rows, so it looked like it had none; and the "status detail" the reply pointed to wasn't to be found in the row's detail. A bar (#ledHScroll) now sits at the window's foot while the table is wider than its box, scrolling with it both ways; a row's detail begins with Status (Succeeded for log rows), Duration and Routing: View routing, which opens the request's route. #819: costs were counted only at the official (list or maker) price, or a price set per model with magpie model price; a relay billing 0.8 of it had to have each model priced by hand. The provider editor (key and signed-in alike) has a Price rate field (empty for 1; 0–1000, three decimals), saved as priceRate; EffectivePrice multiplies the list/maker price by it, and a price set for a model stays as set. Usage caches key on the providers file, so the counts follow. zh, ja, de strings. ledger-hscroll.test.cjs (fails on the old code) and provider-price-rate.test.cjs (WebKit, en and zh); usage-ledger, usage-ledger-detail (updated for the new rows), usage-ledger-content, usage-ledger-chart, routing-failed-open, purpose-filter, provider-concurrency and provider-levels-save pass on WebKit. TestPriceRateScalesListPrice, TestPriceRateOK, TestPriceRateOf. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. 2026-10-05 02:03:10 +08:00
tobitege 21702d01ff Add German translation; harden paths against unset env vars (#770)
* Add German translation and harden paths against unset env vars

Add a German locale to the GUI, tray menu, usage alerts and website home page, and refuse to start when the home folder is unset or relative so nothing is written under the working folder; the pi plugin no longer adopts the user's PI_CODING_AGENT_DIR, and an inherited APPIMAGE no longer selects portable mode. Scripts refuse to run from the wrong folder or empty a shared out folder, and a new internal/testenv sandboxes every test package from the user's real files, which also fixes the Claude picker and Termux installer tests on Windows.

* Makefile: know magpie's folder by its go.mod, so paths with spaces work

The check compared $(CURDIR) with $(dir $(abspath …)), which make splits on spaces, so a checkout under 'My Projects' or 'John Doe' refused every target. It now reads go.mod relative to the working folder and wants magpie's module there: make -C and a symlinked Makefile work, make -f from another folder still stops before any recipe runs.

* i18n: German for the strings main added since, with a parity test

75 strings main added (group order, patterns, slow-start wait, usage caps, RTK savings …) get their German, and two that main dropped go. gui-de.test.cjs checks, as gui-ja does, that de has every zh string with its placeholders and tags, and that the window reads in German when picked or on a German system.

* appdir: ignore relative folder variables when reading, keep them for children

CheckEnv no longer unsets anything. magpie reads the XDG folders, APPDATA/LOCALAPPDATA and every agent's folder variable through appdir.Getenv/LookupEnv, which pass over a relative value; the environment stays as it is, so the agents magpie starts get the variable as the user set it. That covers what proc.UserPath lends from the login shell too, which is set after main's check and reached the desktop app unchecked. On Windows a path rooted on the current drive (\Users\x, Git Bash's /c/x) counts as usable, and magpie version and help answer without a home, before run makes any folder.

* Sandbox the tests main added since

internal/wslrun gets testenv's TestMain, and four tests main added that set HOME alone set their home with testenv.SetHome, so on Windows they don't read the runner's profile through USERPROFILE.

* agentenv: PI_CONFIG_DIR and OPENCODE_DB take relative names on purpose

omp puts $PI_CONFIG_DIR under the home and OpenCode a relative $OPENCODE_DB in its data folder, so neither depends on the working folder: appdir no longer passes them over.

* i18n: German for the Library's multi-select and System One's decision API

The 19 strings main added since (#791's skill multi-select, the decision API snippets) get their German; the one main replaced (four APIs → five APIs) goes.

* appdir: tidy the import into magpie's group; say what Go makes of /c/x

The appdir import joins the group of magpie's own imports where a file has one. rooted's comment now says that Go takes a Git Bash path like /c/x as \c\x on the current drive, not C:\x.
2026-10-04 23:30:56 +08:00
yetone 9f7b6bd86c codex: a cached entry keeps the cache's own max when magpie's list has none, and Codex's models_cache.json is read under CODEX_HOME everywhere (follow-up to #674, from reviewing #679) — restoring a cached native entry (backend away) set max_context_window to max(MaxContext, Context) from magpie's live list, so a list saved without the max (before magpie kept it) wrote the window over the cache's own (872000 became 272000); now a list with no max leaves the cache's, and codexcat.Window still raises it to a window past it. codexcat.CacheEntries and catalog.Codex read ~/.codex/models_cache.json even with CODEX_HOME set, while codexVersion and codexInstructions followed it; all four now take catalog.CodexModelsCache() (CODEX_HOME, else ~/.codex), and provider's codexCLIHome and the copy in codexInstructions are gone. TestCodexReadsCacheUnderCodexHome, TestCodexCachedListUnderCodexHomeKeepsItsMax and TestCodexCatalogEntryFromCodexHome fail on the old code (the ~/.codex cache read, none listed from CODEX_HOME); TestCodexNativeModelsTakeSetWindows now wants a cached gpt-5.5 with no live max to keep the cache's 400000 (old code: 272000). go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass but TestProvidersAnswerWhileListsComeIn, a timing test that passes alone. 2026-10-03 21:39:13 +08:00
yetone b6467c9551 codex: Ultra on GPT-6.1 Sol wherever it is served, Copilot's too, with Codex's agents taking parts of the task (#656) — Codex offers Ultra on a model whose entry lists "ultra", and on a thread at multi-agent V2 hands parts of the task to agents of its own; its catalog (models-manager/models.json) lists it for gpt-6.1-sol, gpt-6-sol, gpt-6-astra, gpt-5.6-sol and gpt-5.6-terra, not the Lunas, which stop at max. magpie listed Copilot's gpt-6.1-sol only up to max, so Codex had no Ultra for it. Now an entry for one of those models (by the id the vendor serves: openai/…, dated snapshots) that reaches max lists ultra too, in Codex's catalog and /v1/models, and its Codex entry says multi_agent_version v2, as Codex's own does; GPT-6 Luna still stops at max. A ChatGPT account's entry stays as the backend lists it, and a group with a ChatGPT account in it offers ultra but isn't told V2 (its lead's subagent tasks come sealed, #141); the "subagents on any model" setting still stamps v1 on OpenAI's entries. Ultra is no API's level: the gateway now always sends max for it (fitEffort), even to a model whose list says ultra. Subagent tasks with web_search kept (the translated path) were fixed in v0.1.689 (#613); TestCopilotUltraSubagentWithWebSearch now covers it against a stub Copilot: the lead's spawn_agent comes back with plain arguments and encrypted_function_args [], no "encrypted" goes upstream, and the subagent's agent_message reaches Copilot as text. TestCopilotSolOffersUltra (sol has ultra in /v1/models and Codex's catalog with v2, luna not; ultra goes to Copilot as max, with and without web_search) and TestUltraIsSentAsMax fail on the old code; TestUltraOnModelsThatOfferIt and TestUltraEntriesSayV2 cover entries, groups and the catalog. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. Not tried in the Codex App with a real Copilot account. 2026-10-03 16:08:26 +08:00
yetone dff14ff465 gui: the panel's reads build the catalog once per request (owner: 这个应该是 magpie API 慢, on a Discord report that the window renders slowly) — provider.Resolve rebuilt every provider's catalog (24 providers, 270 models: 35-90ms) for each model it was asked about, and /api/state and /api/groups resolve one for every agent and row; plugin.Cached re-read the plugins' files for each PluginOf, and resolveIn's fallbacks read All() and every provider's Available() again. A GET under /api/ now holds what it builds (provider.Hold: the entries, the plugins, All, which providers list a model) for the request, at most 1s while requests overlap; a save drops it (catalog.Touched → catalog.Forget, plugin.OnChange, setMigration, and any non-GET request). Outside a request nothing is held, so the gateway and tests behave as before. On the owner's config: state 4.2s → 0.42s, groups 6.7s → 0.26s, providers 1.4s → 0.33s. Sandbox (fixed build, GETs looping): a model saved through /api/provider/save is in providers, groups and state at once and gone after the restore. TestHoldBuildsOnce, TestHoldSeesWrites (fails with Forget unset). go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui -count=1 ./... under a temp HOME pass. 2026-10-03 12:36:15 +08:00
yetone 4160f464aa groups: a routing group whose member's reasoning levels nothing knows offers its other members' levels, and Pi's thinking field offers and shows what Pi runs the model at (Moody-Sin, #597: 路由组设了推理强度最高是否正确应用?) — Pi on group/deepseek (腾讯DeepSeek) at magpie's 最高 listed off alone in its /thinking, and sent no reasoning_effort: Pi clamps defaultThinkingLevel max to the off it offers, so the group's members were asked at the vendor's default, not max.
The group offered no levels: its levels were what every member has, and a member whose levels magpie doesn't know (a Token Plan's deepseek-v4-pro-202606, which models.dev doesn't list) has none, so the intersection was empty and models.json had the group "reasoning": false. A model a provider was given that its vendor's models.dev list leaves out (TokenHub's deepseek-v4-pro, its list holding the Hy models alone) also had none in the catalog, where the gateway (Provider.Efforts) fits efforts to DeepSeek's low, high, max. Magpie's Pi field offered all seven levels whatever the model.

- provider.Exposed: a picked model the vendor's list doesn't have takes the levels Provider.Known gives it (knownElsewhere), not none.
- groupEntries: a member levelsUnknown (no levels, no account list, its vendor and maker don't list it, models.dev knows no model of its id — catalog.Knows) doesn't narrow the group's levels; the gateway sends it the effort as asked (fitEffort). A member listed with none still narrows them.
- Pi/OmO thinking field: for a model of magpie's, Options are the levels Pi offers for the entry magpie writes (piSupported, as pi-ai's getSupportedThinkingLevels), and Get shows a level it doesn't offer as Pi's clamp of it (piClamp).

Now Pi at max on that group sends reasoning_effort "max", relayed as max to both members (DeepSeek's levels have max; the unknown one is sent it as asked).

New tests: TestGroupLevelsWithUnknownMember (provider), TestPiGroupThinkingIsWhatPiRuns and TestPiClamp (agent); each fails without the change (group entry "reasoning": false; catalog levels []; field offering all seven). TestMoveCursorEfforts gives its model levels, since Pi is offered off alone for one without. go vet, nogui/linux/windows builds and the full test suite pass but the known flake TestFXInState.
2026-10-03 02:08:47 +08:00
yetone 33acb6bca0 providers: each model's credit rate shows by it in the provider's model list and an agent's model picker, Qoder's 0.5× and WorkBuddy's 0.03×, a discount's price before it struck through (01huadalang on Discord: qcoder 或者 workbuddy 能不能实时抓取或者按一段时间抓取能展示列表模型的积分消耗倍率,这样不用打开软件查看,能选择到便宜的模型) — magpie read each model's price only to tell free from not: Qoder's price_factor (06584e15) and WorkBuddy's "credits" ("x0.03", wbFreeCredits), so the lists said FREE or nothing, and picking a cheap model meant opening Qoder or WorkBuddy. catalog.Model now keeps the price, Rate (the credits a request costs, as a multiple; 0 is not listed, or Free) and RateWas (the price before a discount running now), and carries both through provider.Entry, agent.Option and the providers page's models. Qoder (and Qoder CN): Rate is the price_factor; RateWas an active promotion's before_promotion_price_factor, else an original_price_factor above the price (Qwen3.8-Flash: free, 0.1× struck through), and a promotion's 0 that isn't free is its price before times its discount_factor. WorkBuddy and WorkBuddy AI (the CodeBuddy plan; both builds read the same /v3/config): Rate is the credits (wbCredits; x0.00 stays FREE, an unreadable or infinite rate is none). A plugin's model gives it as it gives free: rate and rateWas on the model its provider.models hook lists, a number (0.5) or as the vendor writes it ("x0.03", "0.5×"), which host.js reads (rateOf) into plugin.Model.Rate/RateWas and pluginCatalog keeps; the moved Qoder and WorkBuddy users get it once their plugins send it. The badge is small and grey (the context badge's colours, no uppercase), beside FREE where that shows, its title saying what a request costs (每次请求消耗 0.5× 积分;折扣前 / 限时免费,原价). Rates are as of the provider's last list: a built-in's is fetched at start-up when it has none, on Refresh and when its key changes, a plugin's when its plugins are asked again (start-up, a sign-in, a plugin change); nothing asks on a timer. Kiro, Cursor, ZCode and Devin list no per-model rate magpie reads, so they show none. TestParseModelsRate (qoder) and TestWBCreditsRate (provider) are new and don't build without the change; TestFakePlugin now checks a plugin's rate given as a number and as "x0.03" (0 for both with host.js not reading them). model-rate.test.cjs (WebKit, en and zh: the chips' badges and titles, struck-through prices, grey not green, no stripe, a click picks and scrolls nothing, the picker's badges) fails without the change and passes with it; click-scroll, models-free-only, model-pick and favorite-star pass in WebKit. No request was made to Qoder, WorkBuddy or any vendor. go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui -count=1 ./... under a temp HOME, go test ./internal/gui pass. 2026-10-02 22:48:45 +08:00
yetone 47741ee31f remote magpie: another computer makes videos with the video models a shared magpie has, as it draws with its image models (#545: 图像生成能否也提供给局域网中其他终端) — drawing from another computer already worked both ways, a plain client with the gateway's key at its /v1/images/generations and a magpie with it as a Remote magpie (since v0.1.555), but a Remote magpie's videos did not: its list never gave them, and /v1/videos turned away any provider but a Grok subscription. A magpie now asks its Remote magpie's list for them too (X-Magpie-Videomakers), the other lists them marked kind:video (a magpie that doesn't ask isn't given them, as it would take grok-imagine-video for an image model), and they are kept apart from the models to chat or draw with (catalog.Model.Films). A video with one is started at the other's /v1/videos, its id there carried, base64, in this magpie's video id, and asked after and fetched at its /v1/videos/{id} and /content. TestRemoteMagpieVideos fails without the change (no video models listed); TestLANDraws covers images from another computer both ways through lanGuard with a caller key. go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui of gateway, provider, catalog and imagemcp pass. 2026-10-02 17:32:08 +08:00
yetone 65f3a6417a settings: portable mode — a data folder beside magpie keeps everything magpie keeps (#508, suixinex) — like VS Code's portable mode, a folder named "data" (or a file named ".portable", the data folder then made beside it) next to magpie makes it keep all its own files there instead of the user's profile. Where magpie keeps its files is now decided in one place, internal/appdir: Config() (~/.config/magpie, $XDG_CONFIG_HOME/magpie; portable: data/), Cache() (~/.cache/magpie, $XDG_CACHE_HOME/magpie; portable: data/cache) and SystemCache() (the OS's cache folder, which the library's market lists and an update staged where magpie may not write used; portable: data/cache). settings.Dir()/Path(), provider.Path(), profile.Path(), the models.dev catalog, the exchange rate and the plugin market cache go through it, and everything built on them follows: providers, logins and saved accounts' folders, usage ledger, routing history and request archive, plugins, library, backups, sync state and lock, caller keys, redact key, stats. "Beside magpie" is the folder holding the executable with links followed; for a Mac app the folder holding Magpie.app (inside the bundle would break its signature), and for an AppImage the folder holding the .AppImage, not where it is mounted. The decision is made once, at start: an update moves the running copy aside (into .magpie-update on a Mac, to magpie.exe.old on Windows) and its files must not move with it; the updated copy replaces the executable or bundle only, so the data folder beside it is left alone. A portable magpie doesn't copy an old dial install's folders in. Not moved, as they aren't magpie's own: the agents' configs (~/.claude, ~/.codex…), the sign-ins agents keep in the system keychain (a saved Claude account's Claude Code keychain item is named after its folder's path on a Mac, so a portable folder moved elsewhere or to another Mac signs that account in again), autostart and link-handler registrations, and temporary folders. The single-instance id already covers the config folder, so a portable and an installed magpie run side by side, but the gateway port is one. Settings shows the config folder as portable. TestResolve (data folder, .portable, a file named data, a Mac bundle), TestResolveSymlinkedExe, TestResolveAppImage (Linux), TestFolders and TestPortableSettings (Path() lands in the data folder, Save writes there, ~/.config/magpie untouched); TestPortableSettings fails without the change (Path() is ~/.config/magpie/settings.json), TestResolveSymlinkedExe without following links. A nogui build run from a folder with data/ under a sandbox HOME wrote profiles.json, cli-identity.json and cache/models.json into data/ and nothing of magpie's into HOME. go vet ./internal/..., go build -tags nogui ./... (darwin, GOOS=linux), GOOS=windows go build ./..., go test -tags nogui ./... pass. 2026-10-02 13:00:22 +08:00
yetone ee5f974f98 providers: PipeLLM is a built-in preset (the owner: 作为内置 provider 加上吧) — one key for OpenAI's, Anthropic's and Gemini's models at api.pipellm.ai. Chat goes to its converter (/openai/v1), which takes every family, as its own OpenCode and OpenClaw guides set it up; GPT goes to its own Responses API (/v1) and Claude to its own Messages API (the root), each of which serves its family alone. A model list's type_target (openai, anthropic, gemini) now says which APIs a model is served on when the list names no endpoints: openai on Chat and Responses (Responses first for GPT, as on OpenAI's API), anthropic on Messages alone, gemini on Chat alone. Keys at console.pipellm.ai; its icon is the site's favicon; README lists it. Not sponsored. No PipeLLM key was at hand, so no real request was made; TestPipeLLMRoutesByTypeTarget (httptest list) fails without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass. 2026-10-02 10:31:23 +08:00
yetone e001bd883a usage: a model spelled with a dotted version is priced at its maker's, and a model can be priced from any provider (tony on Discord: old sessions' copilot/claude models had no known price) — Copilot and its CLI's sessions name Anthropic's models claude-opus-4.6 and claude-haiku-4.5, models.dev's anthropic entry claude-opus-4-6 and claude-haiku-4-5, and a session's bare model was looked up only by its exact key at its maker, so neither was priced; a gateway call whose provider is gone or lists no price fell to the same miss. A price is now looked for with a dot and a dash taken for the same, after every exact match. gemini-3-pro-preview stays unpriced: Google's entry on models.dev no longer lists it and no price is made up. For it, and any model like it, magpie model price <model> <in>,<out>,<cache read>,<cache write> keeps a price under */<model> that counts from any provider not priced by the user, after <provider>/<model> and <provider>/* and before any list price, and for a session's bare model; --reset takes it away, magpie model prices lists it. TestDottedIDPricedAtItsMakers, TestAnyProviderPrice and TestPriceOfDottedAndAnyProvider fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass. 2026-10-01 17:46:54 +08:00
yetone 9ac96e23cd gateway: a model that thinks with no levels to pick says it thinks on /v1/models (#402) — mimo-v2.6-flash (Xiaomi's, OpenCode Go's, and a group of them) was listed reasoning: false with no levels, though models.dev says it reasons: /v1/models took reasoning to be having levels, and the model thinks with a switch alone. A model now carries whether it thinks — models.dev's reasoning flag for its own vendor, a plugin's, else what most of the providers models.dev lists serving it say, for a vendor's or relay's list that says nothing of it (Xiaomi's API gives ids alone) — and is listed reasoning: true with empty supported_reasoning_levels, told apart from one that doesn't think; levels the user kept down to none leave it thinking. A group thinks when every member does, or when it offers levels. TestModelsReasoningWithoutLevels fails without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass (TestClaudeRunEndsWhenTheClientLeaves and TestUserPath, load flakes, pass alone). 2026-10-01 16:20:10 +08:00
yetone b69fd168c2 remote magpie: its image models reach this magpie, and look-alike models say which provider they are from (Jorben and 莫 on Discord) — another magpie's /v1/models listed chat models only, so its image models were never found here unless their id said "image"; a magpie now asks for them (X-Magpie-Drawers), the other lists them marked kind:image, and they show in Settings → Images and draw through its /v1/images/generations, which asks the model's vendor the way it draws there. Each model also comes with its name and its provider there (magpie_label), so two relays' "Claude Sonnet 5" no longer read the same. An older magpie on either side reads the list as before. TestRemoteMagpieModels fails without the change; TestRemoteMagpieOldList covers an old remote. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass; remote-magpie passes. 2026-10-01 12:05:21 +08:00
yetone ba3c26dec4 providers: a Remote magpie provider uses another computer's shared magpie, each request translated at most once (Jorben on Discord: 远程 magpie / magpie 接力) — a custom provider pointed at another magpie has one API per address and couldn't know which API each model's own provider serves, so a request was translated on both computers (Chat → Messages here, then again there). magpie's /v1/models now tells each model's native_endpoints (the APIs its provider serves it on; none for a routing group) and its image input, and reads them, with max_output_tokens and supported_reasoning_levels, from a list; the new remote-magpie preset takes the other magpie's address however typed (host:port, /v1, /v1/messages) for all three APIs and lists all its models, its user's choice already. Add sheet tile with the address field and a hint to Settings → Share on local network; CLI: magpie provider add remote-magpie <key> url=http://<ip>:3425. Checked with two sandbox magpies over the LAN address with the key check on and a Messages-only fake upstream: Chat, Messages (streamed), count_tokens, Responses, a routing group and Gemini all reached it as /v1/messages, translated once. TestRemoteMagpieNativeAPI, TestFetchMagpieFields and TestRemoteMagpie fail without the change; remote-magpie.test.cjs (Chromium, WebKit, en/zh) added. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass but for TestCursorPluginContext, which fails on main (1ce05f0) as well; click-scroll, old-webkit pass. 2026-10-01 01:35:18 +08:00
yetone 4fc980347c agents: Codex's OpenAI models are its own, not magpie's routing groups read back (group/semantic, group/test … listed under OPENAI in Codex's model picker) — Codex keeps the list it was last handed in models_cache.json, and handed through the gateway it has magpie's models in it too; magpie read the file back as Codex's own models, so its groups (one since removed among them) were listed under OpenAI, and stayed after Codex was routed elsewhere. An entry magpie added (a magpie id — provider/model, group/<id>, codex/<slug> — in a list whose ETag magpie tagged, or described "… via magpie") is left out of Codex's own models and of the entries the gateway falls back to. TestCodexCacheLeavesMagpieOut fails without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass. 2026-09-30 17:19:39 +08:00
yetone 4f01baa65f catalog: fetched again each day magpie stays open, and sooner when a call's model has no price, so a model models.dev lists after magpie started is priced (#224 Koohoko: gpt-6.1-sol shows no cost) — the models.dev catalog, where list prices come from, was fetched only at the app's start (when older than a week), so a magpie left open, or magpie serve, never learned a new model's price. KeepFresh (internal/catalog/fresh.go), run by the app's backend and by magpie serve, looks every hour and fetches when the cache is older than a day; a call whose model has no price asks for a fetch (catalog.Missing, from usage's pricer) when the cache is older than six hours and none was tried in that time, only in a process keeping it fresh, so CLI commands and tests never fetch on their own. Loading and Reset now share a mutex instead of a sync.Once reassigned under a running Do, which a background Sync could hit while a call was being priced. Tested with fresh_test.go against a fake models.dev in a temp XDG_CACHE_HOME: stale after 25h and not before, Missing fetching nothing when not keeping, fetching once when keeping and gpt-6.1-sol then priced, and not again; passes under -race (failed under -race with the Once). go vet, go build -tags nogui (and GOOS=linux, GOOS=windows) and go test -tags nogui ./... pass. 2026-09-30 04:28:01 +08:00
yetone cf6b82f70d usage: a Codex, Copilot or catalog-less relay call is priced at its maker's list price, as a Claude account's is (#224 Koohoko: on the Usage page only Claude models show a cost; gpt-6-astra and gpt-6-luna through Codex's ChatGPT account and gemini-3.8-flash and gpt-6-luna through Copilot show tokens and no cost, and the Codex row reads ≈$153+) — the Usage page and the Requests list price a call by the models.dev ids of the provider it went to (Provider.Catalog), and only the Claude account had one (anthropic): Codex's and Copilot's accounts, like Grok's, WorkBuddy's and a relay added without a catalog, have none, so every call they served was counted unpriced although models.dev lists all these models (openai: gpt-6-astra $10/$50, gpt-6-luna $0.1/$0.5; google: gemini-3.8-flash $0.75/$3.75, per million, in the cached catalog). A call is now priced by its provider's catalogs first, as before, else by the first maker among the vendor presets that lists the model (the same makerCatalogs the reasoning levels borrow from), and a call whose provider has gone since is priced by its maker too. The model is matched by its own key first, then without a path or case (a relay's openai/gpt-6-astra is gpt-6-astra), a Bedrock geography, a (variant) or :tag, as the reasoning levels already are (new catalog.PricedBy, Provider.ListPrice, provider.MakerPrice); a model no maker lists (a Cursor or Kiro alias, a relay's own name) stays unpriced and keeps the + as before, no price is made up. Both the Usage summary and the Requests ledger go through the one pricer, so they agree. Tested with a new TestSubscriptionListPrice: calls to codex (gpt-6-astra, gpt-6-luna), copilot (gemini-3.8-flash, gpt-6-luna), claude (claude-opus-5-5) and a relay with no catalog (openai/gpt-6-astra, mystery-1) each get their maker's price in the ledger and the summary, mystery-1 alone unpriced (fails on main: all seven unpriced); TestLedger and TestSummarize unchanged. go build -tags nogui (and GOOS=linux, GOOS=windows), go test -tags nogui ./... pass (TestAddSecondOfPreset failed once in the full run with a fourth provider and passes on its own and in the package run; it doesn't touch pricing). Not tried against the reporter's usage log or in the GUI; the Sessions page's own pricing (internal/sessions) was not looked at. 2026-09-29 23:52:32 +08:00
yetone 729f6bdbdf models: a model its maker lists with a thinking switch alone takes no borrowed levels, and the gateway sends it no more than high (#214 Moody-Max: opencode 的 mimo-v2.6 Flash 你这边设置的默认推理强度是 max 导致400报错)
A model not under its provider's own models.dev vendor (a relay or provider of the user's, a live id that doesn't match, or a preview/-exp or typed id Known looks up) took the levels most listed for it across all of models.dev. For mimo-v2.6-flash those are the resellers' (llmgateway, counted once per upstream host it lists, and requesty, up to max), while Xiaomi lists it with a thinking switch alone. OpenCode was offered variants up to max, Pi and Codex the same levels, and the gateway passed max on unchanged (fitEffort keeps an effort when no levels are known), which Xiaomi turned away with a 400. The same held for Zhipu's glm-5/5.1/5v-turbo, Kimi k2.6, MiniMax M2.x, gemma-4 and others whose makers give no levels while resellers give up to max.

Now catalog.ListedBy looks a model up in given catalogs (vendor prefix, case, a ':free' or '(…)' suffix aside) and gives the levels listed there, none for a switch or no options, and skips an entry with a token budget alone (Claude 4.5), which says nothing of efforts. Known looks in the provider's own catalogs first, and every borrow (Known, effortsOf) asks the makers' catalogs (vendor presets, less Groq and Ollama Cloud, marked Hosts as they serve others' models) before the crowd. The crowd vote counts a provider once per list, so an aggregator listing a model under several hosts no longer outvotes the rest. Provider.Levelless says a model is known to have no levels, and the gateway (fitFor, on the direct and fallback paths) sends such a model no more than high; a model whose levels are simply unknown is still sent what was asked.

Tests: TestEffortsOfOneVoteAProvider and TestListedBy (catalog); TestMakerLevelsBeforeResellers (provider: Xiaomi's preset, a preview left out of the list and a relay get no levels, an unlisted model and a budget-only Claude one still borrow, Levelless); TestOpenCodeNoResellerLevelsForSwitchModel (opencode.json has empty variants for Xiaomi's and a relay's mimo, three for a reseller-only model; Pi has no reasoning or thinkingLevelMap for mimo); TestSwitchModelSentNoMoreThanHigh (gateway: mimo asked max/xhigh sent high, low as asked, an unknown model max). The agent and gateway tests fail on main. An audit of every preset against the current models.dev snapshot found the cases above. Not tested with a real Xiaomi key or a running OpenCode. go build -tags nogui (and linux, windows), go test -tags nogui ./... pass.
2026-09-29 19:41:29 +08:00
yetone a284b61bb1 providers: an image model's Test models draws one small picture on the images API, as the gateway draws with it (mamba: 图像模型点测试模型是不是发送的请求不对啊,总是提示响应异常) — every model picked was sent a chat completion ("hi", max_tokens 16), so gpt-image, flux, seedream and the like, which a vendor serves only at /images/generations, were turned away and always showed as not answering. Now a model the gateway draws with on an images API (catalog.ImagesAPI, the list viaFor used, shared) is asked there for one picture of "a dot", n=1, at gpt-image's low quality and the vendor's default size, waiting up to two minutes (the request up to three); a 404 or 405 there is tried in chat as the gateway does. Chat models and gemini-*-image / gpt-5-image (which draw in chat) are asked as before, and the vendor-wide Test asks a chat model ahead of one that draws. Tested with a fake vendor that serves images only at /images/generations and chat only at /chat/completions 2026-09-29 14:37:09 +08:00
yetone d287a05161 providers: Amazon Bedrock, with a Bedrock API key (#176: 增加 AWS Bedrock 作为 model provider) — Bedrock's runtime serves Claude on Anthropic's messages at /anthropic/v1/messages and the other models on chat completions at /openai/v1, both taking a Bedrock API key (AWS_BEARER_TOKEN_BEDROCK) with no SigV4, so a vendor preset reaches it: pick one of ten regions and paste the key. Claude ids (anthropic.claude…) go on messages only, the rest on chat only, for the preset and for any provider at a bedrock-runtime host; the runtime has no /models, so the preset's list (Claude as global. inference profiles, plus gpt-oss, Qwen3 Coder, DeepSeek, Kimi, GLM and MiniMax) is it, and a profile kept in one geography (apac., us., eu.…) is typed in by hand and takes its context size from the model it names. The region selector scrolls where its regions don't fit. Tested against a fake Bedrock through the gateway (apac.anthropic.claude-opus-5-5 on /anthropic/v1/messages with x-api-key, gpt-oss on /openai/v1/chat/completions with the Bearer key) and in a sandbox magpie web; not yet against real AWS 2026-09-29 11:29:43 +08:00