Skip to main content

Moss CLI

Command-line interface for Moss semantic search — manage indexes, documents, and queries directly from your terminal.

Moss CLI wraps the Moss Python SDK so you can build and query semantic search indexes without writing any code. Ideal for quick prototyping, scripting, CI/CD pipelines, and data workflows.

Features

  • Full SDK coverage — every SDK operation available as a CLI command
  • Semantic search — query indexes with configurable hybrid search (semantic + keyword)
  • Index management — create, list, inspect, and delete indexes
  • Document management — add, update, retrieve, and delete documents
  • Local by default — downloads indexes and queries them on-device
  • Flexible auth — CLI flags, environment variables, or config file
  • Log in from the terminal — moss login, then create project keys with moss keys create
  • Multiple output formats — rich tables for humans, --json for scripts
  • Job tracking — poll background jobs with live progress display
  • Pipe-friendly — stdin/stdout support for composing with other tools

Installation

pip install moss-cli

Quick Start

# 1. Save your credentials
moss init

# 2. List your indexes
moss index list

# 3. Create an index from a JSON file
moss index create my-index -f docs.json --wait

# 4. Search it
moss query my-index "what is machine learning"

Authentication

Credentials are resolved in this order:

  1. CLI flags: --project-id and --project-key
  2. Environment variables: MOSS_PROJECT_ID and MOSS_PROJECT_KEY
  3. Config file: ~/.moss/config.json (created by moss init)
# Option 1: Interactive setup (recommended)
moss init

# Option 2: Environment variables
export MOSS_PROJECT_ID="your-project-id"
export MOSS_PROJECT_KEY="your-project-key"

# Option 3: Inline flags
moss --project-id "..." --project-key "..." index list

With none of these, moss index, moss doc and moss query run in offline mode.

Offline mode

With no credentials, or with --offline, moss index, moss doc and moss query keep one index in ~/.moss/offline. Bring your own embeddings: every document needs an embedding, and moss query --embedding takes the query vector. Without it, only keywords rank.

moss index create notes -f docs-with-embeddings.json
moss query notes "billing" --embedding query-vector.json
moss doc add notes -f more.json
moss index delete notes

The index opens only for the OS user and device that created it, and in one process at a time. Each command that opens it sends anonymous usage counts: a random device id kept in ~/.moss/.moss-device-id, a session id, the CLI version, and how many documents and queries the index had. Nothing from the index leaves your device: no names, documents, queries or vectors. A count that cannot be sent is dropped and never fails a command. If it no longer opens, because it was copied, moved, restored from a backup or damaged, moss index create replaces it and moss index delete removes it. It does not run on Kubernetes, AWS Lambda or other server platforms. The built-in models, more indexes and sync need an account. Once you have one, moss index push uploads the index to your project with its embeddings:

moss login
moss keys create --project <project-id>   # export the MOSS_PROJECT_ID / MOSS_PROJECT_KEY it prints
moss index push notes --wait   # --as <name> gives the cloud index another name

In CI, where CI is set, missing credentials are an error, so a job whose secrets are unset fails instead of building an offline index. Pass --offline or set MOSS_OFFLINE=1 to use it there.

Log in and create keys

moss login connects the CLI to your Moss account, so you can create project keys without opening the dashboard.

# Opens the browser. Check the code matches, then click Approve.
moss login

moss whoami
moss projects list

# Prints the key once, plus MOSS_PROJECT_ID / MOSS_PROJECT_KEY lines
moss keys create --project <project-id> --name "prod server"
moss keys list --project <project-id>
moss keys delete --project <project-id> <key-id>

# Revoke the token and remove it from ~/.moss/config.json
moss logout

The token is saved to ~/.moss/config.json. It lives until you run moss logout or revoke it in Settings > API Keys. It acts as you: only workspace owners, admins and a project's owner can create or delete its keys. --project defaults to the project saved by moss init.

Use moss login --no-browser on a machine without a browser (for example over SSH) and open the printed link anywhere.

Agents and CI

CI that only queries or uploads to one project needs a project key, not a login. Create one with moss keys create and store it as MOSS_PROJECT_ID / MOSS_PROJECT_KEY.

Agents that create or delete keys need a CLI token. Make a separate one for each agent, so logging in or out on your machine doesn't break it:

# Approve in the browser; the token is printed, not saved
moss login --print-token --name "deploy agent"

Store it as MOSS_TOKEN in your secret store, then:

export MOSS_TOKEN="mossc_..."
moss keys create --project <project-id> --json
# {"project_id": "...", "key_id": "...", "secret": "moss_..."}

The token acts as you, so it loses access to a workspace when you do. Revoke it in Settings > API Keys.

The token is resolved from --token, then MOSS_TOKEN, then the config file. The saved token is only sent to the dashboard that issued it, so with --api-url pointing elsewhere, log in there or pass --token. A --token or MOSS_TOKEN goes to production unless --api-url / MOSS_API_URL says otherwise.

Commands

Index Management

# Create an index with documents from a JSON file
moss index create my-index -f documents.json --model moss-minilm

# Create and wait for completion
moss index create my-index -f documents.json --wait

# List all indexes
moss index list

# Get index details
moss index get my-index

# Delete an index
moss index delete my-index
moss index delete my-index --confirm  # skip prompt

