> ## Documentation Index
> Fetch the complete documentation index at: https://www.thundercompute.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> Authenticate the Thunder Compute CLI using API keys. Configure terminal credentials to manage cloud resources.

<Columns cols={3}>
  <Card title="VS Code" icon="window" href="/vscode/operations/authentication" color="#95c5ea" className="platform-card">
    Editor extension
  </Card>

  <Card title="CLI" icon="terminal" color="#95c5ea" className="platform-card platform-current">
    Command line
  </Card>

  <Card title="Console" icon="browser" href="/console/operations/authentication" color="#95c5ea" className="platform-card">
    Web interface
  </Card>
</Columns>

## Log In

Run the following command to authenticate the CLI:

```bash theme={null}
tnr login
```

Your browser will open automatically to complete authentication via OAuth.

To use a token instead, press `T` during login to enter a token generated from the [console](https://console.thundercompute.com/settings/tokens).

## Log Out

To remove your stored credentials:

```bash theme={null}
tnr logout
```

This deletes the token file from your machine.

## Programmatic Authentication

For scripts and automation, set the `TNR_API_TOKEN` environment variable:

```bash theme={null}
export TNR_API_TOKEN=your_token_here
```

## Managing API Tokens

API tokens authenticate your CLI and extension access. You can manage them in the [console](https://console.thundercompute.com/settings/tokens).

* **Generate tokens**: Create new tokens for each device or use case
* **Revoke tokens**: Remove access for specific tokens without affecting others
* **Token persistence**: Tokens never expire unless manually revoked

<Note>
  Use unique tokens for each device so you can revoke access individually if needed.
</Note>

## Adding a Payment Method

Before creating instances, you need a payment method on file. Visit the [billing settings](https://console.thundercompute.com/settings/billing) to add a credit card.
