Skip to main content
Log in to the Together CLI with your browser, choose the project it works in, and log out. These commands require CLI version 2.41.0 or later. You can authenticate with an API key instead, for example in CI/CD.

Login

Log in with your browser. If you don’t have a Together AI account yet, you can create one during login.
The CLI opens a verification URL in your browser. Approve the request there, and the CLI saves your credentials and refreshes them automatically:
After you approve the login, the CLI scopes it to a project. If you belong to one project, the CLI switches to it automatically. If you belong to several, it asks you to choose one. With --json or --non-interactive, it can’t ask, so run tg switch after you log in.

Parameters

Switch

Scope the CLI to a different project. Commands you run afterward act in that project.
Omit the project ID to choose from every project your login can access. Run tg login before you switch.

Logout

Remove your stored credentials and end your login sessions.
After you log out, the CLI uses TOGETHER_API_KEY if it’s set.

Credential storage

On macOS and Linux, tg login saves your credentials to ~/.config/together/credentials.json, or to $XDG_CONFIG_HOME/together/credentials.json when XDG_CONFIG_HOME is set. On Windows, it saves them to %APPDATA%\Together\credentials.json. To keep your credentials in a different file, set the TOGETHER_CREDENTIALS_PATH environment variable to that file’s path.

Credential precedence

The CLI uses the first credential it finds, in this order:
  1. The --api-key flag.
  2. Your tg login session.
  3. The TOGETHER_API_KEY environment variable.
While you’re logged in, the CLI ignores TOGETHER_API_KEY. To use an API key instead, pass --api-key or run tg logout. Only the CLI reads your login credentials. The Python and TypeScript SDKs, and the cURL examples in these docs, authenticate with an API key from TOGETHER_API_KEY.