# Upload the index on this device to your project
moss index push my-index --wait

Document Management

# Add documents to an existing index
moss doc add my-index -f new-docs.json

# Add with upsert (update existing, insert new)
moss doc add my-index -f docs.json --upsert --wait

# Get all documents
moss doc get my-index

# Get specific documents
moss doc get my-index --ids doc1,doc2,doc3

# Delete documents
moss doc delete my-index --ids doc1,doc2

Query

# Search on this device (with an account, the index downloads first)
moss query my-index "what is deep learning"

# Tune results: more results, keyword-heavy
moss query my-index "neural networks" --top-k 20 --alpha 0.3

# With metadata filter (local only)
moss query my-index "shoes" --filter '{"field": "category", "condition": {"$eq": "footwear"}}'

# With your own query vector, for a custom-model index: a JSON array or a file path
moss query my-index "shoes" --embedding query-vector.json

# Pipe query from stdin
echo "what is AI" | moss query my-index

# JSON output for scripting
moss --json query my-index "query" | jq '.docs[0].text'

Job Tracking

# Check job status
moss job status <job-id>

# Wait for job to finish (with live progress)
moss job status <job-id> --wait

Other

# Print version info
moss version

# Global JSON output, before the command
moss --json index list
moss --json doc get my-index

Document File Format

[
  {"id": "doc1", "text": "Machine learning fundamentals", "metadata": {"topic": "ml"}},
  {"id": "doc2", "text": "Deep learning with neural networks"},
  {"id": "doc3", "text": "Natural language processing", "metadata": {"topic": "nlp"}}
]

Also supports a wrapper format: {"documents": [...]}.

With your own embeddings, each document carries an embedding of the same length:

[{"id": "doc1", "text": "Machine learning fundamentals", "embedding": [0.12, -0.03, 0.41]}]

CSV

id,text,metadata
doc1,Machine learning fundamentals,"{""topic"": ""ml""}"
doc2,Deep learning with neural networks,
doc3,Natural language processing,"{""topic"": ""nlp""}"

stdin

cat docs.json | moss index create my-index -f -
cat docs.json | moss doc add my-index -f -

Global Options

Flag Short Description
--project-id -p Project ID (overrides env/config)
--project-key Project key (overrides env/config)
--token CLI token from moss login (or MOSS_TOKEN)
--api-url Dashboard URL, for staging or local testing (or MOSS_API_URL)
--json Machine-readable JSON output
--offline Use the offline index, even with credentials or in CI (or MOSS_OFFLINE)
--verbose -v Enable debug logging

Available Models

Model Description
moss-minilm Lightweight, optimized for speed (default)
moss-mediumlm Balanced accuracy and performance
custom Used automatically when documents include embeddings

License

Copyright (c) 2026 InferEdge Inc. — PolyForm Shield License 1.0.0.

See LICENSE for full terms. For commercial licensing, contact contact@moss.dev.

Metadata

Release files for moss-cli 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for moss-cli 0.4.0
File Actions
moss_cli-0.4.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for moss_cli-0.4.0-cp310-abi3-win_amd64.whl
moss_cli-0.4.0-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for moss_cli-0.4.0-cp310-abi3-manylinux_2_28_x86_64.whl
moss_cli-0.4.0-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for moss_cli-0.4.0-cp310-abi3-manylinux_2_28_aarch64.whl
moss_cli-0.4.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for moss_cli-0.4.0-cp310-abi3-macosx_11_0_arm64.whl

Total release size: 7.8 MB

Release files / moss_cli-0.4.0-cp310-abi3-win_amd64.whl

Download URL moss_cli-0.4.0-cp310-abi3-win_amd64.whl
Size 2.1 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b704907d88a4b93a07aac3f1510644a34b17bb3e8743fe1cef350602b6a32401
BLAKE2b-256 checksum
How to use checksums
a457640a3353d3a0d611a782d64e25d2034543c424da19416fc596e49f2c9b22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Release files / moss_cli-0.4.0-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL moss_cli-0.4.0-cp310-abi3-manylinux_2_28_x86_64.whl
Size 2.2 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
db435370eeca6fc91c40c4c343a9f8352a6210c407d8bc6f023c91b6364c3c57
BLAKE2b-256 checksum
How to use checksums
87ee6d10f7108c752972a11a82fba084e2c3e3b89ddd4dc429faca3aa51e2d5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Release files / moss_cli-0.4.0-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL moss_cli-0.4.0-cp310-abi3-manylinux_2_28_aarch64.whl
Size 2.1 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
7ee5d0f4a3ae2c9a5ff57b5cb46278413fa818aea4b6d7da29dc624f5ec57571
BLAKE2b-256 checksum
How to use checksums
61957aff110e3a11c61a9a51c3cd1a34d35ea0bb0d245f794cb9ac1a9a99edf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Release files / moss_cli-0.4.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL moss_cli-0.4.0-cp310-abi3-macosx_11_0_arm64.whl
Size 1.4 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2efb0d8637fcee9589b78c70f4dc32499ee77149244510b24a69e618d9f2f2fd
BLAKE2b-256 checksum
How to use checksums
39897ef8f57edb568c0d7ddcf8b31091e5bda6452c3a5b0dd11494099932a05b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Security for moss-cli 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page