Skip to content

Feat/claude usage extraction#380

Merged
chenhg5 merged 1 commit intochenhg5:mainfrom
cnrpman:feat/claude-usage-pty
Apr 2, 2026
Merged

Feat/claude usage extraction#380
chenhg5 merged 1 commit intochenhg5:mainfrom
cnrpman:feat/claude-usage-pty

Conversation

@cnrpman
Copy link
Copy Markdown
Contributor

@cnrpman cnrpman commented Mar 30, 2026

Implement /usage support for agent/claudecode using only the public Claude CLI over PTY.

This change makes cc-connect's existing core /usage command work for Claude Code in headless/server environments without relying on OAuth, browser cookies, web APIs, or undocumented endpoints.

Why

Claude Code does not expose a supported public usage API for this use case. The Claude CLI TUI is the only allowed integration surface here, so /usage is implemented by driving the CLI through PTY and parsing
the rendered terminal output.

@cnrpman cnrpman force-pushed the feat/claude-usage-pty branch 3 times, most recently from ff897a0 to a54eeff Compare March 30, 2026 18:21
@cnrpman cnrpman force-pushed the feat/claude-usage-pty branch from a54eeff to 8cba8db Compare March 31, 2026 03:33
@cnrpman cnrpman marked this pull request as ready for review March 31, 2026 10:04
Copy link
Copy Markdown
Owner

@chenhg5 chenhg5 left a comment

Choose a reason for hiding this comment

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

LGTM. Creative solution for usage extraction.

Review summary:

  • ✅ Uses only public Claude CLI via PTY (no undocumented APIs)
  • ✅ Parses terminal output for usage data
  • ✅ Implements core /usage command for Claude Code
  • ✅ CI passes

Good implementation working within allowed integration surfaces.

@chenhg5 chenhg5 merged commit 1f84997 into chenhg5:main Apr 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants