You can use the Glimpse CLI without an account or a token of your own. It uses a built-in public token for image commands.
1. Run the CLI
Install cpx, then create the alias once:
cpx alias mathiasgrimm/glimpse-cli glimpse
cpx glimpse --help
All CLI examples in these docs use cpx glimpse. The alias works across
projects and terminal sessions. You do not need to install the CLI globally
or run cpx glimpse auth. See CLI installation
for details.
2. Optimize your first image
cpx glimpse optimize photo.jpg --output=photo-optimized.jpg
The CLI sends the image to Glimpse and saves the result as
photo-optimized.jpg. Your original file stays unchanged, and the output
keeps the same format. The optimizer never makes the file bigger.
3. Add it to your project
From your project root, run:
cpx glimpse init --workflow-mode=optimize
This sets up project files and a GitHub Actions workflow that creates PRs with optimized images after merges. It also works without a personal token. See automatic optimization for setup and how to skip an image in a PR.
Follow Add Glimpse to Your Project for the full setup.
Optional: use a personal token
For higher CLI rate limits, create a token under Settings > API Tokens at glimpseimg.com, then run:
cpx glimpse auth
See CLI authentication for token options.
Use the SDK or API
The PHP SDK and direct API requests require your own token. See Authentication to create one, then follow the SDK quick start or a guide.