Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

gui: Kimi Code's region picker says to pick by the account's region (Kimi)

yetoned1436466a6ef
diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js
index ed630fd7e..8fff727dc 100644
--- a/internal/gui/assets/app.js
+++ b/internal/gui/assets/app.js
@@ -9642,8 +9642,7 @@ function drawEditor(p, presetID) {
// are served at their own: one selector, and the provider's base URLs follow it
let refreshEndpoints = () => {}, onRegion = () => {};
if (pr?.regions?.length) {
- // Bedrock's ten regions (Mantle's seventeen) don't fit the editor's
- // width: they scroll
+ // Bedrock's ten regions don't fit the width: they scroll
const seg = el("div", "segs regions");
const cur = regionAt(pr, draft) || pr.regions.find((r) => r.decide && (r.id === draft.region || (!draft.region && workspaceOf(r.decide, draft.decide ?? p?.decide ?? pr.decide) !== null))) || pr.regions[0];
for (const r of pr.regions) {
@@ -9671,7 +9670,7 @@ function drawEditor(p, presetID) {
const on = seg.querySelector(":scope > .on");
if (on && seg.scrollWidth > seg.clientWidth) seg.scrollLeft = on.offsetLeft - (seg.clientWidth - on.offsetWidth) / 2;
});
- ed.append(...field(t(pr.regionLabel || "Region"), seg, t("which endpoint {p} is reached through", { p: pr.name })));
+ ed.append(...field(t(pr.regionLabel || "Region"), seg, t(pr.splitAccounts ? "pick the region of your {p} account" : "which endpoint {p} is reached through", { p: pr.name })));
}
if (p) ed.append(...field(t("Models"), renderModels(p), ""));
diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js
index edf4cf991..5ecae7d4b 100644
--- a/internal/gui/assets/i18n.js
+++ b/internal/gui/assets/i18n.js
@@ -2555,6 +2555,7 @@ const I18N = {
"Plan · Singapore": "套餐 · 新加坡",
"Plan · Europe": "套餐 · 欧洲",
"which endpoint {p} is reached through": "通过哪个入口访问 {p}",
+ "pick the region of your {p} account": "按你的 {p} 账号所在区域选择",
"{what} copied": "已复制{what}",
"Couldn't copy. Select it here and copy it yourself: {text}": "复制失败,请在这里选中后自行复制:{text}",
"Connect": "接入",
@@ -6573,6 +6574,7 @@ const I18N = {
"Plan · Singapore": "套餐 · 新加坡",
"Plan · Europe": "套餐 · 歐洲",
"which endpoint {p} is reached through": "透過哪個入口存取 {p}",
+ "pick the region of your {p} account": "依你的 {p} 帳號所在區域選擇",
"{what} copied": "已複製{what}",
"Couldn't copy. Select it here and copy it yourself: {text}": "複製失敗,請在這裡選取後自行複製:{text}",
"Connect": "接入",
@@ -10589,6 +10591,7 @@ const I18N = {
"Plan · Singapore": "プラン · シンガポール",
"Plan · Europe": "プラン · ヨーロッパ",
"which endpoint {p} is reached through": "{p} に接続するエンドポイント",
+ "pick the region of your {p} account": "{p} アカウントのリージョンを選んでください",
"{what} copied": "{what}をコピーしました",
"Couldn't copy. Select it here and copy it yourself: {text}": "コピーできませんでした。ここで選択してコピーしてください:{text}",
"Connect": "接続",
@@ -14615,6 +14618,7 @@ const I18N = {
"Plan · Singapore": "Tarif · Singapur",
"Plan · Europe": "Tarif · Europa",
"which endpoint {p} is reached through": "über welchen Endpunkt {p} erreicht wird",
+ "pick the region of your {p} account": "die Region deines {p}-Kontos wählen",
"{what} copied": "{what} kopiert",
"Couldn't copy. Select it here and copy it yourself: {text}": "Kopieren fehlgeschlagen. Hier markieren und selbst kopieren: {text}",
"Connect": "Verbinden",
diff --git a/internal/gui/tests/partners.test.cjs b/internal/gui/tests/partners.test.cjs
index 6bc4784bf..b80cdc96c 100644
--- a/internal/gui/tests/partners.test.cjs
+++ b/internal/gui/tests/partners.test.cjs
@@ -24,7 +24,7 @@ const partners = [
regions: [
{ id: "cn", name: "China", chat: "https://api.acme.example.com/v1", website: "https://usemagpie.ai/go/acme/site/cn", siteHost: "cn.acme.example" },
{ id: "global", name: "Global", chat: "https://global.acme.example.com/v1", website: "https://usemagpie.ai/go/acme/site/global", siteHost: "global.acme.example" },
- ] }),
+ ], splitAccounts: true }),
partner("zhonly", "China Only", { langs: ["zh"], notes: { en: "Mainland relay", zh: "国内中转" } }),
partner("taken", "Taken", { added: true }),
];
@@ -55,10 +55,10 @@ function server(lang, list, counted) {
}
const L = {
- en: { head: ["Partners", "magpie's sponsors"], subs: "Subscriptions", rows: ["Acme AI", "Taken"], note: "Fast relay" },
- zh: { head: ["合作伙伴", "赞助 magpie 的服务"], subs: "订阅", rows: ["Acme AI", "China Only", "Taken"], note: "快速中转" },
- ja: { head: ["パートナー", "magpie のスポンサー"], subs: null, rows: ["Acme AI", "Taken"], note: "高速な中継" },
- de: { head: ["Partner", "Sponsoren von magpie"], subs: null, rows: ["Acme AI", "Taken"], note: "Fast relay" },
+ en: { head: ["Partners", "magpie's sponsors"], subs: "Subscriptions", rows: ["Acme AI", "Taken"], note: "Fast relay", region: "pick the region of your Acme AI account" },
+ zh: { head: ["合作伙伴", "赞助 magpie 的服务"], subs: "订阅", rows: ["Acme AI", "China Only", "Taken"], note: "快速中转", region: "按你的 Acme AI 账号所在区域选择" },
+ ja: { head: ["パートナー", "magpie のスポンサー"], subs: null, rows: ["Acme AI", "Taken"], note: "高速な中継", region: "Acme AI アカウントのリージョンを選んでください" },
+ de: { head: ["Partner", "Sponsoren von magpie"], subs: null, rows: ["Acme AI", "Taken"], note: "Fast relay", region: "die Region deines Acme AI-Kontos wählen" },
};
async function openSheet(page) {
@@ -121,6 +121,9 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// following the region picked
const site = page.locator("#modal .editor .ehead .link.site");
assert.equal(await site.textContent(), "cn.acme.example ↗");
+ // China's and Global's accounts don't cross (provider.SplitAccounts):
+ // the picker says to pick by the account
+ assert.equal(await page.locator("#modal .editor .segs.regions").locator("xpath=following-sibling::div[contains(@class,'hint')]").textContent(), w.region);
await page.locator("#modal .editor .segs.regions .opt").nth(1).click();
assert.equal(await site.textContent(), "global.acme.example ↗");
assert.equal(await site.getAttribute("data-url"), "https://usemagpie.ai/go/acme/site/global");
diff --git a/internal/provider/partners.go b/internal/provider/partners.go
index 163e8a1f6..0d428e1d3 100644
--- a/internal/provider/partners.go
+++ b/internal/provider/partners.go
@@ -387,6 +387,8 @@ func validPartners(in []Partner) []Partner {
for i := range p.Regions {
p.Regions[i].Decide = ""
}
+ p.SplitAccounts = slices.ContainsFunc(p.Regions, func(r Region) bool { return placeOf(r) == "china" }) &&
+ slices.ContainsFunc(p.Regions, func(r Region) bool { return placeOf(r) == "global" })
if p.Chat == "" && p.Responses == "" && p.Anthropic == "" {
// the first region is the default, as a built-in preset's is,
// unless it is China's or Global's and the user is in the
diff --git a/internal/provider/partners_region_test.go b/internal/provider/partners_region_test.go
index 7d61777c0..c638312db 100644
--- a/internal/provider/partners_region_test.go
+++ b/internal/provider/partners_region_test.go
@@ -77,6 +77,14 @@ func TestPartnerStartsAtTheUsersRegion(t *testing.T) {
if p, _ := FromPreset("apikeyfan"); p.Chat != "https://api.apikey.fan/v1" {
t.Errorf("APIKEY.FAN (%d) starts at %q", where, p.Chat)
}
+ // Kimi's China and Global accounts don't cross, so its picker
+ // says to pick by the account (Kimi, 10-27: "并在编辑器加一句「按你
+ // 的 Kimi 账号所在区域选择」"); no other partner's regions are both
+ for _, pr := range Partners() {
+ if pr.SplitAccounts != (pr.ID == "kimi") {
+ t.Errorf("%s (%d): SplitAccounts %v", pr.ID, where, pr.SplitAccounts)
+ }
+ }
}
}
diff --git a/internal/provider/presets.go b/internal/provider/presets.go
index 06b811700..d38af3c6d 100644
--- a/internal/provider/presets.go
+++ b/internal/provider/presets.go
@@ -41,6 +41,10 @@ type PresetDef struct {
Regions []Region `json:"regions,omitempty"` // base-URL choices (a relay's regional endpoints, a vendor's plans)
// RegionLabel names what the Regions choose between, "Region" if unset.
RegionLabel string `json:"regionLabel,omitempty"`
+ // SplitAccounts is set on a partner whose regions are China's and
+ // Global's, whose accounts don't work at each other's endpoints (Kimi
+ // Code): its region picker says to pick by the account.
+ SplitAccounts bool `json:"splitAccounts,omitempty"`
// KeyPlans: each key may be on a Region of its own (KeyAccount.Plan),
// a vendor whose plans and pay as you go are sold on keys of their own
// that only their own endpoints take (Volcengine's Coding and Agent