doushi.aiAI Builder
API & Developer Tools 3 min read

Official Python CLI Guide (doushi-cli)

Complete CLI reference for doushi-cli on PyPI, installing via pip/pipx, headless training, running batch predictions, and automating machine learning workflows.

Package: doushi-cli on PyPI
Source Code: GitHub (@doushi-ai/doushi-cli)
Requirements: Python 3.9 or higher

The doushi-cli is the official command-line interface for the Doushi platform. It enables engineers and MLOps teams to train models, run batch scoring, and export Python pipeline code directly from bash scripts and CI/CD pipelines.


Installation

Via Pip

pip install doushi-cli

Via Pipx (Isolated execution without virtualenv)

pipx run doushi demo

Verification

doushi --version
# Output: doushi-cli v1.0.4

Authentication

Set your API key as an environment variable:

export DOUSHI_API_KEY="dsh_live_xxxxxxxxxxxxxxxxxxxxxxxx"

Or configure it interactively:

doushi configure
# Prompt: Enter your Doushi API Key: [hidden input]
# Success: Credentials saved to ~/.doushi/credentials

Command Reference

doushi demo

Launches an instant autonomous ML training demo in your terminal using a bundled customer churn dataset:

doushi demo

Options:

  • --save-local: Save the demo CSV to your current working directory as sample_customer_churn.csv.

doushi train

Submits a dataset for automated cleaning, feature engineering, and training:

doushi train path/to/dataset.csv \
  --goal "Maximize recall for high-value accounts while keeping precision > 80%" \
  --name "Customer Churn Model" \
  --output ./model_summary.json

(Alias: doushi create)

Arguments:

  • dataset_file (Positional, Required): Path to local CSV, Excel (.xlsx), Parquet, TSV, or JSON file.
  • --goal, -g (Optional): Plain-English objective describing the target column and any business constraints or trade-offs.
  • --name, -n (Optional): Custom project name (defaults to dataset filename).
  • --follow / --no-follow, -f / -F (Optional, default: follow): Stream agent execution and self-healing logs until training completes.
  • --output, -o (Optional): Path to save output JSON build result file.
  • --json (Optional): Output project details as raw JSON (to stdout or file).

doushi predict

Runs inference against a deployed model using a batch file, inline JSON, or piped stdin:

# Predict from a batch file (CSV, Parquet, Excel, JSON)
doushi predict <YOUR_PROJECT_ID> \
  --file ./new_leads.parquet \
  --output ./scored_leads.csv

# Predict from inline JSON
doushi predict <YOUR_PROJECT_ID> \
  --data '{"monthly_spend": 94.20, "tenure_months": 16}'

# Pipe from stdin
cat test_data.csv | doushi predict <YOUR_PROJECT_ID>

[!NOTE] <YOUR_PROJECT_ID> is a placeholder value representing your unique project ID (e.g. c7b39a4f-1234-4567-89ab-cdef01234567 or proj_12345).

Arguments:

  • project_id (Positional, Required): Unique ID of the project to query.
  • --file, -f (Optional): Path to dataset with feature columns (.csv, .parquet, .xlsx, .json).
  • --data, -d (Optional): Raw JSON string of feature inputs.
  • --output, -o (Optional): Output destination file (.csv or .json).
  • --json (Optional): Output predictions as raw JSON to stdout.

doushi export

Downloads the complete standalone Python pipeline, trained model weights, and FastAPI microservice:

doushi export <YOUR_PROJECT_ID> --out ./doushi-model-bundle

Arguments:

  • project_id (Positional, Required): Unique ID of the project to export.
  • --out, -o (Optional, default: ./doushi-model-bundle): Directory where export artifacts will be saved.

This generates:

  • model.pkl: Serialized champion model weights and Scikit-Learn preprocessing pipeline (joblib / cloudpickle).
  • pipeline.py: Auto-generated standalone Python script to reproduce and train the model from scratch.
  • serve.py: Production FastAPI REST microservice ready to serve local or cloud inference.
  • Dockerfile: Production container build file for isolated deployment.
  • requirements.txt: Audited Python dependencies.
  • metadata.json: Full project training configuration, schema details, and evaluation metrics.
  • README.md: Step-by-step local execution and deployment instructions.

Using in Docker / Airflow / GitHub Actions

doushi-cli runs cleanly in non-interactive environments:

docker run --rm \
  -e DOUSHI_API_KEY="$DOUSHI_API_KEY" \
  -v $(pwd)/data:/data \
  python:3.11-slim \
  bash -c "pip install -q doushi-cli && doushi train /data/customers.csv --goal 'Predict customer churn'"
← Previous TopicREST API ReferenceNext Topic →Supported Data Formats & Schemas
Need help with your dataset or API integration?