---
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

title: "Connect the CLI to Deployments"
description: "Configure, authenticate, and switch between NeMo Platform deployments."
---

Use named CLI contexts to connect to one or more local or remote NeMo Platform deployments.

## Prerequisites

- Install the NeMo CLI as described in [Setup](/documentation/get-started).
- Obtain the base URL for each deployment.
- For an authenticated deployment, obtain an account that can complete its login flow.

## Connect to a remote deployment

Save the deployment URL in the current CLI context:

```bash
nemo config set --base-url https://nmp.example.com
```

Verify the saved URL:

```bash
nemo config view
```

If the deployment requires authentication, log in after configuring the URL:

```bash
nemo auth login
```

You can also run `nemo setup`. During interactive onboarding, setup offers to connect to a remote deployment when the configured platform is unreachable. It verifies and saves the URL, then runs the same authentication flow.

## Connect to multiple deployments

A context is a user-defined name for a set of connection settings. Names such as `staging`, `production`, and `local` are labels you choose. Each context keeps its own URL, authentication credentials, workspace, and output preferences.

Create a context for each deployment. Use `--activate` to make one of them current:

```bash
nemo config set --context staging --base-url https://nmp.staging.example.com
nemo config set --context production --base-url https://nmp.example.com --activate
```

If the saved configuration has no current context, the next written context becomes current automatically. Otherwise, creating another context does not switch the current context.

For authenticated deployments, log in to each context separately:

```bash
nemo auth login --context staging
nemo auth login --context production
```

Switch the current context:

```bash
nemo config use-context staging
```

Verify the switch:

```bash
nemo config current-context
nemo config view
```

Inspect all saved connections:

```bash
nemo config view --all-contexts
```

To target a context for one command without switching, use the global `--context` option:

```bash
nemo --context production models list
```

## Connect to a local deployment

A local platform can coexist with remote contexts:

```bash
nemo config set --context local --base-url http://localhost:8080
```

<Note>
`NMP_BASE_URL` and `NMP_CURRENT_CONTEXT` override saved configuration for all contexts. If switching contexts does not change the target deployment, unset those variables or update them for the current shell.
</Note>

## Next Steps

- Review the [configuration reference](/documentation/reference/cli-reference/configuration) for fields and precedence.
- Run `nemo workspaces list` to verify platform access.
- Use [CLI troubleshooting](/documentation/reference/cli-reference/troubleshooting) if the connection fails.
