Sign-in, API keys, and named connections
Available on the next release channel.
By default every agent uses its own login, for example a Claude.ai or ChatGPT subscription. Nori can also keep API keys for you and pass them to the agents you choose, or send an agent to a gateway through a named API connection.
See who is signed in
Section titled “See who is signed in”nori auth # table: agent, status, credential, sourcenori auth --json # the full report, for scriptsEach built-in agent shows signed in, signed out, or unknown, with the
credential it will use and where it comes from (an environment variable,
the agent’s own login files, or a saved key). unknown means Nori cannot
check that agent’s own login, for example Hermes Agent.
Save an API key
Section titled “Save an API key”nori auth set-key openai # anthropic, openai, google, xai, or cursornori auth remove-key openaiAt a terminal the key is read hidden: only its public prefix shows, such as
sk-proj-****. Piped input is read silently. The key is never taken as an
argument. A key that looks like another provider’s prints a warning but is
saved.
Keys are saved per provider, so one OpenAI key serves Codex, OpenCode, and Pi. Hermes Agent takes no saved key.
NORI_CREDENTIALS_STORE |
Where keys live |
|---|---|
unset or file |
$NORI_HOME/credentials.json, readable only by you |
keyring |
one OS keyring item, Nori Credentials; no file. macOS may prompt at each launch |
Choose which agents use saved keys
Section titled “Choose which agents use saved keys”A saved key does nothing until you opt an agent in:
nori auth prefer-api-key codex # use the saved key from its next launchnori auth prefer-login codex # back to the agent's own login (default)In the TUI, /api-key opens the same choice for the current agent. Changes
apply the next time the agent starts, for example after /new.
When Claude Code or Codex is signed in with a subscription, opting in
changes who you are billed: usage goes to the API account instead. Nori
warns and asks once, then remembers your answer. Without a terminal, or with
--json, the command fails with confirmation_required until you pass
--yes.
The choice is saved in config.toml:
[auth.codex]prefer_api_key = trueapi_billing_confirmed = trueEven for an opted-in agent, Nori skips a saved key when the agent already
has a key variable for that provider set, when a base URL variable such as
OPENAI_BASE_URL points elsewhere, or when the agent is bound to a named
connection.
Bind an agent to a named connection
Section titled “Bind an agent to a named connection”A named connection sends an agent to one endpoint, protocol, and model, with the key read from an environment variable. Codex and Pi support it.
[agent_token_providers]codex = "lab"
[[token_providers]]name = "lab"preset = "custom"protocol = "openai-responses"base_url = "https://gateway.example.com/v1"env_key = "LAB_MODEL_KEY"model = "lab/model-a"| Key | Values |
|---|---|
preset |
custom, openrouter, fireworks, subconscious, or cloudflare |
protocol |
openai-responses, openai-completions, or anthropic-messages |
base_url |
HTTP(S) URL with no credentials, query, or fragment |
env_key |
name of the variable that holds the key; never the key itself |
model |
exact model ID; wins over [default_models] for that agent |
Steps:
- Add the connection and the binding to
~/.nori/cli/config.toml. Use the canonical agent slug (codex,pi) as the binding key. - Set the key variable in the environment that starts Nori. For
nori host, that is the host’s environment. - Run
nori --agent codex,nori exec --agent codex "...", ornori host new --agent codex.
- Codex needs
openai-responses. - A
custompreset uses exactly its declared protocol. The other presets try the declared protocol first, then other protocols the gateway supports.cloudflareaccepts onlyopenai-completions. - For Pi, Nori writes a private Pi profile per launch. The model ID in
/modelis<name>/<model>, for examplelab/model-a. - A missing or empty key variable stops the launch, even when the agent’s own login would work. Remove the binding to go back to the agent’s usual login and model.
- Binding any other agent fails before it starts.
Common questions
Section titled “Common questions”Does nori exec see a key I set on its command line? Only when exec runs
its own host. When it uses your running nori host, the agent gets the
host’s environment. See nori host.
Does this change Nori Cloud sessions? No. Cloud sessions use your organization’s credentials; saved keys are never used there.
this page as markdown: /cli/guides/auth-and-connections.md· index for agents: /llms.txt