Skip to content

Sign in to a Z.ai or BigModel account - #124

Merged
fylorn merged 1 commit into
devfrom
feat/zai-login
Sep 23, 2026
Merged

fylorn merged 1 commit into
devfrom
feat/zai-login

Conversation

@fylorn

@fylorn fylorn commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

A new entry in the service-type list, next to the ChatGPT account. The sign-in ends with an ordinary API key on the account, so what it writes is a plain anthropic upstream — everything after the sign-in behaves like any other upstream.

Draft until core is released. It needs the core version that carries ThinkWatchProject/ThinkWatch-Core#112 (merged to main, not tagged yet); tw-api is still pinned to v0.28.0, so CI cannot pass before the pin is bumped.

What it adds

  • ZaiLoginDialog: account service as a segmented control (Z.ai / BigModel), name, outbound proxy, and the notes that have to be read before signing in.
  • src-tauri/src/zai.rs: opens the authorization page and keeps its address out of the webview, the same rule the ChatGPT commands follow.

Two differences from the ChatGPT dialog, both forced by their protocol

  • There is no code-on-another-device path — their platform only offers the browser flow.
  • The browser ends up on their page, not one of ours, so nothing hands focus back to the app and the dialog learns the outcome by polling.

What the dialog says before it will start

  • The authorization page belongs to their own client, because the service does not let third parties register an authorization app.
  • Signing in creates an API key named thinkwatch on the account, or reuses the one already there.

Checked

tsc, 228 unit tests, cargo clippy (against a local build of the unreleased core) all clean. The dialog was driven for real in the isolated preview: switching to BigModel moves the endpoint line to open.bigmodel.cn/api/anthropic, the button stays disabled until the notes are acknowledged, signing in reaches the waiting state and then the finished state. Both languages read correctly.

Against the real service, from an isolated core instance: both families return a real authorization address, and the status and cancel endpoints behave. Their authorization window is 5 minutes, shorter than our 15-minute cap, and core follows theirs.

🤖 Generated with Claude Code

A new entry in the service-type list, next to the ChatGPT account. The
sign-in ends with an ordinary API key on the account, so what it writes is a
plain anthropic upstream — everything after the sign-in is the same as any
other upstream.

Two differences from the ChatGPT dialog, both forced by their protocol:

- There is no code-on-another-device path. Their platform only offers the
  browser flow.
- The browser ends up on their page, not one of ours, so nothing hands the
  app back the focus and the dialog learns the outcome by polling.

The dialog says two things before the sign-in can start: the authorization
page belongs to their own client, because the service does not let third
parties register an authorization app; and signing in creates an API key
named thinkwatch on the account, or reuses the one already there.

Requires the core release that carries ThinkWatchProject/ThinkWatch-Core#112.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@fylorn
fylorn marked this pull request as ready for review September 23, 2026 10:15
@fylorn
fylorn merged commit 7ddd47c into dev Sep 23, 2026
3 checks passed
@fylorn
fylorn deleted the feat/zai-login branch September 23, 2026 10:25
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