CLI login
Authenticate the SDK with the device-code flow instead of copying API keys by hand.
Use instantml login on any machine with a browser so scripts can run without pasting API keys.
Log in, check, and log out
Authenticate:
instantml loginPrint the current credential context:
instantml whoamiRemove stored credentials:
instantml logoutinstantml login runs an OAuth 2.0 device-code flow: it prints a code, opens the browser confirmation page, and stores the resulting credential in ~/.instantml/credentials.
The stored credential carries the sdk:ingest, artifacts:write, imports:write, and export:read scopes. That covers run creation, metric logging, file and checkpoint uploads, imports, and reads or exports. Create a key from the dashboard only when a job needs additional scopes such as artifacts:manage or runs:control β see API-key scopes.
Understand credential resolution
im.init(...) resolves credentials in this order:
- Explicit
api_key=.... INSTANTML_API_KEY.- CLI-stored credentials from
instantml login. - No credentials β top-level
im.init(...)raisesInstantMLErrorbefore it creates a run.
import instantml as im
# Explicit key
run = im.init(project="cartpole", api_key="instantml_...")
# Environment key (INSTANTML_API_KEY is set)
run = im.init(project="cartpole")
# After `instantml login`
run = im.init(project="cartpole")Confirm in the browser
The device-code confirmation page formats codes as XXXX-XXXX, requires a browser session, and tells you when the terminal can continue.
Next steps
- Install and authenticate the SDK β API keys and scopes
- Quickstart β log your first run
- SDK logging β create runs and log metrics
- Manage API keys in the dashboard