# Signing in

Moontors runs each agent through its vendor's own command-line tool. You sign in to each agent once,
in Moontors, from one sign-in dialog. It opens where you need it:

- **Create session**, for an agent that's signed out. Once you're signed in, the session is created.
- **Sign in**, in a session's transcript or in the Configuration dialog, when the agent needs
  signing in.
- `/logout` in a session, to sign out.
- **Accounts**, to sign an agent in, switch the account it's signed in with, or sign it out (see
  [Accounts](#accounts)).

## Installing the agent

Moontors downloads and verifies its own copy of each agent the first time you pick it, in the
sign-in dialog or in **Create session**. It never uses an agent you installed yourself, and never
changes yours.

In **Create session**, each agent says **Not installed**, **Installing…** or **Couldn't install**
until it's installed, then **Signed in**, **Signed out** or **Checks at start**. The download shows
its progress, such as 12 MB of 80 MB. If it fails, Moontors says why; choose **Retry**.

## Ways to sign in

The sign-in dialog always shows four kinds of sign-in, in the same order: **Browser**, **Device
code**, **API key** and **Instructions**. The ones an agent doesn't offer are dimmed and say **Not
available**.

| Agent       | Browser                                   | Device code | API key | Instructions               |
| ----------- | ----------------------------------------- | ----------- | ------- | -------------------------- |
| Claude Code | Claude subscription, or Anthropic Console | —           | yes     | Bedrock, Foundry or Vertex |
| Codex       | ChatGPT                                   | ChatGPT     | yes     | —                          |
| Gemini CLI  | Google                                    | —           | yes     | —                          |

- **Browser:** choose **Sign in in your browser**, or with Claude Code, **Sign in with Claude
  subscription** or **Sign in with Anthropic Console**. Your browser opens on the vendor's sign-in
  page, and the dialog says "Continue in your browser." Finish there. With Claude Code, the dialog
  also shows the address of a page for when no browser opened, with **Copy** and **Open**: sign in
  on that page, paste the code it shows into **Code**, and choose **Continue**. If the code isn't
  whole, the dialog says so, and you can paste it again.
- **Device code:** choose **Sign in with a device code**. Moontors shows a code and a page; enter
  the code on that page.
- **API key:** paste the key into the **API key** field and choose **Save key**. Moontors checks it
  where the agent can, then keeps it in your system's keychain and gives it to the agent each time
  it starts. Signing in another way removes the stored key.
- **Instructions:** **How to sign in** opens the vendor's own instructions.

Once you're signed in, the dialog closes.

Moontors never keeps your browser or device-code sign-in. A code you paste goes to the agent alone:
Moontors passes it on without keeping it, logging it or showing it again. The agent keeps the
sign-in itself, in Moontors' own folder for that agent, or in the system keychain where the agent
keeps its sign-in there (Claude Code on macOS). Gemini CLI keeps a folder of its own for each
sign-in, and an old one goes once no session uses it. Signing in here doesn't change the agent you
use outside Moontors.

`/status` in a session shows the account it uses, and its plan where the agent reports one (see
[Insight and code workflows](/docs/insight-and-code-workflows/)). **Accounts** also shows the way
each agent signed in, and its email and organization.

## Gemini CLI

- Google no longer lets personal accounts sign in to Gemini CLI through the browser. Use an API key.
  An organization account may still use the browser.
- With an API key, or a Google sign-in made in Moontors, Gemini CLI shows as **Signed in**.
  Otherwise it can't tell whether it's signed in until a session starts, so it shows as **Checks at
  start**.

## Accounts

The **Accounts** button, the person icon at the right end of the top bar, opens the **Accounts**
dialog: one place for every agent's sign-in. It reads each agent's sign-in afresh as it
opens. **Close**, or Escape, closes it.

Each agent has a row with its name and where it stands: **Signed in**, **Signed out**, or **Checks
at start** for an agent that can't tell until a session starts.

An agent that's signed in shows:

- **Signed in with**: the way it signed in, such as a browser sign-in or an API key.
- **Account**: the account's kind and plan, where the agent says them.
- **Email** and **Organization**, where the agent says them.
- **Usage limits**, as Status shows them: each limit and when it resets, with a Claude subscription
  or a ChatGPT sign-in for Codex. An API key has none to show, and Gemini CLI shows none.
- **Switch account**, to sign in with another account.
- **Sign out of** the agent, such as **Sign out of Codex**, as in the sign-in dialog (see
  [Signing out](#signing-out)): it names the sessions it would stop first, and **Sign out** or
  **Stay signed in** answers.

Any other agent shows **Sign in**, which opens the sign-in dialog.

What each agent says of its account:

- **Claude Code:** with a Claude subscription, the plan, email and organization; with the Anthropic
  Console, the email and organization; with an API key, only that it's a key; through Bedrock,
  Foundry or Vertex, "Other sign-in".
- **Codex:** with ChatGPT, the plan and email, but no organization; with an API key, only that it's
  a key, and no usage limits.
- **Gemini CLI:** with Google, "Other sign-in" and the email; with an API key, only that it's a key.
  It never says a tier or usage limits.

**Switch account** goes straight to the ways to sign in, as **Sign in** does. The new sign-in
replaces the old one, with no sign-out first, so a turn in progress isn't cut off. If you cancel, the
old sign-in stays. Each agent's sessions take the new account:

- **Claude Code:** from one Claude subscription to another, at its next request, even in the middle
  of a turn. Any other switch, such as to or from an API key, from each session's next turn.
- **Codex:** from one API key to another, at once, even in the middle of a turn. Any other switch,
  such as between ChatGPT and a key, or from one ChatGPT account to another, from each session's
  next turn.
- **Gemini CLI:** from each session's next turn. Each sign-in has its own folder, and a session's
  conversation goes on in the new one.

For a switch from the next turn, a session that's idle stops its agent at once, and one in the
middle of a turn finishes it on the old account. At its next turn, a session starts its agent again on the new account and carries on with
the same conversation. The plan Status shows for a session follows from its agent's next start.

Each agent holds one sign-in at a time, and switching between two real accounts isn't tested yet
(see [Known limits](/docs/known-limits/)).

## When a sign-in is needed

If an agent says it needs signing in during a session, the transcript offers **Sign in**. After you
sign in, the next prompt continues with the new sign-in.

## Signing out

Sign out from the sign-in dialog, which `/logout` opens, or from **Accounts**. While an agent shows
as **Signed in**, the dialog offers **Sign out of** the agent, such as **Sign out of Codex**. For Gemini CLI, that's with
an API key or a Google sign-in made in Moontors.

Moontors then lists the agent's sessions that are working now, with any background tasks they
have, since signing out stops them. Choose **Sign out**, or **Stay signed in** to keep it. Your
sessions stay; the next prompt asks you to sign in again. For an API key, signing out forgets the
stored key. Signing out here doesn't sign out the agent you use outside Moontors.