Skip to content

CLI Reference

Every command, argument and option of the qubithub CLI in 0.2.4, generated from the CLI itself, with each example run once. For a guided start, see the CLI / SDK Quickstart.

Terminal window
pip install --upgrade qubithub==0.2.4
qubithub --version # qubithub 0.2.4

Global options go before the command: qubithub --format json runs list.

OptionTypeDefaultDescription
--versionflag—Show the installed qubithub version and exit.
--base-urlstrhttps://qubithub.co/apiAPI base URL
--api-keystr—Git only: qubithub clone passes it to git. Never sent to the API. (hidden from --help)
--tokenstr—JWT access token (the access_token that login returns; see Authentication). It is not renewed: when it expires, run qubithub login
--format, -fstrrichOutput format: rich | json

Environment variables: QUBITHUB_API_URL (same as --base-url), QUBITHUB_TOKEN (same as --token) and QUBITHUB_API_KEY (the hidden --api-key, which qubithub clone uses for git only; it is never sent to the API).

Log in with your email or username and password, or a JWT token.

qubithub login [OPTIONS]
OptionTypeDefaultDescription
--email, --usernamestr—Email address or username
--passwordstr—Password
--api-keystr—Refused with an error: API keys authenticate git only, not the API. (hidden from --help)
--tokenstr—JWT access token to store instead of signing in. It is not renewed: when it expires, run qubithub login

Signs in with your email or username and your password, and stores the tokens in ~/.qubithub/config.toml. If you omit the flags it prompts for them (“Email or username”, then the password, hidden). --token stores a JWT access token you already have instead (see Authentication).

Access tokens expire after 15 minutes. After an email-and-password login, the CLI renews the access token itself with the stored refresh token (valid for 30 days). A token passed with --token or QUBITHUB_TOKEN is not renewed. When a command fails with 401, run qubithub login again.

Log out and clear stored credentials.

qubithub logout

Revokes the session on the server and deletes the stored credentials. The file is cleared even when the server cannot be reached; the CLI then warns that the session ends when it expires.

Show current authenticated user.

qubithub whoami

Clone a circuit. Uses git when available; falls back to HTTP otherwise.

qubithub clone <repo_name> [directory] [OPTIONS]
ArgumentRequiredDescription
repo_nameyesRepository name (e.g., qubithub/bell-state)
directorynoTarget directory (default: circuit name)
OptionTypeDefaultDescription
--no-gitflag—Skip git, fall back to HTTP file download (no .git/, no history).
--git-base-urlstr—Override the web origin for the git clone URL. Also read from QUBITHUB_WEB_URL.

Uses git when it is installed and the server offers git for the circuit, so you get the full history. Otherwise, or with --no-git, it downloads the files over HTTP into a flat directory with no .git/. The target directory must be empty or missing.

Execute a circuit and display results.

qubithub execute <repo_name> [OPTIONS]
ArgumentRequiredDescription
repo_nameyesRepository name (e.g., QubitHub/bell-state)
OptionTypeDefaultDescription
--frameworkstr—Framework (qiskit, cirq, pennylane). Sets the default backend
--backendstr—Backend name (overrides —framework default)
--backend-typestrsimulationBackend type: simulation, emulation or hardware. Only simulation runs as named: emulation runs as a simulation, and hardware fails
--shotsint1024Number of shots (1 to 100,000). A PennyLane circuit samples with the shots it sets itself
--watch, -wflag—Poll until the run ends (up to 3 minutes). Exits 1 if it failed or was cancelled, 124 if it is still running when polling stops

Resolves owner/name, submits a run and prints the result. Every run today is on a simulator.

  • --framework picks the default backend: qiskit → qiskit_aer, cirq → cirq_simulator, pennylane → pennylane_default. Without it the backend is qiskit_aer. --backend overrides both. For a Qiskit circuit, a --backend name the server does not recognise falls back to the Aer simulator (AerSimulator).
  • --backend-type: only simulation works as named. hardware fails with “Hardware execution not yet implemented”. emulation is accepted but currently runs as a simulation.
  • Limits: up to 24 qubits on the simulator, and 1 to 100,000 shots. Above 20 qubits, set qubits in qubithub.toml to the circuit’s real count. One run above 20 qubits runs at a time; another is refused until it ends.
  • Quota: each run counts against your run quota (Free tier during beta: 100 runs per rolling 30 days). See Runs limit exceeded.
  • --watch polls every 2 seconds for up to 3 minutes, then stops and tells you, on stderr, to check later with qubithub runs info <run-id>. The run keeps going on the server.
  • Exit status: 0 when the run completed, or was submitted without --watch and is still pending. 1 when the run it reports failed or was cancelled, with or without --watch, or when the command itself fails. 124 when --watch stops polling before the run ends. A script can tell a failed run from a passed one.
  • PennyLane: --shots is ignored. Sampling follows the shots the circuit sets itself, on the QNode (@qml.qnode(dev, shots=1024), as the init template does) or on the device (deprecated since PennyLane 0.43). With no shots, measurements such as qml.expval(), qml.probs() or qml.state() return exact (analytic) values, and sample-only measurements such as qml.counts() or qml.sample() fail, so set shots for those.
  • What the result shows: a run’s measurement counts as a histogram, with percentages of the shots counted. A PennyLane qml.counts() result is plotted the same way. Any other value a PennyLane circuit returns (a number, a vector, a dict) is printed under Returned value: a number to six significant digits (and in full precision when that differs), anything else as JSON. In the stored run that value is results.pennylane_result, and results.counts is empty.
  • In JSON mode the final run is one JSON object on stdout, and the polling lines and the timeout notice go to stderr, so qubithub --format json execute … --watch | jq works.

