ai-usage

Check AI CLI usage/quota for Claude Code, OpenAI Codex, Google Gemini CLI, and Z.AI. Use when user asks about remaining quota, usage limits, rate limits, or wants to check how much capacity is left.

16 stars

Best use case

ai-usage is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Check AI CLI usage/quota for Claude Code, OpenAI Codex, Google Gemini CLI, and Z.AI. Use when user asks about remaining quota, usage limits, rate limits, or wants to check how much capacity is left.

Teams using ai-usage should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/ai-usage/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/ai-agents/ai-usage/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/ai-usage/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How ai-usage Compares

Feature / Agentai-usageStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Check AI CLI usage/quota for Claude Code, OpenAI Codex, Google Gemini CLI, and Z.AI. Use when user asks about remaining quota, usage limits, rate limits, or wants to check how much capacity is left.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# AI CLI Usage Checker

Check remaining quota and usage for AI coding assistants: Claude Code, OpenAI Codex, Gemini CLI, and Z.AI.

Uses the [cclimits](https://www.npmjs.com/package/cclimits) npm package.

## When to Use This Skill

- User asks "how much quota do I have left?"
- User asks "check my usage" or "am I rate limited?"
- User wants to know which AI tool has capacity
- Before starting a large task, to verify quota availability
- User asks about token limits or remaining requests

## Running the Command

```bash
# Check all tools (detailed)
npx cclimits

# Compact one-liner (5h window)
npx cclimits --oneline

# Compact one-liner (7d window)
npx cclimits --oneline 7d

# Check specific tools
npx cclimits --claude
npx cclimits --codex
npx cclimits --gemini
npx cclimits --zai

# JSON output (for scripting)
npx cclimits --json
```

## Credential Locations

Credentials are auto-discovered from these locations:

| Tool | Location |
|------|----------|
| **Claude** | `~/.claude/.credentials.json` (Linux) or macOS Keychain |
| **Codex** | `~/.codex/auth.json` |
| **Gemini** | `~/.gemini/oauth_creds.json` (auto-refreshes) |
| **Z.AI** | `$ZAI_KEY` or `$ZAI_API_KEY` environment variable |

## Setup (One-Time)

If credentials are missing, run the corresponding CLI tool to authenticate:

```bash
claude           # Login to Claude Code
codex login      # Login to OpenAI Codex
gemini           # Login to Gemini CLI
export ZAI_KEY=your-key  # Add to ~/.zshrc
```

## Output Interpretation

### Quota Windows

Most tools use rolling windows:
- **5-hour window**: Short-term rate limit
- **7-day window**: Weekly quota limit

### Percentage Used

- **0-50%**: Plenty of capacity
- **50-70%**: Moderate usage, plan accordingly
- **70-90%**: High usage, may want to switch tools
- **90-100%**: Near limit, expect rate limiting

### Status Icons

| Icon | Meaning |
|------|---------|
| ✅ | Under 70% - plenty of capacity |
| ⚠️ | 70-90% - moderate usage |
| 🔴 | 90-100% - near limit |
| ❌ | 100% or unavailable |

### Gemini Tiers

Gemini models are grouped by quota tier (models in same tier share quota):

| Tier | Models |
|------|--------|
| **3-Flash** | gemini-3-flash-preview |
| **Flash** | gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.0-flash |
| **Pro** | gemini-2.5-pro, gemini-3-pro-preview |

## Example Output

### Compact One-liner (--oneline)

```
Claude: 4.0% (5h) ✅ | Codex: 0% (5h) ✅ | Z.AI: 1% ✅ | Gemini: ( 3-Flash 7% ✅ | Flash 1% ✅ | Pro 10% ✅ )
```

### Detailed Output (default)

```
🔍 AI CLI Usage Checker
   2025-12-31 21:30:00

==================================================
  Claude Code
==================================================
  🔑 Auth: Bearer token
  ✅ Connected

  5-Hour Window:
    Used:      15.2%
    Remaining: 84.8%
    Resets in: 3h 24m

  7-Day Window:
    Used:      42.0%
    Remaining: 58.0%
    Resets in: 4d 12h

==================================================
  OpenAI Codex
==================================================
  🔑 Auth: OAuth (ChatGPT)
  ✅ Connected
  📊 Plan: pro

  5h Window:
    Used:      8%
    Remaining: 92%
    Resets in: 2h 15m

==================================================
  Gemini CLI
==================================================
  🔑 Auth: OAuth (Google Account)
  ✅ Connected
  📊 Tier: standard

  Quota by Tier:
    3-Flash: 7.0% used, 93.0% remaining
    Flash: 1.0% used, 99.0% remaining
    Pro: 10.0% used, 90.0% remaining

==================================================
  Z.AI (GLM-4)
==================================================
  ✅ Connected

  Token Quota:
    Used:      1%
    Remaining: 99%
    (10,000 / 1,000,000 tokens)
```

## Troubleshooting

**"No credentials found"**
- Run the CLI tool to authenticate (see Setup section)
- For Z.AI, ensure environment variable is set

**"Token expired"**
- Claude: Run `claude` to re-authenticate
- Codex: Run `codex login`
- Gemini: Run `gemini` (or wait for auto-refresh)

**API errors**
- Check internet connectivity
- Verify the CLI tool works directly
- Check if the service is down

## Package Info

**npm package:** [cclimits](https://www.npmjs.com/package/cclimits)
**GitHub:** [cruzanstx/cclimits](https://github.com/cruzanstx/cclimits)

Requires: Node.js 16+ and Python 3.10+

Related Skills

ai-usage-coach

16
from diegosouzapw/awesome-omni-skill

Help users get more value from AI assistants by suggesting better prompting techniques, surfacing underused features, and identifying workflow improvements. Use when users ask things like "how can I use Claude better?", "what features am I missing?", "give me tips for prompting", "what can you do?", "I feel like I'm not getting the most out of this", or when they explicitly ask for help improving their AI usage. Also use when users seem frustrated with results or are clearly using suboptimal patterns.

ffmpeg-usage

16
from diegosouzapw/awesome-omni-skill

ffmpeg recipes and best practices: convert, concatenate, merge, resize, compress, GIF creation, audio extraction, subtitles, optimize for social platforms.

mongodb_usage

16
from diegosouzapw/awesome-omni-skill

This skill should be used when user asks to "query MongoDB", "show database collections", "get collection schema", "list MongoDB databases", "search records in MongoDB", or "check database indexes".

openai-usage

16
from diegosouzapw/awesome-omni-skill

Report current OpenAI usage/rate-limit health from Codex ChatGPT limits.

bgo

10
from diegosouzapw/awesome-omni-skill

Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.

Coding & Development

moai-lang-r

16
from diegosouzapw/awesome-omni-skill

R 4.4+ best practices with testthat 3.2, lintr 3.2, and data analysis patterns.

moai-lang-python

16
from diegosouzapw/awesome-omni-skill

Python 3.13+ development specialist covering FastAPI, Django, async patterns, data science, testing with pytest, and modern Python features. Use when developing Python APIs, web applications, data pipelines, or writing tests.

moai-icons-vector

16
from diegosouzapw/awesome-omni-skill

Vector icon libraries ecosystem guide covering 10+ major libraries with 200K+ icons, including React Icons (35K+), Lucide (1000+), Tabler Icons (5900+), Iconify (200K+), Heroicons, Phosphor, and Radix Icons with implementation patterns, decision trees, and best practices.

moai-foundation-trust

16
from diegosouzapw/awesome-omni-skill

Complete TRUST 4 principles guide covering Test First, Readable, Unified, Secured. Validation methods, enterprise quality gates, metrics, and November 2025 standards. Enterprise v4.0 with 50+ software quality standards references.

moai-foundation-memory

16
from diegosouzapw/awesome-omni-skill

Persistent memory across sessions using MCP Memory Server for user preferences, project context, and learned patterns

moai-foundation-core

16
from diegosouzapw/awesome-omni-skill

MoAI-ADK's foundational principles - TRUST 5, SPEC-First TDD, delegation patterns, token optimization, progressive disclosure, modular architecture, agent catalog, command reference, and execution rules for building AI-powered development workflows

moai-cc-claude-md

16
from diegosouzapw/awesome-omni-skill

Authoring CLAUDE.md Project Instructions. Design project-specific AI guidance, document workflows, define architecture patterns. Use when creating CLAUDE.md files for projects, documenting team standards, or establishing AI collaboration guidelines.