Skip to main content

CLI quickstart

1. Install the Anyscale CLI

Install it from pip.

pip install anyscale

2. Authentication

Anyscale authenticates API requests using a token, which can be issued either with the anyscale login command in the CLI or manual generation of an API key.

  • Use anyscale login

    The CLI command fetches and updates the token in the local credential file (~/.anyscale/credentials.json). The CLI will use this token to authenticate its requests. This is recommended for interactive development.

  • Use ANYSCALE_CLI_TOKEN environment variable

    Manually generate your API key here and set it in this environment variable. The CLI checks the environment variable first before the credentials file. This is recommended for CI/CD integration and other production use case.

note

API keys created by anyscale login expire after 7 days. If you want them to persist longer or not to expire, use --expire-in-days=<# of days> or --no-expire flags.

caution

Be sure to keep your API key private and secure to prevent unwanted access to your Anyscale resources.

3. Test it out

To verify that everything is working, try listing the jobs you have access to.

anyscale job list

If the authentication is working, you shouldn't see any error related to permissions.

4. Next Steps

You have successfully set up the Anyscale CLI, you can start interacting with Anyscale from your terminal. If you have questions about how to use Anyscale CLI commands, see the reference.