Skip to main content
The Tolstoy CLI is the @tolstoy-ai/cli package on npm. It gives you your products, brand context, media library, Studio assets, and more from the command line.

Create an API key

API keys are available on paid plans.
1

Open the API keys page

In Tolstoy, go to Settings → API, MCP & CLI.
2

Create a key

Click Create API Key. Give the key a name, for example “CI pipeline”, and select when it expires.
3

Copy the key

Copy the key immediately. Tolstoy shows it only one time.
A key acts as the person who created it, and it can get to all stores in the workspace. Keep it secret, as you keep a password.

Install and sign in

To run the CLI without installing it, use npx @tolstoy-ai/cli in place of tolstoy. In a script or a CI pipeline, set the TOLSTOY_API_KEY environment variable, or add --api-key <key> to a command.

Run commands

A command has the form tolstoy <service> <command> [flags]:
To see all services, run tolstoy --help. To see the commands of a service, run tolstoy <service> --help. To see the flags of a command, run tolstoy <service> <command> --help.

Use it with an AI coding agent

The CLI includes skills that teach an AI coding agent how to use it:
The --provider flag accepts claude, opencode or agents. The command installs the skill into the current project. To install it for all your projects, add -g.