@bergetai/opencode-auth
v1.1.1
Published
Berget AI auth plugin for OpenCode - authenticate with your Berget account
Readme
Berget Auth Plugin for OpenCode
Authenticate OpenCode with your Berget AI account.
Quick Start
The recommended way to get started is with the Berget CLI:
npm install -g berget
berget code init
opencode
# Type /connect → choose your auth methodAuthentication Methods
Berget Code Seat — Magic link
For team members with a Berget Code seat, on machines with a browser:
- Run
/connectin OpenCode - Select "Berget Code Seat - Login using this device"
- The login page opens in your browser — token refresh is automatic
Berget Code Seat — QR or device code
For headless environments (SSH, CI, containers) where the browser cannot open on the same machine:
- Run
/connectin OpenCode - Select "Berget Code Seat - QR or device code"
- Scan the QR code with your phone, or open the link shown in the dialog — the sign-in code is already included in it
- Approve the sign-in on the other device; OpenCode continues automatically
The sign-in is valid for 10 minutes. If it times out, just run /connect again.
API Key
For API key users:
- Run
/connectin OpenCode - Select "Berget API Key - Enter API key manually"
- Paste your key — persisted across sessions
How It Works
- PKCE Authorization Flow for browser login (magic link)
- Device Authorization Grant (RFC 8628) for QR / device code login on headless machines
- Automatic token refresh via custom fetch — sessions stay alive indefinitely
- Models fetched dynamically from Berget API — no manual config needed
License
MIT
