Molly CLI
A thin, fast terminal client over Molly's OpenAI-compatible REST API. Install in one line, authenticate once, and chat, inspect models, and track usage — all without leaving your shell.
What is the Molly CLI?
The Molly CLI is a lightweight wrapper around Molly's REST API. Every command maps 1:1 to an HTTP call against the base URL:
https://app.iamolly.ai/api/molly/v1
Requests are authenticated with a Bearer API key (format mk-...). There's no daemon, no background process, no telemetry — just your terminal talking to your Molly.
Thin by design
A single static binary. Each command is a plain HTTP request with your Bearer key attached — nothing more.
OpenAI-compatible
Backed by the same /chat/completions and /models endpoints the SDK and any compatible client library use.
Scriptable
Clean stdout, machine-readable exit codes, and --json output make it easy to drop into pipelines and cron jobs.
Streaming built in
Pass --stream to any chat and tokens render live as server-sent events arrive.
Install
One line. The install script detects your OS and architecture, downloads the right binary, and places it on your PATH (typically /usr/local/bin/molly).
curl -fsSL https://iamolly.ai/cli/install.sh | sh
Verify the install:
$ molly --version
molly 1.x.x (stable)
Prefer to inspect before running? Download the script first: curl -fsSL https://iamolly.ai/cli/install.sh -o install.sh, read it, then sh install.sh.
Authenticate
Grab an API key from your dashboard at app.iamolly.ai, then run:
$ molly auth
Paste your API key (mk-...): mk-********************************
✓ Key verified. Saved to ~/.molly/config.json
The key is stored locally in ~/.molly/config.json with 0600 permissions and sent as a Bearer header on every request:
Authorization: Bearer mk-your-key-here
You can also override the stored key per-invocation with the MOLLY_API_KEY environment variable — handy for CI:
MOLLY_API_KEY=mk-... molly chat "hello"
Treat mk-... keys like passwords. Never commit them to source control. Rotate compromised keys from the dashboard or with molly keys.
Commands
Every subcommand maps directly to a REST endpoint:
| Command | Endpoint | What it does |
|---|---|---|
| molly auth | — | Verify & save your API key to ~/.molly/config.json |
| molly chat | POST /chat/completions | Send a message, get a completion. Supports --stream |
| molly models | GET /models | List available model IDs |
| molly usage | GET /usage | Show token consumption and quota |
| molly whoami | GET /usage | Show the account & key currently authenticated |
| molly keys | — | List, add, or remove locally stored keys |
molly chat
Send a message to the default model, molly. Under the hood this is a POST /chat/completions request.
$ molly chat "Summarize this repo's README in 3 bullets"
# equivalent to:
# POST https://app.iamolly.ai/api/molly/v1/chat/completions
# { "model": "molly", "messages": [{ "role": "user", "content": "..." }] }
Streaming
Add --stream to render tokens live as they arrive:
molly chat --stream "Write a haiku about uptime"
Piping
Read the prompt from stdin for scripted workflows:
git diff | molly chat "Review this diff for bugs"
molly models
Lists model IDs available to your key via GET /models.
$ molly models
ID OWNED BY
molly molly
molly usage
Shows your token consumption and remaining quota via GET /usage.
$ molly usage
Period current billing cycle
Requests 1,284
Tokens in 412,006
Tokens out 198,441
Quota 62% remaining
Add --json to get raw JSON for dashboards and alerts:
molly usage --json | jq '.tokens_out'
molly whoami & molly keys
molly whoami confirms which account and key the CLI is currently using — useful when juggling multiple environments.
$ molly whoami
Account you@yourcompany.com
Key mk-****...9f2a (active)
Base URL https://app.iamolly.ai/api/molly/v1
molly keys manages locally stored keys:
$ molly keys list # show saved keys (masked)
$ molly keys add # save an additional key
$ molly keys use <name> # switch active key
$ molly keys remove <name> # delete a key locally
Configuration
All state lives in a single file: ~/.molly/config.json.
{
"api_key": "mk-...",
"base_url": "https://app.iamolly.ai/api/molly/v1",
"default_model": "molly"
}
Environment variables always win over the config file:
MOLLY_API_KEY— override the stored key.MOLLY_BASE_URL— point at a different deployment.
Uninstall
Removing the CLI is as simple as installing it. Delete the binary and, optionally, your local config:
# remove the binary
sudo rm /usr/local/bin/molly
# remove local config & saved keys (optional)
rm -rf ~/.molly
Uninstalling the CLI does not revoke your API keys. Revoke keys from your dashboard at app.iamolly.ai if they are no longer needed.
Next: build with the SDK
Prefer code over shell? The Molly SDK gives you the same API surface in your language of choice, and the REST API reference documents every endpoint the CLI uses.