TrueNix/dsh-anthropic-oauth ↗★ 0
dsh-anthropic-oauth
将 Claude Code OAuth (Pro/Max/Team) 桥接至 DSH,复用本地凭证并自动刷新 ANTHROPIC_OAUTH_TOKEN。
AI 分析
核心用途是免去硬编码,将现有的 Claude Code 订阅凭证无缝同步至 DSH。适合拥有 Claude 订阅并希望在 DSH 中直接使用该通道的用户。
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:TrueNix/dsh-anthropic-oauth说明文档
阅读完整 README ↗dsh-anthropic-oauth
Bridge your existing Claude Code OAuth session (Pro / Max / Team) into DeepSeek Harness (DSH) — with zero hardcoding.
- Reads
~/.claude/.credentials.jsonclaudeAiOauthlive (same file Claude Code writes) - Auto-refreshes
accessTokenviahttps://platform.claude.com/v1/oauth/tokenwhen dsh-anthropic-oauth Host plugin claudeAiOauth {accessToken, refreshToken, expiresAt} │ refreshIfNeeded() if expiry <5m POST https://platform.claude.com/v1/oauth/token {grant_type: refresh_token, client_id: 9d1c25…f5e} │ ├─► ~/.claude/.credentials.json (updated expiry) └─► ~/.dsh/.credentials.yaml ANTHROPIC_OAUTH_TOKEN: sk-ant-oat01-… CLAUDE_CODE_OAUTH_TOKEN: sk-ant-oat01-…
~/.dsh/settings.yaml llm-pi-ai.providers.anthropic {apiKeyEnv: ANTHROPIC_OAUTH_TOKEN} │ └─► pi-ai anthropicMessagesApi — Authorization: Bearer sk-ant-oat01-… anthropic-beta: claude-code-20250219,oauth-2025-04-20
Verified live: `haiku-4.5` streaming returns `dsh-pi-ai ok` over the same `Bearer` path.
## Set as default model
```yaml
# ~/.dsh/settings.yaml
agent-default-model:
provider: anthropic
model: claude-sonnet-4-5
Or pick per-session in Settings → Models after a reload.
Logs & manual sync
journalctl --user -u dsh-anthropic-oauth-bridge -f # legacy external bridge (pre-plugin)
# plugin logs:
# DSH console: [anthropic-oauth] ...
node ~/Workspace/sync-claude-oauth.mjs # manual one-shot (legacy)
Troubleshooting
MISSING_CREDENTIAL llm-pi-ai: no credential for provider route "anthropic"— bridge hasn't synced yet; runnode ~/Workspace/sync-claude-oauth.mjsor re-login withclaude.state mismatchduring manual paste — you pasted acodefrom a different PKCE verifier.- 401 from Anthropic — token expired and refresh failed;
claude loginagain.
Security
- Never commits tokens —
.gitignoreexcludes*.oat*,*.credentials.*. - Tokens live only in
0600files owned by you:~/.claude/.credentials.jsonand~/.dsh/.credentials.yaml. - A Feb-2026 Anthropic docs note declares Pro/Max OAuth for official clients only — personal use at your own risk; use a console
ANTHROPIC_API_KEYfor production.
License
MIT