Quickstart — Live Server
Run the full login → init → generate loop against a running OptixLog server with a real API key.
This guide runs the same login → init → generate loop as the offline quickstart, but connects to a live OptixLog server and writes real data.
Prerequisites
- A
sk-opt-API key for your organization. - Network access to
https://optixlog.leidos.com(or your organization's server URL).
Steps
Install the package
pip install optixlogLog in
optixlog login --api-key sk-opt-xxxxOmit --api-key to be prompted interactively. The command calls the server's whoami endpoint to validate your key, then saves credentials to ~/.optixlog/credentials.toml.
To target a non-default server:
optixlog login --api-key sk-opt-xxxx --base-url https://your-server.example.comInitialize the project config
optixlog init --all--all selects every project your key can access. This writes optixlog.toml in your current directory. To select specific projects instead:
optixlog init --project proj_grating_7f3a --project proj_modulator_22b1Or by name:
optixlog init --project "Grating Coupler Lab"Generate typed bindings
optixlog generateoptixlog generate walks up from your current directory to find optixlog.toml, fetches schemas from the server, and writes optixlog_gen.py. The output is byte-deterministic and safe to commit.
Use the generated client
from optixlog_gen import OptixClient, Projects, SimulationNode
client = OptixClient() # picks up credentials from optixlog login
result = client.project(Projects.GRATING_COUPLER_LAB).ingest(
data=SimulationNode(config={"mesh": "fine"}, solver="fdtd", wavelength_nm=1550.0),
prompt="Simulated a grating coupler with fine mesh.",
)
print(f"Node ID: {result.node_id}")
print(f"Created: {result.created}")Keeping bindings up to date
Re-run optixlog generate after your organization's schema changes. Use optixlog generate --check in CI to detect when the committed bindings are stale.
Passing credentials programmatically
If you prefer not to use stored credentials, pass them directly to OptixClient:
client = OptixClient(
base_url="https://optixlog.leidos.com",
api_key="sk-opt-xxxx",
)Or set environment variables before running your code:
export OPTIXLOG_API_KEY=sk-opt-xxxx
python run.py