Skip to main content
AIHubMix CLI is the official AIHubMix command-line tool (executable aihubmix). Once installed, you can query your account balance, manage API Keys, and view available models from the terminal without opening the web console. It is a single binary — no Python, Node, or Go required — and installs with one command; every command supports JSON output, so it plugs straight into scripts, CI, and AI Agents (such as Claude Code). What it can do:
  • Check balance: Query your account balance and used quota in real time
  • Manage Keys: Create, view, search, update, and delete API Keys
  • View models: List the models available to the current token
  • Scriptable: JSON output + stable exit codes, a natural fit for automation and AI Agents
Don’t mix up the two credentials: The CLI signs in with a “System Access Token” (Manage Key, format fd***). Get it from the console at console.aihubmix.com/setting by clicking “Generate System Access Token”. It is used to manage your account and is not the same as the API Key (sk-***) you use to call models.
Looking for the older Python script (aihubmix_cli.py)? See Retrieve Account Information via API. This page is its next-generation replacement — simpler and faster.

Installation

Copy the command for your system, paste it into your terminal, and run it to download the binary and automatically add it to PATH:
curl -fsSL https://raw.githubusercontent.com/AIhubmix/platfrom-cli/main/install.sh | sh
After installation, open a new terminal, then run aihubmix login to get started.
You can also manually download the binary for your platform from Releases (Windows: aihubmix_windows_amd64.exe) and place it in a PATH directory; on Unix-like systems, run chmod +x.
When needed, you can adjust install behavior with environment variables:
VariableDescriptionDefault
AIHUBMIX_VERSIONInstall a specific version (e.g. v0.2.0)latest
AIHUBMIX_BIN_DIRCustom install directoryUnix: /usr/local/bin or ~/.local/bin; Windows: %LOCALAPPDATA%\aihubmix\bin

Quick Start

Once logged in, all commands are available:
# 1. Log in: opens a browser to the token generation page; paste your Manage Key (input is hidden)
aihubmix login

# 2. View current identity and balance
aihubmix whoami

# 3. View full account information
aihubmix me

# 4. List your API Keys
aihubmix keys list

Command Reference

CommandPurpose
aihubmix loginLog in (paste Manage Key)
aihubmix logoutLog out, clear local credentials
aihubmix whoamiView current login identity and balance
aihubmix meView full account information and balance
aihubmix models listView currently available models
aihubmix keys list [--num N]List API Keys
aihubmix keys search <keyword>Search Keys by keyword
aihubmix keys get <id>View details for a specific Key
aihubmix keys create [flags]Create a new Key
aihubmix keys update <id> [flags]Update a Key
aihubmix keys delete <id>Delete a Key
Add --help to any command to see its full flags, e.g. aihubmix keys create --help.

Common Operations

Managing API Keys

# Create a Key with a $10 quota limit, restricted to specific models
aihubmix keys create -n prod-key -q 10 -m "gpt-4o,claude-3.5-sonnet"

# Create a Key with unlimited quota that never expires
aihubmix keys create -n ci-key -u

# Rename a Key (all other settings unchanged)
aihubmix keys update 123 -n new-name

# Disable a Key
aihubmix keys update 123 --status 0

# Delete a Key
aihubmix keys delete 123
Here -q 10 sets a $10 quota limit on the Key, and -u means unlimited quota. Deletion prompts for confirmation by default; add --yes to skip it in CI scenarios.

Using with Scripts / AI Agents

The CLI is very automation-friendly and can be driven directly by CI, scripts, or AI Agents (such as Claude Code):
  • Login-free: Pass a Manage Key via the AIHUBMIX_TOKEN environment variable or --token to skip interactive login (priority: --token > AIHUBMIX_TOKEN > config file).
  • JSON output: Add --json (-j) to any command; normal results go to stdout and errors to stderr, making jq parsing easy.
  • Stable exit codes: Scripts can branch on these to determine success or failure.
# Drive with an env var and extract all Key names
AIHUBMIX_TOKEN=fd*** aihubmix keys list --json | jq '.data[].name'

# Query balance
AIHUBMIX_TOKEN=fd*** aihubmix whoami --json | jq -r '.balance'
Exit code meanings:
Exit CodeMeaning
0Success
1General error (invalid arguments, business failure, etc.)
2Authentication failure (not logged in / invalid token)
3Network / connection error

Global Flags

The following flags apply to all commands:
FlagShortDescription
--token <token>-tPass a Manage Key directly (CI / scripting scenarios)
--json-jOutput in JSON format
--base-url <url>-bCustom API URL (default https://aihubmix.com)
--no-colorDisable colored output
--config <path>Specify the config file path
--versionPrint version

Configuration File

Login information is stored in ~/.aihubmix/config.json (Windows: %USERPROFILE%\.aihubmix\config.json), with permissions tightened to read/write by the current user only. During login, the Manage Key is not echoed and not written to logs.
Do not commit your Manage Key to a code repository or share it with others. If it leaks, regenerate it in the console; the old token is invalidated immediately.

FAQ

Do I need to install Python / Node / Go? No. The CLI is a single binary — download and use. What’s the difference between a Manage Key and an API Key? The Manage Key (fd***) is used to manage your account (check balance, manage Keys) and is used by the CLI; the API Key (sk-***) is used to call models. They are generated in different places in the console and cannot be used interchangeably. Is Windows supported? Yes. Native binaries are provided for Windows, macOS, and Linux. How do I use it non-interactively in CI / scripts? Pass the Manage Key via the AIHUBMIX_TOKEN environment variable, combined with --json and exit codes — no need to run aihubmix login. What if I forget or leak my Manage Key? Regenerate it at console.aihubmix.com/setting; the old token is invalidated.
Related docs: Platform API · CliEndpoints · Legacy Python Script · AIHubMix Console
Last updated: 2026-06-22