Spectral CLI


The Spectral Command-Line Interface (CLI) provides a text-based interface, allowing Modelers to interact with Spectral directly from the command line. This approach streamlines data fetching and submission tasks.

Spectral CLI natively handles all interactions with Spectral's infrastructure (smart contracts and IPFS) in order to:

  • download training dataset from IPFS,

  • generate all necessary artifacts for zkML operations from a machine learning model's ONNX file,

  • commit to using a machine learning model through generating all the required artifacts for zkML operations based on a final model's ONNX file (aka. ML model commitment),

  • upload ML model commitment to IPFS and smart contracts,

  • download testing dataset from IPFS,

  • make a submission by uploading the CSV file containing the inferences generated by the Modeler's machine learning model to IPFS and smart contracts.

All operations will be performed on the Modeler's local machine before being uploaded to IPFS or smart contracts.

Ensure your Python version is at least 3.11.6 and your pip is up to date.

pip install spectral-cli

Installs the Spectral CLI.


Submits a model commitment given two files (onnx and json) to a specific challenge. See Step 6.

spectral-cli commit-local MODEL_PATH INPUT_JSON_PATH

Generates a json file that enables one to follow the optional Discord instructions from Step 6.

spectral-cli configure

Configures your Spectral CLI and generates a Spectral CLI wallet. See Step 5.

spectral-cli fetch-testing-data CHALLENGE_ID

Fetches testing data for a specific challenge. See Step 7.

spectral-cli fetch-training-data CHALLENGE_ID

Fetches training data for a specific challenge. See Step 3.

spectral-cli list-challenges

Lists the CHALLENGE_ID for each Challenge.

spectral-cli show-configuration

Returns multisig wallet address (which is generated after first part of Step 6), your Spectral API key, your Alchemy API key, your Spectral CLI wallet address, and your Spectral CLI wallet's private key (only available to you on your local machine). Except the multisig wallet address, the rest should have values after Step 5.

spectral-cli show-wallet

Returns your Spectral CLI wallet address.

spectral-cli submit-inferences CHALLENGE_ID SUBMISSION_FILE

Makes the final submission for a specific challenge.

Last updated