Skip to Content
CLICLI Quick Start

CLI Quick Start

Get started with OptixLog CLI in minutes.

First Command

Check that the CLI is installed:

optixlog --help

You should see:

Usage: optixlog [options] [command] OptixLog CLI - Experiment tracking Options: -V, --version output the version number -h, --help display help for command Commands: init Initialize OptixLog configuration config Manage OptixLog configuration add-logging Auto-instrument Python code with OptixLog runs List recent runs check-sdk Check if OptixLog SDK is installed install-sdk Install OptixLog SDK help [command] display help for command

Initialize Configuration

Set up your OptixLog configuration:

optixlog init --project "MyProject" --api-key "proj_YOUR_KEY"

This creates a .optixlog.json file in your current directory (or home directory) with:

{ "api_key": "proj_YOUR_KEY", "api_url": "https://backend.optixlog.com", "project": "MyProject" }

Get your API key: https://optixlog.com 

Your First Transformation

Create a simple Python script:

# script.py import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 10, 100) y = np.sin(x) plt.plot(x, y) plt.title("Sine Wave") plt.savefig("plot.png")

Add OptixLog logging:

optixlog add-logging script.py

The CLI will:

  1. Create a backup: script_backup.py
  2. Transform the code to include OptixLog
  3. Show you what was added

Transformed code:

import optixlog import os import numpy as np import matplotlib.pyplot as plt # Initialize OptixLog with optixlog.run( run_name="experiment", api_key=os.getenv("OPTIX_API_KEY"), project=os.getenv("OPTIX_PROJECT", "MyProject"), config={}, create_project_if_not_exists=True ) as client: x = np.linspace(0, 10, 100) y = np.sin(x) plt.plot(x, y) plt.title("Sine Wave") # Log the plot fig = plt.gcf() client.log_matplotlib("plot", fig) plt.savefig("plot.png")

Run Your Code

Execute the instrumented script:

python script.py

The script will:

  1. Initialize OptixLog
  2. Run your code
  3. Log metrics and plots automatically
  4. Show colored output in terminal

View Results

List your runs:

optixlog runs

Output:

🔍 Fetching runs... Found 1 runs: ✓ experiment ID: run_abc123 Project: MyProject Created: 2025-11-24T10:30:00Z

View results in the web dashboard: https://optixlog.com 

Smart Mode

Use --smart flag for better code generation:

optixlog add-logging script.py --smart

Smart mode:

  • Uses SDK helper methods (log_matplotlib())
  • Wraps code in context manager
  • Adds helpful comments
  • Works locally (no backend needed)

Next Steps