CLI Quick Start
Get started with OptixLog CLI in minutes.
First Command
Check that the CLI is installed:
optixlog --helpYou 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 commandInitialize 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.pyThe CLI will:
- Create a backup:
script_backup.py - Transform the code to include OptixLog
- 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.pyThe script will:
- Initialize OptixLog
- Run your code
- Log metrics and plots automatically
- Show colored output in terminal
View Results
List your runs:
optixlog runsOutput:
🔍 Fetching runs...
Found 1 runs:
✓ experiment
ID: run_abc123
Project: MyProject
Created: 2025-11-24T10:30:00ZView results in the web dashboard: https://optixlog.com
Smart Mode
Use --smart flag for better code generation:
optixlog add-logging script.py --smartSmart mode:
- Uses SDK helper methods (
log_matplotlib()) - Wraps code in context manager
- Adds helpful comments
- Works locally (no backend needed)
Next Steps
- Commands Reference - Learn all CLI commands
- Examples - See more transformation examples
- Advanced Usage - Batch processing, CI/CD