Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

opencode-quota

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opencode-quota

OpenCode plugin to display subscription quotas for ChatGPT Codex, Google Antigravity, and z.ai

next
Source
npmnpm
Version
0.0.3-dev
Version published
Weekly downloads
112
-2.61%
Maintainers
1
Weekly downloads
 
Created
Source

opencode-quota

OpenCode plugin that fetches subscription quotas for ChatGPT Codex, Google Antigravity, and z.ai.

Features

  • /quotas command for all providers
  • /quotas <provider> for a single provider
  • Returns markdown summaries plus raw JSON
  • Reads tokens from OpenCode and auth plugins

Installation in OpenCode

Create or edit ~/.config/opencode/opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-quota"]
}

For local development, use a relative path:

{
  "plugin": ["./path/to/opencode-quota"]
}

Provider Setup

ChatGPT Codex

  • Install the opencode-openai-codex-auth plugin, or ensure openai auth exists in ~/.local/share/opencode/auth.json.
  • The plugin also checks ~/.opencode/auth/openai.json as a fallback.

Google Antigravity

  • Install an Antigravity auth plugin (for example, opencode-antigravity-auth).
  • Ensure accounts are stored in ~/.config/opencode/antigravity-accounts.json.
  • The first configured account is used for quota checks.

z.ai

  • Add a zai or z.ai entry in ~/.local/share/opencode/auth.json with the API key, or set ZAI_API_KEY.

Usage

/quotas
/quotas codex
/quotas antigravity
/quotas zai

Output

  • markdown: human-readable summary
  • json: provider-specific quota data

Development

bun install
mise run build
bun test
mise run lint

Testing

Tests use vitest with a provider-specific auth configuration system.

Run all tests (mocks only, default):

bun test

Run tests with real auth:

# Edit .env.test and set desired provider(s) to 1
REAL_CODEX_AUTH=1
REAL_ANTIGRAVITY_AUTH=1
REAL_ZAI_AUTH=1
bun test

Run specific provider tests:

bun test src/providers/codex.test.ts
bun test src/providers/antigravity.test.ts
bun test src/providers/zai.test.ts

Test structure:

  • src/test-helpers.ts - Shared test utilities and fixtures
  • src/providers/*.test.ts - Provider-specific tests with mocks and real auth
  • .env.test - Auth configuration flags (committed to repo)
  • vitest.config.ts - Test configuration

Tests are organized into two categories per provider:

  • Mock tests - Run by default, test all edge cases and error handling
  • Real auth tests - Skipped by default, enabled via .env.test flags

Adding new providers:

  • Implement provider function in src/providers/
  • Add REAL_NEWPROVIDER_AUTH=0 to .env.test
  • Create src/providers/newprovider.test.ts following existing patterns
  • Add helpers to src/test-helpers.ts if needed

Author

Nelson Pires nelsonpires.sn@gmail.com

Repository

https://github.com/nelsonPires5/opencode-quota

License

MIT License. See the LICENSE file for details.

Keywords

opencode

FAQs

Package last updated on 14 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