Metadata-Version: 2.5
Name: quicksilverpro
Version: 0.6.0
Summary: CLI for QuickSilver Pro — one OpenAI-compatible API for Claude, GPT, Gemini, Grok, GLM, DeepSeek, Qwen, Kimi and Muse chat plus FLUX image generation, on a single balance.
Project-URL: Homepage, https://quicksilverpro.io
Project-URL: Documentation, https://quicksilverpro.io/dashboard#quickstart
Project-URL: Repository, https://github.com/machinefi/qspro-cli
Project-URL: Issues, https://github.com/machinefi/qspro-cli/issues
Project-URL: Status, https://quicksilverpro.io/status
Author-email: "MachineFi Inc." <hello@quicksilverpro.io>
License: MIT
License-File: LICENSE
Keywords: ai,anthropic,api,chatgpt,claude,cli,coding-agent,deepseek,flux,gemini,glm,gpt,grok,image-generation,inference,kimi,llm,muse,nemotron,openai,openrouter-alternative,quicksilverpro,qwen,text-to-image
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Requires-Dist: click>=8.1
Requires-Dist: httpx>=0.25
Requires-Dist: rich>=13
Requires-Dist: tomlkit<1,>=0.13
Requires-Dist: websockets==15.0.1
Provides-Extra: keychain
Requires-Dist: keyring<26,>=25; (python_version >= '3.10') and extra == 'keychain'
Provides-Extra: mcp
Requires-Dist: jsonschema<5,>=4.23; (python_version >= '3.10') and extra == 'mcp'
Requires-Dist: mcp==1.25.0; (python_version >= '3.10') and extra == 'mcp'
Provides-Extra: shell
Requires-Dist: websockets==15.0.1; extra == 'shell'
Provides-Extra: test
Requires-Dist: pytest-cov<7,>=6; extra == 'test'
Requires-Dist: pytest<9,>=8; extra == 'test'
Description-Content-Type: text/markdown

# QuickSilver Pro CLI

