Expand description
Alibaba Cloud Model Studio — Token Plan usage over the console gateway the
official bl CLI uses (bl auth login --console). A local-login vendor:
the credential is the CLI’s own ~/.bailian/config.json console token
(read-only, never written; AK/SK refresh is out of scope).
Reports two ratio windows — a 5-hour and a weekly — with epoch-ms reset
instants, dispatched per region×site through the gateway matrix in
types.rs. Cache is scoped by a fingerprint of the access token, so a
re-login never inherits the previous session’s figures, and the token
itself never persists anywhere but the CLI’s file.
Re-exports§
pub use fetch::FetchOutcome;pub use fetch::fetch_snapshot_with;
Modules§
- creds
- Read the official
blCLI’s own console-login file — read-only, never written.~/.bailian/config.json(flat snake_case JSON) holds the console Bearer token the CLI stored afterbl auth login --console: - fetch
- Fetch Model Studio Token Plan usage from the console gateway, with the
blCLI’s own console session (creds.rs). Cache/stale/error-fallback shape mirrorsgrokbot::fetch: fresh cache short-circuits; on failure, fall back to cache + mark stale. The cache is scoped by a fingerprint of the access token — a re-login selects another console session, so a cache written for one must never be shown for another, and the token itself is never persisted. - types
- Wire types for the Alibaba Cloud Model Studio Token Plan console gateway,
reconstructed from the official
blCLI (packages/core/src/console/gateway.ts). - vendor
- Model Studio renderer — bar text + bordered Pango tooltip. A dual-window vendor (the Codex/Kimi shape): a 5-hour and a weekly window, each with its own percent and reset, either of which the account may not report. An absent window is rendered absent — never as 0%, which would invent an exhaustion the wire never claimed (it may even mean unlimited).
Constants§
- APP_
DIR_ NAME - The
blCLI’s own config directory, under$HOME. - CONFIG_
DIR_ ENV - Environment override for the whole directory (tilde-expanded).
- CONFIG_
FILE_ NAME - The console-login file inside it.
Functions§
- config_
path - The config file path against the real environment.
- config_
path_ in - The config file path with every input injected — the test seam, so no test
resolves a real
$HOMEor branches on the ambient environment. Precedence matches the CLI: an explicit[modelstudio] config_dir, thenBAILIAN_CONFIG_DIR, then~/.bailian. - resolve_
credentials - Resolve the console session: the CLI’s file, read-only.