Skip to content
Status

Technical Reference / speakeasy auth

speakeasy auth

Authenticate with the AI Control Plane from the CLI.

The auth command authenticates with the platform by opening a browser window for login. After successful authentication, it creates and saves a producer API key for the local profile configuration.

The speakeasy auth command is typically run once during initial setup. The API key and profile information it creates are stored in ~/.config/speakeasy-ai/profile.json.

Authenticate from the CLI:

Terminal window
speakeasy auth

This command will:

  • Open a browser window to the platform authentication page
  • Prompt for login credentials
  • Create a producer API key in the dashboard
  • Save the API key and profile information locally
  • Save the project selected in the browser as the default project

If the local profile already contains a valid API key, speakeasy auth refreshes the profile without opening a browser window.

After authentication, verify the setup with speakeasy whoami.

Change the default project context:

Terminal window
speakeasy auth switch --project {project-slug}

Completely clear auth information in the local profile to allow a fresh speakeasy auth:

Terminal window
speakeasy auth clear

This option sets the URL of the API server. It’s useful for connecting to custom or self-hosted instances.

Terminal window
speakeasy auth --api-url https://custom.example.com [other options]

The API server URL can also be set via the SPEAKEASY_AI_API_URL environment variable.

This option sets the URL of the dashboard used for browser-based authentication. If not provided, it defaults to the API server URL.

Terminal window
speakeasy auth --dashboard-url https://custom.example.com [other options]

The dashboard URL can also be set via the SPEAKEASY_AI_SITE_URL environment variable.