76 lines
1.9 KiB
Markdown
76 lines
1.9 KiB
Markdown
# shusub2
|
|
|
|
Terminal UI for the token-safe Sub2API account feed exposed by
|
|
`cliproxy-codex-quota`.
|
|
|
|
## Quick Start
|
|
|
|
Run once from a public Git repo with `uvx`:
|
|
|
|
```bash
|
|
uvx --from git+https://gitea.shujk.top/shujakuin/shusub2.git shusub2 \
|
|
--api-url https://example.com/api/tui/accounts
|
|
```
|
|
|
|
Install as a user command:
|
|
|
|
```bash
|
|
uv tool install git+https://gitea.shujk.top/shujakuin/shusub2.git
|
|
shusub2 --api-url https://example.com/api/tui/accounts
|
|
```
|
|
|
|
Configure a default API URL for `shusub2`:
|
|
|
|
```bash
|
|
mkdir -p ~/.config/shusub2
|
|
chmod 700 ~/.config/shusub2
|
|
printf '%s\n' 'https://example.com/api/tui/accounts' > ~/.config/shusub2/api-url
|
|
chmod 600 ~/.config/shusub2/api-url
|
|
shusub2
|
|
```
|
|
|
|
Environment variables override the config file:
|
|
|
|
- `SHUSUB2_API_URL`
|
|
- `SUB2API_QUOTA_TUI_API_URL`
|
|
- `SHUSUB2_API_URL_FILE`
|
|
|
|
## Local Development
|
|
|
|
```bash
|
|
cd apps/sub2api-quota-tui
|
|
uv run shusub2
|
|
```
|
|
|
|
Run inside zellij:
|
|
|
|
```bash
|
|
zellij action new-pane --name sub2api-quota -- \
|
|
bash -lc 'cd /home/shujakuin/infra/apps/sub2api-quota-tui && uv run shusub2'
|
|
```
|
|
|
|
Configuration:
|
|
|
|
- `--api-url` / `SUB2API_QUOTA_TUI_API_URL`
|
|
- `--refresh-seconds` / `SUB2API_QUOTA_TUI_REFRESH_SECONDS`
|
|
- `--timeout` / `SUB2API_QUOTA_TUI_TIMEOUT`
|
|
|
|
The TUI reads only `/api/tui/accounts`; it does not need SSH, database access,
|
|
API keys, OAuth credentials, or plaintext env files.
|
|
|
|
Columns are ordered for scanning inside zellij:
|
|
|
|
```text
|
|
Name | Provider | Group | Daily | Today | Tokens | Req | Kind | 5h | 7d | Reset | Status
|
|
```
|
|
|
|
`Provider` distinguishes `openai` and `anthropic` accounts from the public
|
|
`platform` field returned by the API.
|
|
|
|
`Daily` is shown as `used/limit` when Sub2API has `quota_daily_*` fields in
|
|
`accounts.extra`; otherwise it is `-`.
|
|
|
|
`Group` is the derived Sub2API tier alias group. Higher tiers win when multiple
|
|
aliases exist: `id < slow < fast < sfast`. The table shows `sfast` first, then
|
|
`fast`, `slow`, `id`, and ungrouped accounts.
|