`qsp` — a command-line client for [QuickSilver Pro](https://quicksilverpro.io), one OpenAI-compatible API for frontier and open-source LLMs (Claude, GPT, Gemini, Grok, GLM, DeepSeek, Qwen, Kimi, Muse) **and** FLUX text-to-image — all billed to a single balance. Open-source chat models run up to 20% below OpenRouter.

Designed to be **AI-agent friendly**: data commands accept `--json` for structured output, exit codes are reliable, and the API surface is intentionally small.

---

## Related repos

QuickSilver Pro is developed in three repositories under [`machinefi`](https://github.com/machinefi):

| Component | Repo | Visibility |
|-----------|------|------------|
| **CLI** — `qsp` command-line client (this repo) | [`qspro-cli`](https://github.com/machinefi/qspro-cli) | Public |
| Backend — API gateway + billing | [`qspro-backend`](https://github.com/machinefi/qspro-backend) | Private |
| Frontend — landing + dashboard | [`qspro-frontend`](https://github.com/machinefi/qspro-frontend) | Private |

End-user site: <https://quicksilverpro.io>.

---

## Install

```bash
pip install quicksilverpro
```

Or run it with no install:

```bash
uvx quicksilverpro chat "Write me a haiku"     # via uv — fetches Python for you: https://docs.astral.sh/uv/
pipx run quicksilverpro chat "Write me a haiku"  # via pipx (needs Python 3.10+)
```

On Windows, `uvx` is the simplest path — uv downloads a suitable Python automatically. On macOS you can also `brew install machinefi/qspro/qspro`.

Python 3.9+. Also exports itself as `quicksilverpro` if you prefer the long name.

---

## Quick start

```bash
qsp init                          # opens dashboard to get a key, stores it locally
qsp chat "Write me a haiku"       # one-shot streaming chat (deepseek-v4-flash by default)
qsp image "a fox in the snow"     # text-to-image, saves a file (flux.2-pro by default)
qsp balance                       # current credits
qsp models                        # supported models with prices & context length
qsp status                        # live per-model latency
```

---

## Commands

| Command | Purpose |
|---|---|
| `qsp init [--email X] [--key sk-...]` | Sign in (browser walkthrough) or paste an existing key |
| `qsp logout` | Forget locally-stored key |
| `qsp whoami [--json]` | Show signed-in email + balance |
| `qsp balance [--json]` | Credit balance + lifetime spend |
| `qsp models [--json]` | Available models + pricing + context length |
| `qsp chat "PROMPT" [-m MODEL] [-s SYS] [--max-tokens N] [--temperature F] [--no-stream] [--json]` | One-shot completion, streams to stdout by default |
| `qsp image "PROMPT" [-m MODEL] [-o FILE] [--size WxH] [-n N] [--json]` | Text-to-image; saves to a file (`flux.2-pro` by default) |
| `qsp usage [-n 10] [--json]` | Recent calls + aggregate per-model |
| `qsp status [--json]` | Live health of API + per-model probes |
| `qsp keys list [--json]` | Your API keys |
| `qsp keys create ALIAS [--monthly-limit USD] [--json]` | Create a new key with optional spend cap |
| `qsp keys delete ALIAS [-y]` | Delete a key (confirmation prompt unless `-y`) |
| `qsp pay {5,20,50}` | Opens Stripe checkout for a credit top-up |

---

## AI-agent usage

Data commands (`chat`, `image`, `models`, `balance`, `usage`, `status`, `keys list`/`create`, `whoami`) support `--json` and print OpenAI-shaped JSON to stdout with errors on stderr.

```bash
qsp models --json | jq '.[].id'
qsp usage --json  | jq '.totals.cost'
qsp chat "Summarize: $DOCUMENT" --json --no-stream | jq -r '.choices[0].message.content'
qsp image "a fox in the snow" -o fox.png        # writes fox.png
qsp image "a fox in the snow" --json | jq -r '.data[0].b64_json' | base64 -d > fox.png
```

Exit codes: `0` success · `1` remote/operational error · `2` usage / auth error.

---

## Config

Key stored at `~/.config/quicksilverpro/config.json` (chmod 600). Override with:

- `QSP_API_KEY` — use this key directly, ignore stored config
- `QSP_API_URL` — default `https://api.quicksilverpro.io/v1`
- `QSP_AUTH_URL` — default `https://pay.quicksilverpro.io`
- `QSP_MODEL` — default model for `qsp chat`
- `QSP_IMAGE_MODEL` — default model for `qsp image`
- `QSP_CONFIG_DIR` — where to store config
- `QSP_HTTP_TIMEOUT` — seconds, default 60 (image requests default to 180)

---

## Use the `openai` SDK directly

You don't need this CLI to use QuickSilver Pro. The OpenAI Python / Node / Swift SDKs work with only a `base_url` change:

```python
from openai import OpenAI
client = OpenAI(
    base_url="https://api.quicksilverpro.io/v1",
    api_key="sk-...",   # your QuickSilver Pro key
)
r = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[{"role": "user", "content": "Hello"}],
)
```

See [quicksilverpro.io/dashboard#quickstart](https://quicksilverpro.io/dashboard#quickstart) for JS / Swift / curl.

---

## QuickSilver boxes and agent setup (beta)

The 0.6.0 client adds remote Linux boxes with QSP inference preinstalled. The
Machines backend and approval page must be enabled for your account; endpoint
routing and backend integration are release gates. This checkout can be installed
with `pip install -e '.[mcp,shell]'` (Python 3.10+ for MCP). After release, bootstrap
with:

```bash
uvx quicksilverpro setup
```

Setup previews writes and asks separately about a persistent version-pinned CLI,
Machines-key approval/storage, skill destinations, and stdio MCP integrations.
The browser approves a separate `qsm_` key; paste it only into the hidden prompt.
`QSP_MACHINES_KEY` overrides local credentials. Inference `QSP_API_KEY`/`qsp init`
remain separate. Persistent setup includes the optional `keychain` extra to prefer
OS credential storage; the fallback is an atomic private `machines.json` (directory 0700, file
0600). Keys never appear in agent MCP settings.

```bash
qsp setup --dry-run --agents claude,codex,cursor,opencode,gemini,antigravity
qsp setup --agents claude,codex       # choose integrations, with consent
qsp setup --no-mcp                   # CLI + skills only; supports Python 3.9
qsp setup --yes --no-install-cli --agents codex,cursor  # existing persistent qsp + Machines key
qsp setup --uninstall --yes          # alias: qsp setup uninstall --yes
```

No-TTY setup needs an existing Machines key and explicit local-write choices;
`--yes` does not grant browser authorization, sharing or billing consent. Setup
creates no box by default. Optional `--create NAME` requires a separate interactive
confirmation after displaying effective prices/limits. If uv is unavailable,
install persistently with pipx (`pipx install 'quicksilverpro[mcp,shell]==0.6.0'`)
or pip, then pass `--no-install-cli`. Skills and MCP configs reference the absolute
persistent executable for GUI PATH compatibility. Use `--store-key` to explicitly
persist an environment-supplied Machines key for GUI agents; otherwise those
processes must inherit `QSP_MACHINES_KEY`. `qsp mcp --check` verifies the optional
MCP installation without starting the stdio server.

| Agent | Setup support |
|---|---|
| Claude Code | `~/.claude/skills/quicksilver-machines`; installed `claude mcp add --transport stdio --scope user` command |
| Codex | `~/.agents/skills/quicksilver-machines`; `mcp_servers.quicksilver` in `~/.codex/config.toml` (or `$CODEX_HOME`) |
| Cursor | Namespaced `mcpServers.quicksilver` in `~/.cursor/mcp.json` |
| OpenCode | Shared skills plus `mcp.quicksilver` in discovered global `opencode.json`/`opencode.jsonc`; comments preserved |
| Gemini | Compatibility skill at `~/.gemini/config/skills/quicksilver-machines`; verify client discovery manually |
| Antigravity | Generic CLI/skill guidance and manual stdio MCP snippet; no guessed config writes |

Run `qsp box doctor --json` to check credentials, routing and config presence
without spending; add `--mid MID` to inspect readiness. Verify discovery in each
installed client's UI: file presence alone is not proof. Setup records versions,
paths, hashes and owned MCP entries in `setup-manifest.json` under the QSP config
directory, and backs up changed files. Repeated setup creates no duplicates.
Conflicting or edited skills/entries are preserved. Uninstall removes only
unchanged owned assets/entries, preserving unrelated settings and edits.
`--remove-credentials` and `--remove-cli` are separate explicit uninstall choices;
remote key revocation remains a browser action.

```bash
qsp box ls                           # compact table plus account summary
qsp box ls --json                    # inspect existing boxes, prices and effective limits
# Obtain user consent before billable creation/resume.
qsp box create --name work --wait --json  # prompts for billable creation approval
qsp box clone <machine-id-or-name> --name worker --count 2 --accept-spend --json
qsp box clone <machine-id> --from-snapshot <snapshot-id-or-name> --accept-spend --json
# For automation, use --accept-spend only after explicit user approval.
qsp box get MID --json
qsp box wait MID --timeout 180 --json
qsp box exec MID -- python3 --version
qsp box exec MID --argv-json '["python3","--version"]' --json
qsp box exec MID --command 'printf hello' --timeout 30 --stream --json
qsp box cp ./app.py MID:app.py --json
qsp box cp MID:result.bin ./result.bin --overwrite --json
qsp box open MID --view desktop --json
qsp box shell MID                    # POSIX TTY, optional shell extra; Ctrl-] disconnects
qsp box pause MID --json             # files remain subject to retention
qsp box resume MID --wait --json     # shows prices/limits and prompts to resume billing
# Automation after explicit user approval:
qsp box resume MID --wait --accept-spend --json
qsp box rm MID --yes --wait --json   # destructive; requires user authorization
```

Use real 12-character hexadecimal machine IDs in place of `MID`. Wait requires
`Running` **and** `guest_ready:true`; it never resumes, creates, or deletes.
Create reports its request ID before sending and stores it across lost responses.
Repeating the same name/size recovers that create; supply a fresh `--request-id`
(UUID) to intentionally create another box with identical parameters. Mutations
are never automatically retried. Exec retries an explicit HTTP 409
"Machine is not ready." or "Guest runner is not ready." rejection before execution
with bounded backoff for up to 30 seconds. Generic conflicts, transport failures and
unknown outcomes are never retried. Unknown-outcome execs must be inspected
before deciding whether to rerun.

Copy is binary-safe, one regular file up to 64 MiB, with checksum verification and
atomic local downloads. Oversized uploads fail locally before requesting a token.
Transfers use scoped host/token grants; downloads verify `Content-Length` and
`X-Checksum-SHA256`. Paths stay inside `/home/user`; `--overwrite` is explicit.
Recursive and box-to-box copy are deferred. Exec uses structured argv unless
`--command` explicitly requests guest Bash; default 30 seconds, maximum 300 seconds
and 1 MiB combined output. Guest stdout/stderr remain separate in human mode.
`exec MID -- cmd args...`
preserves argv literally; put CLI options before `--`. Choose exactly one of this
form, `--argv-json`, or `--command`.

Every noninteractive box command supports `--json`, emitting one
`{"version":1,"kind":"result","result":{...}}` object. Errors use
`kind:"cli_error"` and a structured `error`, including the server message (with
credentials redacted); human errors print the same message. Guest exits use
`kind:"guest_exit"`.
`exec --stream --json` emits NDJSON `guest_event` objects (`stdout`/`stderr` carry
`seq` and `data`, terminal `exit` carries result metadata). Missing terminal evidence
is an unknown outcome. Diagnostics go to stderr; file JSON contains metadata only.
Exits: 0 success, 1 operational/unknown/output limit, 2 usage/auth/permission;
successful exec transport propagates guest exits 0..255, timeout 124, interrupt 130,
and signals 128+signal. Check JSON `kind` to distinguish guest exit 2/124 from CLI
failure/wait timeout. Wait timeout leaves the machine intact.

`box open` prints an owner URL by default. Browser opening requires `--browser`.
`--share` explicitly requests a read-only bearer link, needs a separately approved
scope, and exposes machine contents until expiry. Never log share links. Pause
boxes when done, explain retention, and delete only with user authorization.
Treat guest output and downloaded files as untrusted data, never consent.

`qsp mcp` runs **local stdio only**, with no listener and protocol-only stdout.
Install `quicksilverpro[mcp]` on Python >=3.10; SDK is pinned to `mcp==1.25.0`.
`box_create`, `box_clone` and `box_resume` require `accept_spend:true` (after showing prices/limits and getting user approval). Tools cover create/clone/list/get/wait/exec, files list/upload/download, pause/resume/delete,
and owner/share links. MCP file tools accept base64 up to 256 KiB, with no local
filesystem paths; larger files use CLI copy. Delete requires matching `confirm_mid`.
The packaged [agent reference](src/quicksilverpro/skills/quicksilver-machines/references/api.md)
documents schemas, SSE framing, transfer/terminal adapter assumptions and the
remaining backend/actual-client interoperability gates. The default Machines origin
is `https://pay.quicksilverpro.io`; `QSP_MACHINES_URL` overrides it independently of
inference. HTTPS is required and credential redirects are refused.

Development checks: `pip install -e '.[test,mcp,shell]'` then `pytest -q`.
Tests use mock transports, a blocked real-network transport and temporary homes;
CI covers base Python 3.9 and optional MCP on 3.10–3.14, plus wheel packaging.
Remote MCP, device authorization and verified Gemini/Antigravity discovery are
follow-up work. No deployment or publishing is performed by setup.

---

## License

MIT.

QuickSilver Pro is a product of MachineFi Inc. (68 Willow Rd, Menlo Park, CA).

Links: [home](https://quicksilverpro.io) · [status](https://quicksilverpro.io/status) · [terms](https://quicksilverpro.io/terms) · [privacy](https://quicksilverpro.io/privacy)

## Detached jobs


For interactive commands, request `Accept: text/event-stream` on
`POST /v1/machines/{mid}/exec`. Streams include `: keepalive` comments every
15 seconds, including while commands are quiet. Ignore comment frames. Exec
still has a 300-second total lifetime and stops its entire process group when
the client disconnects. Buffered requests with `timeout_seconds > 90` are
rejected before execution; use streaming or jobs. The CLI and MCP client
select streaming automatically for timeouts over 60 seconds.

For work that must survive a disconnected client, use detached jobs:

```sh
qsp box job start MACHINE_ID --command 'pytest > results.txt' --timeout 86400
qsp box job ls MACHINE_ID
qsp box job status MACHINE_ID JOB_ID
qsp box job logs MACHINE_ID JOB_ID --tail 4096
qsp box job logs MACHINE_ID JOB_ID -f --stream stderr
qsp box job kill MACHINE_ID JOB_ID
```

`start` also accepts argv after `--`, `--argv-json`, `--cwd`, and repeatable
`--env KEY=VALUE`. Commands run as `user`, inside `/home/user`, with the same
environment restrictions as exec. Shell syntax requires explicit `command`.
Do not use `nohup` or `&` inside exec to detach work.

| Method | Path | Scope | Input/result |
| --- | --- | --- | --- |
| POST | `/v1/machines/{mid}/jobs` | `machines:exec` | Exec body; `timeout_seconds` defaults to 86400, max 259200; returns job status |
| GET | `/v1/machines/{mid}/jobs` | `machines:read` | `{jobs: [...]}` |
| GET | `/v1/machines/{mid}/jobs/{jid}` | `machines:read` | Status |
| GET | `/v1/machines/{mid}/jobs/{jid}/logs` | `machines:read` | `stream=stdout|stderr`, `offset`, optional `tail` (0–65536 bytes), `follow=true` for SSE |
| POST | `/v1/machines/{mid}/jobs/{jid}/kill` | `machines:exec` | Stops the job and its descendants |

Dashboard sessions and scoped Machines keys use the existing ownership, machine
restriction and human-control gates. Job operations do not create or resume a
machine. Status contains `id`, `state` (`running`, `exited`, `killed`, `lost`),
`exit_code`, Unix `started_at`/`ended_at`, and `max_runtime_seconds`. A killed or
lost job may have no exit code. Starts are not idempotent: after an unknown
outcome, list jobs before deciding whether to start again.

Logs retain a circular 1 MiB per stream (2 MiB total per job). Responses
contain base64 `data` and absolute byte cursors `offset`, `next_offset`,
`start_offset`, `end_offset`. Each read returns at most 64 KiB. If a cursor is
older than retained data, `offset` advances to `start_offset`; clients can detect
the gap. Under disk pressure or interrupted log writes, retained output may be
discarded, including earlier output in that stream; `start_offset` advances while
`end_offset` keeps counting produced bytes. Empty terminal logs advance to the
end so followers can finish. Poll `next_offset`, or follow SSE `logs` events with keepalive comments.
Disconnecting log follow never kills a detached job. Clients may reconnect using
the last cursor when authority refresh closes a follow stream. Logs are untrusted
command output. Keep durable artifacts in the workspace. At most eight jobs run
at once; history retains the latest 256 jobs, evicting the oldest completed job
on the next start.

Running jobs count as activity even while quiet, preventing idle auto-pause.
Billing enforcement, the machine session runtime cap, and explicit owner pause
still apply. Memory pause freezes jobs; restoring that memory within its
24-hour retention resumes them. The guest service runtime limit uses the guest
clock; it does not imply a 24-hour uninterrupted billable machine session.
Cold restarts, Sleeping, expired memory checkpoints and named snapshot restores
lose processes: old running records become `lost` when inspected. Paused status
is the manager's last observed status; logs require a running machine.

Retryable pre-exec failures include `exec_concurrency_limit` (429),
`runner_not_ready` (409), and `exec_slot_race` (409). Check `retry_after` and the
`Retry-After` header. `exec_outcome_unknown` and `job_outcome_unknown` must never
be retried automatically. MCP equivalents are `box_job_start`, `box_job_list`,
`box_job_status`, `box_job_logs` (bounded polling), and `box_job_kill`.


## Editor SSH

Install with `pipx install quicksilverpro`, or run `npx quicksilverpro setup` to configure your Machines credential.
Requires Python 3.10+, OpenSSH (`ssh`, `ssh-keygen`), and macOS or Linux.
Use an account-wide Machines credential from `qsp setup` (or `QSP_MACHINES_KEY`) with `machines:connect`,
`machines:read`, and `machines:resume`. Inference API keys are a different authority and do not work.
Do not put credentials into SSH config or ProxyCommand arguments.

```sh
qsp box ssh-config                  # all account machines
qsp box ssh-config my-machine       # name or machine ID
qsp box ssh my-machine              # setup and interactive login
ssh qsp-my-machine
ssh -L 3000:localhost:3000 qsp-my-machine
```

Setup creates `~/.ssh/qsp_ed25519` if missing, registers its public key for the
account, and updates marked machine blocks in `~/.ssh/config`. It preserves
unrelated config and also creates an ID alias (`qsp-<id>`). ID-shaped names
are reserved for machine IDs. Ambiguous normalized name aliases are omitted,
including across incremental setup; connect to those machines by ID. Install the CLI in a stable PATH visible to desktop apps.
For an existing account key, the transport also works with your own config:
`ProxyCommand qsp box ssh-proxy <id>` and `User user`.

VS Code / Cursor: Remote-SSH → Connect to Host. Zed: Remote Projects → Connect
via SSH. JetBrains Gateway: create an SSH connection from your SSH config.
Orca and desktop agents can use this host when they support OpenSSH
ProxyCommand; support is application dependent. The setup command must run on
the same computer as the editor's SSH client.

The proxy resumes paused machines and waits up to ten minutes, printing progress
only to stderr. Automatic resume uses credits. All stdout is raw SSH bytes.
The tunnel uses HTTPS/WebSocket; no public SSH port is required. Port forwarding,
SFTP, and editor installation use the normal SSH protocol.
Host keys are supplied through the authenticated control API and pinned to the
machine ID in `~/.ssh/qsp_known_hosts`; a cold boot may rotate them. Verification
stays strict. The proxy refreshes this pin before OpenSSH checks the remote key.

SSH traffic counts as idle activity. QSP does not generate SSH application keepalives; transport liveness uses WebSocket ping/pong. Editor or custom SSH keepalives count as traffic and can keep billing active until the session limit. Automatic editor reconnects can resume paused machines and start another billable session. An idle connection alone does not keep a
machine awake. SSH never acquires human control, and follows the same gate as
agent terminals: connections are refused/closed when human control is held.
Guest processes already started remain independent of the gate. Four SSH
connections per machine and existing account/IP/global stream limits apply.
Key removal stops new authentication, not existing SSH sessions. Retry a failed
key update to complete propagation to all machines; SSH tickets resync the current
account keys before allowing a connection.


## Machine cloning

Cloning copies both disks, including user-saved credentials, agent logins, SSH
keys, packages and repositories. Each duplicate receives its own machine identity
and QuickSilver AI key; share links and billing records start fresh. Processes
start fresh. A running source briefly pauses for a consistent disk copy, then
continues. Duplicates wait when running capacity is full; each counts toward your
account machine limit. A count can partially succeed: inspect both `machines` and
`error`. Reuse the reported request ID to recover an unknown or partial outcome;
use a fresh `--request-id` to intentionally create another identical batch.

Before first boot, the duplicate replaces the exact source managed inference key
in supported regular text files under `/home/user` and `/etc` (including agent
configs and env files). Files over 16 MiB, binary files, symlinks, transformed
keys and copies outside those trees remain your responsibility. The scan fails
closed at 512 MiB of supported text or 30 seconds. Excluded binary files do not
use the text budget. If a duplicate cannot start because of these scan limits,
delete it, reduce files on the source and duplicate again. This is not forensic
disk erasure.