List public circuits.

qubithub circuits list [OPTIONS]
OptionTypeDefaultDescription
--frameworkstr—Filter by framework (qiskit, cirq, pennylane)
--tagstr—Filter by tag
--sortstrcreated_atSort field (created_at, stars_count, name)
--limitint20Results per page
--pageint1Page number

Lists public circuits.

Show detailed circuit information.

qubithub circuits info <repo_name>
ArgumentRequiredDescription
repo_nameyesRepository name (e.g., QubitHub/bell-state)

Fork a circuit to your account.

qubithub circuits fork <repo_name> [OPTIONS]
ArgumentRequiredDescription
repo_nameyesRepository name to fork
OptionTypeDefaultDescription
--namestr—Custom name for the forked circuit

Push a local circuit directory to QubitHub.

qubithub circuits push [directory] [OPTIONS]
ArgumentRequiredDescription
directorynoCircuit directory to push (default: the current directory)
OptionTypeDefaultDescription
--namestr—Circuit name (default: name in qubithub.toml, else in metadata.json)
-m, --messagestr—Commit message
--createflag—Create the circuit if it doesn’t exist

Uploads the circuit to your account (<your-username>/<name>). It is an HTTP upload, not git push.

  • Only files ending in .py, .json, .qasm, .qpy or .toml are uploaded.
  • README.md is not uploaded. With --create, its first 2,000 characters become the circuit’s description, once. Later edits to README.md are not pushed.
  • --create registers a new circuit on its first push.

Scaffold a new circuit directory with template files.

qubithub circuits init <name> [directory] [OPTIONS]
ArgumentRequiredDescription
nameyesCircuit name (e.g., my-circuit)
directorynoDirectory to create (default: ./)
OptionTypeDefaultDescription
--frameworkstrqiskitFramework (qiskit, cirq, pennylane)
--qubitsint2Number of qubits
--titlestr—Display title
  • Creates README.md, circuit.py, qubithub.toml and .gitignore. The README’s run line names --framework, which execute needs to pick the right backend.
  • QubitHub runs whatever is bound to circuit (or qc, or a main() function).
  • Every template runs as generated. The Qiskit and Cirq templates end with circuit = create_circuit(). The PennyLane QNode sets its own shots, @qml.qnode(dev, shots=1024), and returns qml.counts(); running it locally needs PennyLane 0.43 or later.

Show parsed circuit metadata from qubithub.toml.

qubithub circuits metadata [directory] [OPTIONS]
ArgumentRequiredDescription
directorynoCircuit directory (default: the current directory)
OptionTypeDefaultDescription
--format, -fstrjsonOutput format: json or toml

Clone a circuit via HTTP file download (legacy, no git).

qubithub circuits clone <repo_name> [directory]
ArgumentRequiredDescription
repo_nameyesRepository name (e.g., QubitHub/bell-state)
directorynoTarget directory (default: circuit name)

Legacy HTTP download, hidden from --help. Use qubithub clone (it prefers git).

List your runs.

qubithub runs list [OPTIONS]
OptionTypeDefaultDescription
--circuit-idstr—Filter by circuit ID: the id field of qubithub --format json circuits info owner/name
--statusstr—Filter by status
--limitint20Results per page
--pageint1Page number

Show run details and results.

qubithub runs info <run_id>
ArgumentRequiredDescription
run_idyesRun UUID

Shows the result the way execute does: counts as a histogram, or a PennyLane circuit’s returned value. For a failed run it prints the error as the run recorded it.

Cancel a pending or running run, or delete a finished run’s record.

qubithub runs cancel <run_id>
ArgumentRequiredDescription
run_idyesRun UUID

Cancels a pending or running run. On a run that has already finished (completed, failed or cancelled), it deletes the run’s record instead.

Show your run statistics.

qubithub runs stats

Create a new API key.

qubithub keys create <name> [OPTIONS]
ArgumentRequiredDescription
nameyesKey name
OptionTypeDefaultDescription
--scopesstrcircuit:readComma-separated scopes. Recorded on the key but not enforced yet: a key can clone and push every circuit you own

Creates an API key and prints it once. Store it straight away.

Scopes are recorded on the key but not enforced today: git access follows ownership, so a personal key can clone and push every circuit you own, whatever its scopes (see Git authentication).

API keys authenticate git over HTTPS (clone and push) only; no API route accepts them yet (see Git authentication). The CLI sets no expiry: to create a key that expires, use the SDK (APIKeyCreateRequest(..., expires_in_days=90), see the SDK reference).

List your API keys.

qubithub keys list

Revoke an API key.

qubithub keys revoke <key_id>
ArgumentRequiredDescription
key_idyesAPI key UUID

Set a CLI default value.

qubithub config set <key> <value>
ArgumentRequiredDescription
keyyesConfig key
valueyesConfig value

Stores a value in ~/.qubithub/config.toml. Known keys: default_framework, default_backend, default_shots, default_format, default_base_url.

Get a CLI default value.

qubithub config get <key>
ArgumentRequiredDescription
keyyesConfig key

List all CLI defaults.

qubithub config list

Remove a CLI default value.

qubithub config unset <key>
ArgumentRequiredDescription
keyyesConfig key to remove

Need help? See Troubleshooting or email [email protected].