Save a key
Install the provider first, then log in:
img-cli provider add vibetoken
img-cli provider login vibetoken
Paste the key at the hidden prompt. To pass it from a script, pipe it in:
echo "$KEY" | img-cli provider login vibetoken
The key goes into the config file, config.json in the directory listed in Using providers, readable only by you (mode 0600). This works the same on a desktop, a server, and in a container. img-cli provider logout <name> deletes it.
Earlier versions (v0.2.3 and before) saved keys in the system keychain, which img-cli no longer reads; run provider login again to save them in the config file.
Where keys come from
For each request img-cli looks for the provider's key in this order:
IMG_CLI_<NAME>_KEY, such asIMG_CLI_GRSAI_KEY; formy-vendorit isIMG_CLI_MY_VENDOR_KEY.- The variable the plugin names in
auth.env, if any. LaoZhang readsLAOZHANG_API_KEY. - The config file.
img-cli provider list shows where each provider's key comes from:
NAME TITLE BASE URL KEY
grsai Grsai https://grsaiapi.com file
laozhang LaoZhang API https://api.laozhang.ai env
vibetoken * VibeToken https://vibetoken.cn file
In CI
Set the environment variable from your CI secrets instead of logging in:
export IMG_CLI_VIBETOKEN_KEY="$VIBETOKEN_API_KEY"
img-cli image -m vibetoken:bytedance/seedream-5.0-flash "a fox" -o out/
See Scripts and CI.
With an AI assistant
Log in yourself, in your own terminal. Don't paste an API key into a chat with an assistant; the setup prompt on the home page tells the assistant to ask you to run provider login instead.
Remove a key
img-cli provider logout vibetoken
img-cli provider remove <name> also deletes the key, along with the plugin.
Errors
A missing or rejected key exits with code 3:
error: no API key for vibetoken: run `img-cli provider login vibetoken` or set $IMG_CLI_VIBETOKEN_KEY