tj login to authorize your terminal in the browser. Your Python code can
then use Client() without copying a key into a script or a coding-agent prompt.
Sign in
tj init later. Setup can open Claude Code, Codex, or Gemini CLI in your
project with the integration instructions and this login profile. See
assistant setup.
--timeout sets a shorter wait. An expired login needs a new code. If the CLI reports an
uncertain redemption after losing its connection, review and revoke the new CLI key in
Settings → API keys before trying again.
Organization profiles
Create a named profile when authorizing another organization or API:--profile work on a command or set TRAJECTORY_PROFILE=work to select it without
changing the saved default. Python also accepts Client(profile="work").
whoami verifies the credential and reports its organization and source.
A saved profile belongs to one API origin. Selecting another --base-url cannot send
that saved credential to the new destination. An explicitly selected profile with a
mismatched origin returns an error.
API keys and automated jobs
For CI or another unattended environment, supply an API key from Settings → API keys through your environment’s secret management:Client(api_key=...), then TRAJECTORY_API_KEY,
then the selected saved profile. An environment key continues to take precedence after
switching profiles. The CLI never prints the credential.
Client() sends the key as X-API-Key. Without a saved profile or explicit destination,
the API is https://api.trajectory.ai. Set TRAJECTORY_BASE_URL or pass base_url for
another destination.
Saved login files live under $XDG_CONFIG_HOME/trajectory, or ~/.config/trajectory.
Set TRAJECTORY_CONFIG_HOME to choose the directory directly. Keep that directory private
and outside your project; it contains credentials. On POSIX systems, the directory has
mode 700 and credential files have mode 600.
Sign out
Managed spec (benchmark) sessions
A spec task receivesTRAJECTORY_API_KEY. Use Client() normally.
trajectories.create() returns the run’s trajectory ID; pass that ID to model, reward, and
completion calls. The Backend resolves the model endpoint. See Bring your
spec. Production traces use the organization
API key throughout their lifecycle.