claude-status-ollama
v1.0.1
Published
Claude Code status-line hook for Ollama auto-switcher usage and account state
Maintainers
Readme
claude-status-ollama
A tiny, dependency-light Claude Code status-line hook that shows the current Claude model, your Ollama account email, usage bars, and auto-switch state.
Install
npx claude-status-ollama setupOr install globally / locally so it is always available:
npm install -g claude-status-ollama
# or
npm install --save-dev claude-status-ollamaYou can also run it straight from a local path without publishing:
cd claude-status-ollama
npx . setupSetup
The setup subcommand writes the Claude Code statusLine hook into the most appropriate settings file:
- Project settings:
.claude/settings.json(used by default if a.claudedirectory already exists) - Global settings:
~/.claude/settings.json
# Project settings
npx claude-status-ollama setup
# Global settings
npx claude-status-ollama setup --globalThe generated configuration looks like this:
{
"statusLine": {
"type": "command",
"command": "npx claude-status-ollama --status",
"refreshInterval": 10,
"padding": 2
}
}Authentication
The token is resolved in this priority order:
--token <token>CLI argumentOLLAMA_TOKENenvironment variable- File path from
OLLAMA_TOKEN_FILEenvironment variable --token-file <path>CLI argument- Default file:
~/.claude/ollama_tok.txt
If no token is found, the status line still renders the current Claude model without making an API call.
Usage
# Print the status line (requires --status)
npx claude-status-ollama --status
# Script-friendly JSON
npx claude-status-ollama --status --json
# Plain, colorless output
npx claude-status-ollama --status --plain
# Refresh every 5 seconds for manual testing
npx claude-status-ollama --status --watch 5
# Override token for one run
npx claude-status-ollama --status --token "ollama_..."What the status line shows
A typical line looks like:
Sonnet 5 | [email protected] | Sess [██████░░░░] 60% | Week [████████░░] 80% | Auto ON | Resets 2h/3d- Model — detected from
CLAUDE_MODEL,CLAUDE_CODE_MODEL, orANTHROPIC_MODEL - Email — sanitized and truncated if too long
- Session usage — colored ASCII progress bar
- Weekly usage — colored ASCII progress bar
- Auto-switch —
ON/OFFindicator - Reset timers — time until session/weekly reset
- Switched → — yellow prefix when
autoSwitch.triggeredistrue
Environment variables
| Variable | Purpose |
| --- | --- |
| OLLAMA_TOKEN | Ollama API token |
| OLLAMA_TOKEN_FILE | Path to a file containing the token |
| CLAUDE_MODEL / CLAUDE_CODE_MODEL / ANTHROPIC_MODEL | Detect the current Claude model name |
| CLAUDE_THINKING / CLAUDE_EFFORT | Optional thinking level / effort indicator |
| NO_COLOR | Disables colors (also auto-detected via chalk) |
Flags
| Flag | Description |
| --- | --- |
| --status | Emit the status line |
| --token <token> | Provide the API token inline |
| --token-file <path> | Read the API token from a file |
| --plain | No colors, no emoji, scripting-friendly |
| --json | Output raw JSON instead of the formatted line |
| --watch <seconds> | Refresh every N seconds |
| --global | With setup, write to global settings |
| -h, --help | Show help |
| -v, --version | Show version |
Development
cd claude-status-ollama
npm install
node index.js --help
node index.js --status --plain
npm testLicense
MIT
