Introduction

For DeepSeek Harness (DSH) users who use Codex as a subagent, pay attention to ChatGPT Plus rolling quotas (5h/7d/month). This is a DSH host plugin that exposes Codex quotas and DeepSeek balances under the same JSON via an aggregate API, making unified monitoring easier.

Core Features

  • Reads Codex subscription quotas (5h/7d/month)
  • Queries DeepSeek account balance
  • Provides a loopback-only aggregate endpoint: GET /api/dsh-usage/overview
  • Manages DeepSeek API keys through the DSH credential service

Installation

Requires DSH >= 0.1.1-rc.x and Node >= 22. The installation command is:

dsh plugin --profile web add dsh-codex-usage

After installation, dsh web automatically registers the plugin through cordis.patch.yml. The plugin dependency @openai/codex@0.147.0 is installed automatically by npm. Before use, ensure that Codex is logged in (run codex login status to check).

API Description

The plugin provides a loopback-only aggregate endpoint: GET /api/dsh-usage/overview.

Query Parameters:
- None: uses the 5-minute in-memory cache
- ?refresh=1: bypasses the cache and refreshes data

Response Structure:
- ok: whether the request succeeded
- updatedAt: data update timestamp
- codex: Codex quota information
- configured: whether Codex is configured correctly
- windows: rolling window array containing label (5h/7d/month), usedPercent (percentage used), resetIn (reset countdown), and resetsAt (reset timestamp)
- error: error message
- deepseek: DeepSeek balance information
- balance: contains currency (currency), total (total balance), granted (credits), and toppedUp (top-up)
- links: links to official usage pages

Configuration

You can add a config parameter in cordis.patch.yml to adjust behavior:

- insert:
    - id: codex-usage
      name: dsh-codex-usage
      config:
        apiKeyRef: DEEPSEEK_API_KEY        # 余额接口 API Key ref
        codexUsageUrl: https://codex.app/account/usage     # 官方用量页链接
        deepseekUsageUrl: https://platform.deepseek.com/usage
        refreshMs: 300000                  # 缓存 TTL (默认 5 分钟)
        timeoutMs: 30000                   # 超时时间 (默认 30s)

Notes

  • Only loopback address requests are accepted (127.x / ::1 / localhost). External requests always return 403.
  • Only GET requests are supported. No request body is accepted, and no state is written.
  • Data is cached for 5 minutes by default (refreshMs: 300000).
  • Codex must be logged in; otherwise, codex.configured is false.

Relationship with Codex Subagents

  • Official subagent (@deepseek-ai/dsh-subagent-codex): responsible for delegating tasks to Codex for execution.
  • This plugin: responsible for reading quota data and does not participate in task scheduling.

It is recommended to use them together: first install the official subagent to perform work, then install this plugin to monitor quotas and avoid exhausting the quota.