Skip to content
Merged
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
4 changes: 4 additions & 0 deletions docs/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ bunx ccusage
pnpm dlx ccusage
```

```bash [claude x]
BUN_BE_BUN=1 claude x ccusage
```

:::

This will show your daily usage report by default.
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ccusage analyzes the local JSONL files that Claude Code automatically generates

### 🚀 Ultra-Small Bundle Size

Unlike other CLI tools, we pay extreme attention to bundle size. ccusage achieves an incredibly small footprint even without minification, which means you can run it directly without installation using `bunx ccusage` for instant access.
Unlike other CLI tools, we pay extreme attention to bundle size. ccusage achieves an incredibly small footprint even without minification, which means you can run it directly without installation using `bunx ccusage` or `BUN_BE_BUN=1 claude x ccusage` for instant access.

### 📊 Multiple Report Types

Expand Down
31 changes: 31 additions & 0 deletions docs/guide/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ pnpm dlx ccusage
deno run -E -R=$HOME/.claude/projects/ -S=homedir -N='raw.githubusercontent.com:443' npm:ccusage@latest
```

```bash [claude x]
BUN_BE_BUN=1 claude x ccusage
```

:::

::: tip Speed Recommendation
Expand All @@ -43,6 +47,33 @@ We strongly recommend using `bunx` instead of `npx` due to the massive speed dif
Consider using `deno run` if you want additional security controls. Deno allows you to specify exact permissions, making it safer to run tools you haven't audited.
:::

::: details Running with `claude x`

If you have the **native version** of Claude Code installed, you can run ccusage directly using the `claude x` command:

```bash
BUN_BE_BUN=1 claude x ccusage
```

**How it works:**

The native Claude Code binary is built with [Bun's standalone executable](https://bun.sh/docs/bundler/executables) feature. When you set `BUN_BE_BUN=1`, the Claude Code executable exposes the full Bun CLI capabilities instead of running its bundled entry point. This allows you to use `claude x` as a drop-in replacement for `bunx`.

**Requirements:**

- **Native Claude Code installation** (installed via `curl -fsSL https://claude.ai/install.sh | bash` or Homebrew/WinGet)
- This does **NOT** work with the npm version (`npm install -g @anthropic-ai/claude-code`)
- Run `claude doctor` to verify whether you have the native version installed

**Why use this?**

- No need to install Bun separately
- Uses the same Bun runtime bundled with Claude Code
- Convenient for Claude Code users who want to check their usage without additional tools

For more details, see the [Bun documentation on BUN_BE_BUN](https://bun.sh/docs/bundler/executables#act-as-the-bun-cli) and [Claude Code setup guide](https://code.claude.com/docs/en/setup).
:::

### Performance Comparison

Here's why runtime choice matters:
Expand Down
23 changes: 19 additions & 4 deletions docs/guide/opencode/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,30 @@ The `@ccusage/opencode` package reuses ccusage's responsive tables, pricing cach

## Installation & Launch

```bash
# Recommended - always include @latest
npx @ccusage/opencode@latest --help
::: code-group

```bash [bunx (Recommended)]
bunx @ccusage/opencode@latest --help
```

```bash [npx]
npx @ccusage/opencode@latest --help
```

# Alternative package runners
```bash [pnpm]
pnpm dlx @ccusage/opencode --help
```

```bash [opencode x]
BUN_BE_BUN=1 opencode x @ccusage/opencode@latest --help
```

:::

::: tip opencode x option
The `opencode x` option requires the native version of OpenCode. If you installed OpenCode via npm, use the `bunx` or `npx` options instead.
:::

### Recommended: Shell Alias

```bash
Expand Down
34 changes: 31 additions & 3 deletions docs/guide/statusline.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,44 @@ The `statusline` command provides a compact, real-time view of your Claude Code

Add this to your `~/.claude/settings.json` or `~/.config/claude/settings.json`:

```json
::: code-group

```json [bun x (Recommended)]
{
"statusLine": {
"type": "command",
"command": "bun x ccusage statusline", // Use "npx -y ccusage statusline" if you prefer npm
"padding": 0 // Optional: set to 0 to let status line go to edge
"command": "bun x ccusage statusline",
"padding": 0
}
}
```

```json [claude x]
{
"statusLine": {
"type": "command",
"command": "BUN_BE_BUN=1 claude x ccusage statusline",
"padding": 0
}
}
```

```json [npx]
{
"statusLine": {
"type": "command",
"command": "npx -y ccusage statusline",
"padding": 0
}
}
```

:::

::: tip claude x option
The `claude x` option requires the native version of Claude Code (not the npm version). If you installed Claude Code via npm, use the `bun x` or `npx` options instead.
:::

By default, statusline uses **offline mode** with cached pricing data for optimal performance.

### Online Mode (Optional)
Expand Down
Loading