Skip to content
NewNexus 2.0 is here, and it’s open source. Read the launch post

Getting started

Authentication

Sign in to Nexus UI with Google or email, sign the CLI in with a one-time code, and use API keys in CI and scripts.

View as Markdown

Everything you do in Nexus is done as you, in one organization, with your role there. Nexus UI, the CLI and the API use the same credentials underneath: a personal Nexus token.

CredentialHow you get itLifetimeUsed by
Nexus UI sessionSign in to Nexus UI12 hoursNexus UI in your browser
CLI tokennexus auth login90 days, revocableThe nexus CLI on one machine
API keynexus auth tokens create, Nexus UI → Settings → Keys, or POST /v1/auth/tokensUntil revokedCI, scripts, your own code
Service account keynexus service-accounts keys create (owners and admins)90 days by default, never past its accountCI and scripts that act for no person

Personal tokens start with nx_, and service account keys start with nxsa_. An agent you link to act for you gets its own key (nxo_…); you see and revoke it under Settings → Keys. Products running on Nexus get their own short-lived scoped keys (nxs_…) that can only call models and connectors; you never handle those.

Nexus UI: sign in with Google or email

Open Nexus UI and sign in with your Google account, or with your email. Your first sign-in creates your personal organization. You can also create an organization for your company, or open one you were invited to. Whoever creates an organization is its owner.

The CLI: a one-time code

nexus auth login
  1. The CLI asks Gateway for a one-time code (POST /v1/auth/device) and opens Nexus UI's approval page. Use --no-browser to only print the link, for example over SSH.
  2. You check that the code matches and approve it for the organization selected in Nexus UI.
  3. The CLI, polling POST /v1/auth/token, receives a CLI token and saves it.

Codes last ten minutes and work once. The token is saved in ~/.nexus/factory/config.json, readable by you only (NEXUS_CONFIG moves it). --url signs in to another Nexus Gateway.

nexus auth status    # organization, user, role, Gateway URL, token (masked), and whether Gateway accepts it
nexus auth logout    # revokes the token on Gateway and forgets it

API keys

Create an API key with the CLI, signed in as yourself:

nexus auth tokens create --label "CI deploys"

The key is shown once. It belongs to you and acts with your role: if you are a member, so is the key. List and revoke your keys with the CLI. Owners and admins see and revoke everyone's (--all).

nexus auth tokens            # your API keys and CLI sign-ins, with their ids
nexus auth tokens revoke <id>

Nexus UI does the same under Settings → Keys. The API is POST /v1/auth/tokens, GET /v1/auth/tokens and DELETE /v1/auth/tokens/{id}.

In CI: --with-token

echo "$NEXUS_API_KEY" | nexus auth login --with-token

The CLI reads the key from stdin, so it never appears in your shell history or the process list. nexus auth logout then only forgets the key; revoke it with nexus auth tokens revoke <id> when you no longer need it.

Calling the API

Send your token as a bearer token:

curl "$NEXUS_URL/v1/tenants/me" -H "Authorization: Bearer $NEXUS_API_KEY"

$NEXUS_URL is your Nexus Gateway, for example https://api.nexus.inc. The answer names your organization, you, your role and the permissions you have. The agent gateway (the Anthropic and OpenAI pass-through) also accepts the token as x-api-key, the header Anthropic's clients send.

A missing or unknown token is 401; a permission your role doesn't have is 403 role_required, naming who may. See Errors.