New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

opencode-codebuddy-internal-auth

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opencode-codebuddy-internal-auth

OpenCode plugin for CodeBuddy Internal (Claude Code Internal) OAuth authentication

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

OpenCode CodeBuddy Internal Auth Plugin

为 OpenCode 提供 CodeBuddy Internal (Claude Code Internal) 的 OAuth 认证支持。

功能

  • Device Code Flow 认证: 自动完成工蜂 OAuth 认证
  • Token 自动刷新: 无需手动管理 Token
  • 完整 Headers 注入: 自动添加所有必需的请求头

安装方式

方式一:本地插件(推荐开发测试)

将整个 opencode-codebuddy-internal-auth 目录复制到:

# 项目级插件
cp -r opencode-codebuddy-internal-auth /path/to/your/project/.opencode/plugins/

# 或全局插件
cp -r opencode-codebuddy-internal-auth ~/.config/opencode/plugins/

方式二:npm 包(推荐生产使用)

  • 发布到 npm:
cd opencode-codebuddy-internal-auth
npm publish
  • opencode.json 中配置:
{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-codebuddy-internal-auth"]
}

配置 Provider

opencode.json 中添加 provider 配置:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-codebuddy-internal-auth"],
  "provider": {
    "codebuddy-internal": {
      "npm": "@ai-sdk/anthropic",
      "name": "CodeBuddy Internal",
      "models": {
        "claude-sonnet-4.5": {
          "name": "Claude Sonnet 4.5",
          "contextLength": 200000
        },
        "claude-opus-4.5": {
          "name": "Claude Opus 4.5",
          "contextLength": 200000
        },
        "glm-4.7": {
          "name": "GLM-4.7 (Haiku)",
          "contextLength": 128000
        }
      }
    }
  },
  "model": {
    "default": "codebuddy-internal/claude-sonnet-4.5"
  }
}

使用流程

  • 启动 OpenCode
  • 选择 codebuddy-internal provider
  • 系统会提示进行认证
  • 选择 "工蜂 OAuth (Device Code)" 方式
  • 浏览器会打开授权页面,输入显示的 user_code
  • 授权完成后自动获取 Token

可用模型

模型 ID名称说明
claude-sonnet-4.5Claude Sonnet 4.5非敏感仓库可用,有额度限制
claude-opus-4.5Claude Opus 4.5非敏感仓库可用,额度消耗更快
glm-4.7GLM-4.7 / DeepSeek无限制

注意: API Key 模式只能使用 GLM-4.7,要使用 Claude 模型必须通过 OAuth 认证!

技术细节

认证端点

用途端点
Device Code 请求https://copilot.code.woa.com/api/v2/auth/device/code
Device Token 轮询https://copilot.code.woa.com/api/v2/auth/device/token
Token 刷新https://copilot.code.woa.com/api/v2/auth/oauth_token/refresh
Gatewayhttps://copilot.code.woa.com/server/chat/codebuddy-gateway/codebuddy-code

请求 Headers

插件会自动注入以下 Headers:

x-api-key: {accessToken}
x-conversation-id: {uuid}
x-app-version: 1.0.2
x-app-name: codebuddy-code
x-request-platform: CodeBuddy-Code
x-scene-name: common_chat
user-agent: Claude-Code-Internal/1.0.2
x-request-platform-v2: Claude-Code-Internal
x-app-name-v2: claude-code-internal
x-claude-code-internal: true
x-channel: claude-code-internal

开发

# 安装依赖
bun install

# 类型检查
bun run typecheck

License

MIT

Keywords

opencode

FAQs

Package last updated on 24 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts