English | 简体中文
A Claude Code status line tool built for the AxisAPI AI aggregation platform. It automatically detects your AxisAPI provider from environment variables, Claude Code settings, or CCSwitch, then configures Claude Code's statusLine command for you.
Inspired by Haleclipse/CCometixLine.
- Auto-detects AxisAPI provider configuration from env vars, Claude Code settings, CCSwitch JSON files, and CCSwitch SQLite data.
- Writes Claude Code
statusLine.command = "axisapi-statusline"automatically during initialization. - Shows balance, today's usage, channel/provider, model, and context usage in a concise status line.
- Caches successful API responses locally for fast rendering and falls back to stale cache if the API request fails.
- Provides
doctor,sync,config, andclear-cachecommands for setup and troubleshooting.
AxisAPI ¥23.80 · Today ¥1.24 · Claude-A · Sonnet 4.5 · 32%
Shown when local AxisAPI config exists and the backend API returns account data successfully.
| Segment | Meaning |
|---|---|
AxisAPI |
Platform name returned by the backend, or the configured platform name. |
¥23.80 |
Current account balance, formatted with the returned currency. |
Today ¥1.24 |
Today's usage/cost. |
Claude-A |
Current channel or provider returned by the backend. |
Sonnet 4.5 |
Model display name returned by the backend, or the model detected from Claude Code. |
32% |
Claude Code context window usage percentage. |
AxisAPI ¥23.80 · Today ¥1.24 · Claude-A · Sonnet 4.5 · 32%
If the live API request fails but a previous successful response is cached, the status line falls back to stale cache data so the display remains useful.
| Segment | Meaning |
|---|---|
AxisAPI ¥23.80 |
Cached platform and balance from the last successful API response. |
Today ¥1.24 |
Cached usage/cost from the last successful API response. |
Claude-A |
Cached channel/provider value. |
Sonnet 4.5 |
Cached or Claude Code-detected model display name. |
32% |
Current Claude Code context usage, when provided by Claude Code. |
AxisAPI · Sonnet 4.5 · 32%
Shown when AxisAPI local config exists, but neither live API data nor cached API data is available.
| Segment | Meaning |
|---|---|
AxisAPI |
Default platform label. |
Sonnet 4.5 |
Model detected from Claude Code input or local config. |
32% |
Claude Code context window usage percentage. |
AxisAPI · Sonnet 4.5 · 32% · via CCSwitch
Shown when ANTHROPIC_BASE_URL points to a local proxy and no live/cached API data is available.
| Segment | Meaning |
|---|---|
via CCSwitch |
The current Claude Code request appears to be routed through a local CCSwitch proxy. |
AxisAPI · Sonnet 4.5 · 32% · Not initialized
Shown when ~/.axisapi/statusline.json has not been created yet.
| Segment | Meaning |
|---|---|
Not initialized |
Run axisapi-statusline init to detect/write AxisAPI status line config. |
- Node.js 18+
- Claude Code
- An AxisAPI-compatible provider/API key
Install globally from npm:
npm install -g @axisapi/statuslinePackage page: @axisapi/statusline on npm
Initialize the status line:
axisapi-statusline initIf provider detection fails, pass the provider manually:
axisapi-statusline init --base-url https://axisapi.cn --api-key sk-axis-xxxx --model claude-sonnet-4-5Restart Claude Code after initialization. Claude Code will then call axisapi-statusline automatically when rendering the status line.
axisapi-statusline # Render the status line; Claude Code calls this
axisapi-statusline init # Initialize local config and Claude Code statusLine
axisapi-statusline sync # Resync AxisAPI provider from env / Claude settings / CCSwitch
axisapi-statusline doctor # Check config, statusLine wiring, and API connectivity
axisapi-statusline config # Show local config with masked API key
axisapi-statusline clear-cacheaxisapi-statusline init and axisapi-statusline sync resolve provider configuration in this order:
- Explicit CLI options:
--base-url,--api-key,--model - Process environment variables
- Claude Code settings env blocks
- CCSwitch JSON configuration files
- CCSwitch SQLite database via
sql.js
A provider is accepted only when the base URL looks AxisAPI-related and the API key is usable.
This CLI writes user-level configuration files:
| File | Purpose |
|---|---|
~/.axisapi/statusline.json |
AxisAPI statusline config |
~/.axisapi/cache.json |
Short-lived API response cache |
~/.claude/settings.json |
Claude Code statusLine configuration |
~/.cc-switch/* |
Scanned for provider configuration when available |
The CLI calls:
GET /api/statusline/me
Authorization: Bearer <AxisAPI API Key>Expected JSON:
{
"platform": "AxisAPI",
"balance": 23.8,
"currency": "CNY",
"todayCost": 1.24,
"channel": "Claude-A",
"modelDisplayName": "Sonnet 4.5"
}npm install
npm run check
npm link
axisapi-statusline init --base-url https://axisapi.cn --api-key sk-axis-test
axisapi-statusline doctorCommon scripts:
npm start # Run node ./bin/axisapi-statusline.js
npm run init # Run the init command
npm run doctor # Run diagnostics
npm run sync # Resync provider config
npm run pack:dry # Preview npm package contentsThere is currently no test suite configured. Use npm run check plus focused manual CLI commands for validation.
- Thanks to CCometixLine for the inspiration and reference.
- Built for Claude Code users who route Claude traffic through AxisAPI-compatible providers.