Currently you can only get the token from .env specifically. In most of our projects we use env.local.
The only solution I managed to make work, when running the generator via a package.json script was:
dotenv -e .env.local -- bash -c 'npx --package=@datocms/cli@latest datocms schema:generate src/schema.ts --api-token $DATOCMS_API_TOKEN'
I would like to be able to specify which .env file to load.