Developer Tools · CLI

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.

macOS · Linux · WSL Zero dependencies OpenAI-compatible endpoints Streaming supported
Overview

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.

Step 1

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:

Terminal
$ molly --version
molly 1.x.x (stable)
Tip

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.

Step 2

Authenticate

Grab an API key from your dashboard at app.iamolly.ai, then run:

Terminal
$ 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:

HTTP
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"
Security

Treat mk-... keys like passwords. Never commit them to source control. Rotate compromised keys from the dashboard or with molly keys.

Reference

Commands

Every subcommand maps directly to a REST endpoint:

CommandEndpointWhat it does
molly authVerify & save your API key to ~/.molly/config.json
molly chatPOST /chat/completionsSend a message, get a completion. Supports --stream
molly modelsGET /modelsList available model IDs
molly usageGET /usageShow token consumption and quota
molly whoamiGET /usageShow the account & key currently authenticated
molly keysList, 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.

Terminal
$ 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.

Terminal
$ molly models
ID       OWNED BY
molly    molly

molly usage

Shows your token consumption and remaining quota via GET /usage.

Terminal
$ 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.

Terminal
$ 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:

Terminal
$ 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
Housekeeping

Configuration

All state lives in a single file: ~/.molly/config.json.

~/.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.
Housekeeping

Uninstall

Removing the CLI is as simple as installing it. Delete the binary and, optionally, your local config:

Terminal
# remove the binary
sudo rm /usr/local/bin/molly

# remove local config & saved keys (optional)
rm -rf ~/.molly
Note

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.