Skip to content

feat(ai-providers): GLM + Kimi presets, region-aware endpoints, quieter auth errors#131

Merged
luokerenx4 merged 4 commits intomasterfrom
dev
Apr 19, 2026
Merged

feat(ai-providers): GLM + Kimi presets, region-aware endpoints, quieter auth errors#131
luokerenx4 merged 4 commits intomasterfrom
dev

Conversation

@luokerenx4
Copy link
Copy Markdown
Contributor

Summary

  • Add GLM (Zhipu) and Kimi (Moonshot) as third-party presets alongside MiniMax, all going through the Claude Agent SDK via each vendor's Anthropic-compatible endpoint.
  • Teach presets about regional splits: Chinese LLM vendors all ship two hard-separated platforms (China + International) with independent accounts/keys/billing, so baseUrl is now a labeled dropdown — parallel to how model already works. MiniMax and GLM gain region pickers; Kimi ships with both regions from day one.
  • Quieter auth / model errors: the agent-sdk wrapper now classifies process errors; mistyped API keys or wrong region/model combos get a single console.warn line instead of a full stack trace masquerading as a system crash. Pino still captures full detail for debugging.

Test plan

  • npx tsc --noEmit clean
  • pnpm test — 1069 tests pass
  • Manually select GLM / Kimi / MiniMax from the preset picker, verify both region endpoints render as labeled dropdown options
  • Point a preset at the wrong region and confirm the auth/model classifier suppresses the stack trace
  • Existing user profiles still load (baseUrl schema relaxed from z.literal to z.string, so stored values continue to validate)

🤖 Generated with Claude Code

Ame and others added 4 commits April 19, 2026 14:38
…ndpoint

Mirrors the MiniMax preset — backend=agent-sdk + loginMethod=api-key,
hardcoded baseUrl to https://open.bigmodel.cn/api/anthropic. Ships with
glm-5.1 (default), glm-4.7, glm-4.6 (200K), and glm-4.5-air as model
options. Zhipu officially supports the Anthropic-compatible route for
Claude-Code-style tooling, so agent-sdk is the right backend here.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…nfig

API key / baseUrl mistakes used to dump a full stack trace via
console.error, indistinguishable from a real SDK crash. Added a small
classifyError() helper that regex-matches auth signals (401,
invalid_api_key, unauthorized, etc.) across message/stderr/stdout;
hits become a one-line console.warn, everything else keeps the loud
path. Pino log gains a classification field for future filtering.

Signal preserved, noise cut — real bugs are no longer buried in config
mistakes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
GLM, Kimi, and MiniMax all run two hard-split platforms (China vs
International) with independent accounts, keys, billing, and sometimes
model catalogs. Baking in a single baseUrl per preset made half the
users of each brand reach a non-existent endpoint.

Changes:
- PresetDef gains optional endpoints: EndpointOption[]; presets.ts
  generalizes the model-field label rewrite to cover baseUrl too, so
  a preset declaring endpoints renders a labeled dropdown with the
  same UX as the model picker.
- MiniMax and GLM switch baseUrl from z.literal to z.string() with
  two endpoint options each. GLM default drops from glm-5.1 to glm-4.7
  (the only flagship available on both regions); 5.1 and 4.6 stay
  selectable with "(China only)" label hints.
- New KIMI preset, kimi-k2.5 flagship, China default.
- Error classifier picks up a 'model' class alongside 'auth'; wrong
  region/model combos get a one-line console.warn instead of the loud
  console.error + stack.

Existing user profiles are unaffected — schema relaxed from literal to
string, so stored values still validate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…hing OpenAI-compat

Moonshot's quickstart leads with OpenAI Chat Completions, but our codex
backend talks the Responses API, which Moonshot doesn't implement.
Anthropic-compat at api.moonshot.*/anthropic is Moonshot's officially
supported secondary path, so we route Kimi through agent-sdk there.

Comment exists to spare the next reader from re-deriving why an OpenAI-
compat vendor sits under agent-sdk in this catalog.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@luokerenx4 luokerenx4 merged commit 0093075 into master Apr 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant