Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 44 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ An [OpenCode](https://opencode.ai) plugin to query account quota usage for multi
| Z.ai | Coding Plan | `~/.local/share/opencode/auth.json` |
| GitHub Copilot | Individual / Business | `~/.local/share/opencode/auth.json` |
| Google Cloud | Antigravity | `~/.config/opencode/antigravity-accounts.json` |
| Claude | Subscription (Pro/Max) or Organization | `~/.local/share/opencode/auth.json` (OAuth) or `ANTHROPIC_ADMIN_KEY` |

## Installation

Expand Down Expand Up @@ -146,28 +147,66 @@ G3 Pro 4h 59m ███████████████████
G3 Image 4h 59m ████████████████████ 100%
G3 Flash 4h 59m ████████████████████ 100%
Claude 2d 9h ░░░░░░░░░░░░░░░░░░░░ 0%
```

## Features
## Claude (Anthropic) Account Usage

Account: Claude (Subscription)

5-hour session limit
███████████████████████░░░░░░░ 73% remaining 🟢
Resets in: 3h 45m

7-day weekly limit
████████████████░░░░░░░░░░░░░░ 55% remaining 🟢
Resets in: 4d 12h

## Features
Comment on lines +151 to +163
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README's "Output Example" code block is opened with a triple backtick but never closed before the "## Features" heading, so the rest of the document renders as a code block. Add a closing ``` line after the output example (after the last "Resets in" line) to restore proper markdown formatting.

Copilot uses AI. Check for mistakes.
- Query quota usage across multiple AI platforms in one command
- Visual progress bars showing remaining quota
- Reset time countdown
- Multi-language support (Chinese / English)
- Multiple Google Cloud accounts support
- API key masking for security
- Claude/Anthropic subscription usage tracking (5h session + 7d weekly limits)

## Configuration

No additional configuration required. The plugin automatically reads credentials from:
No additional configuration required for most platforms. The plugin automatically reads credentials from:

- **OpenAI, Zhipu AI, Z.ai & GitHub Copilot**: `~/.local/share/opencode/auth.json`
- **Google Cloud**: `~/.config/opencode/antigravity-accounts.json`
- **Claude (Anthropic)**: `~/.local/share/opencode/auth.json` (OAuth, auto-detected) or `ANTHROPIC_ADMIN_KEY` environment variable

### Google Cloud Setup

To query Google Cloud (Antigravity) account quota, you need to install the [opencode-antigravity-auth](https://github.com/NoeFabris/opencode-antigravity-auth) plugin first to authenticate your Google account.

### Claude (Anthropic) Setup

**For Subscription Users (Pro/Max):** No setup needed! The plugin automatically reads your OAuth tokens from `~/.local/share/opencode/auth.json` (stored by the `opencode-anthropic-auth` plugin). It makes a minimal API call (~$0.001) to read rate limit headers.

**For Organization Users (Admin API):**

If you have an organization account, you can use an **Admin API key** from the [Anthropic Console](https://console.anthropic.com/settings/admin-keys).

> **Note:** The Admin API is only available for organization accounts.

**Option 1: Environment Variable (recommended)**

```bash
export ANTHROPIC_ADMIN_KEY="sk-ant-admin-..."
```

**Option 2: Config File**

Create `~/.config/opencode/claude-admin-key.json`:

```json
{
"adminKey": "sk-ant-admin-..."
}
```

## Security

This plugin is safe to use:
Expand All @@ -185,6 +224,8 @@ This plugin is safe to use:
- `https://api.github.com/copilot_internal/user` - GitHub Copilot official API
- `https://oauth2.googleapis.com/token` - Google official OAuth API
- `https://cloudcode-pa.googleapis.com/v1internal:fetchAvailableModels` - Google Cloud official API
- `https://api.anthropic.com/v1/messages` - Anthropic Messages API (minimal probe for rate limit headers)
- `https://console.anthropic.com/v1/oauth/token` - Anthropic OAuth token refresh

**Privacy:**

Expand Down
45 changes: 44 additions & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
| Z.ai | Coding Plan | `~/.local/share/opencode/auth.json` |
| GitHub Copilot | Individual / Business | `~/.local/share/opencode/auth.json` |
| Google Cloud | Antigravity | `~/.config/opencode/antigravity-accounts.json` |
| Claude | 订阅 (Pro/Max) 或 组织账号 | `~/.local/share/opencode/auth.json` (OAuth) 或 `ANTHROPIC_ADMIN_KEY` |

## 安装

Expand Down Expand Up @@ -146,6 +147,18 @@ G3 Pro 4h 59m ███████████████████
G3 Image 4h 59m ████████████████████ 100%
G3 Flash 4h 59m ████████████████████ 100%
Claude 2d 9h ░░░░░░░░░░░░░░░░░░░░ 0%

## Claude (Anthropic) 账号用量

Account: Claude (订阅)

5 小时会话限额
███████████████████████░░░░░░░ 剩余 73% 🟢
重置: 3小时45分钟后

7 天周限额
████████████████░░░░░░░░░░░░░░ 剩余 55% 🟢
重置: 4天1小时后
```

## 功能特性
Expand All @@ -156,18 +169,46 @@ Claude 2d 9h ░░░░░░░░░░░░░░░░░░░
- 多语言支持(中文 / 英文)
- 支持多个 Google Cloud 账号
- API Key 脱敏显示,保护安全
- Claude/Anthropic 订阅用量跟踪(5小时会话 + 7天周限额)

## 配置

无需额外配置。插件自动从以下位置读取认证信息:
大多数平台无需额外配置。插件自动从以下位置读取认证信息:

- **OpenAI、智谱 AI、Z.ai 和 GitHub Copilot**: `~/.local/share/opencode/auth.json`
- **Google Cloud**: `~/.config/opencode/antigravity-accounts.json`
- **Claude (Anthropic)**: `~/.local/share/opencode/auth.json` (OAuth,自动检测) 或 `ANTHROPIC_ADMIN_KEY` 环境变量

### Google Cloud 设置

如需查询 Google Cloud (Antigravity) 账号额度,需要先安装 [opencode-antigravity-auth](https://github.com/NoeFabris/opencode-antigravity-auth) 插件来完成 Google 账号认证。

### Claude (Anthropic) 设置

**订阅用户 (Pro/Max):** 无需配置!插件会自动从 `~/.local/share/opencode/auth.json` 读取 OAuth 令牌(由 `opencode-anthropic-auth` 插件存储)。插件通过一个最小化 API 调用 (~$0.001) 读取速率限制头。

**组织用户 (Admin API):**

如果您拥有组织账号,可以使用从 [Anthropic 控制台](https://console.anthropic.com/settings/admin-keys) 获取的 **Admin API Key**。

> **注意:** Admin API 仅适用于组织账号。

**方式一:环境变量(推荐)**

```bash
export ANTHROPIC_ADMIN_KEY="sk-ant-admin-..."
```

**方式二:配置文件**

创建 `~/.config/opencode/claude-admin-key.json`:

```json
{
"adminKey": "sk-ant-admin-..."
}
```

## 安全性

本插件可以安全放心使用:
Expand All @@ -185,6 +226,8 @@ Claude 2d 9h ░░░░░░░░░░░░░░░░░░░
- `https://api.github.com/copilot_internal/user` - GitHub Copilot 官方 API
- `https://oauth2.googleapis.com/token` - Google 官方 OAuth 接口
- `https://cloudcode-pa.googleapis.com/v1internal:fetchAvailableModels` - Google Cloud 官方接口
- `https://api.anthropic.com/v1/messages` - Anthropic 官方 Messages API(最小化探测,读取速率限制头)
- `https://console.anthropic.com/v1/oauth/token` - Anthropic OAuth 令牌刷新

**隐私保护:**

Expand Down
Loading
Loading