Skip to main content
PowerTokens CLI (command name pt, also supports powertokens) is used from the terminal to call the Chinese large language models, image models, video models, and speech models on the PowerTokens platform. It is suitable for local creation, bulk generation, script automation, and for invocation by coding agents. This document introduces the current features in the order “Install → Login → Select Model → Execute Tasks → Retrieve Files → Configuration and Troubleshooting”. The model catalog and vendor parameters are dynamically updated by the platform, so actual usage should rely on the results returned by pt models.

1. Quick start

pt generate will automatically select the appropriate vendor route based on the model ID. You do not need to manually specify a vendor endpoint.

2. Installation

System requirements

PowerTokens CLI is distributed via npm. We recommend Node.js 18 or later. Make sure npm and the global npm executables directory are added to your system PATH.
After installation, you can use either of the following command names:
We generally recommend the shorter pt command.

3. Login and credential management

Login

The API key is saved to the current user’s local configuration file. Do not put the API key in Git repositories, README files, frontend code, or shared logs.

View current identity and usage information

This command shows the current login status, API key prefix, API Base URL, and the number of available models, among other information. It never prints the full API key.

Logout

This command removes the PowerTokens API key stored on the local machine. For unfamiliar models, we recommend the following process:
For automated scripts, we recommend the following process:
Model parameters are passed through generate’s general options and --params. After a task completes, the CLI downloads the generated result to the path specified by -o.

5. View available models

The model list is fetched dynamically from the PowerTokens API’s GET /v1/models. The client caches the model list; when the API is temporarily unavailable, the CLI falls back to a built-in list. Models are roughly categorized by capability as follows: Multimodal models such as kling-v3 and kling-v3-omni may appear in both the image and video categories.

6. Text chat: pt chat

Basic usage

Read the prompt from standard input

When no positional argument is provided, pt chat reads content from standard input, so you can combine it with other commands:

Parameters

7. Multimedia generation: pt generate

generate is the unified entry point for image, video, and audio generation. At minimum, provide a model ID, a prompt, and an output path:

7.1 Image generation

Common image parameters: Image size formats are not shared across providers. For example, Seedream commonly uses 2048x2048, Kling uses 1k, 2k, or 4k, and Qwen/Wan may use 2048*2048 or 2K. Use the official parameters of the target model as the source of truth. Kling’s std, pro, and 4k indicate quality tiers and do not necessarily correspond to fixed pixel dimensions. The CLI maps these values to the parameters required by the upstream API.

7.2 Text-to-video

Common video parameters: Resolution values differ across providers. Seedance/Wan commonly use 480p, 720p, and 1080p; Kling commonly uses std, pro, and 4k; Vidu commonly uses 540p, 720p, and 1080p; Hailuo commonly uses 768P and 1080P.

7.3 Image-to-video

--ref accepts a local file path, public URL, Base64 string, or asset:// resource identifier. The CLI handles asset formats automatically based on the provider.

7.4 First-and-last-frame video

Models or model series that currently support first-and-last-frame mode include Seedance, MiniMax Hailuo, MiniMax H3, Kling, Wan, and Vidu. Provide the first and last frames as a pair with --ref and --last-frame.

7.5 Reference video and reference audio

Seedance and MiniMax H3 support multimodal reference video generation:
First frame, first-and-last frame, and multimodal reference are distinct input scenarios. Do not treat multimodal references as ordinary first-frame mode.

7.6 Kling camera motion control

You can also pass additional camera control parameters through --params:
When video_url or character_orientation appears in --params, the CLI automatically selects Kling’s camera motion control endpoint. --character-orientation can be set to image or video.

7.7 Text-to-speech

For MiniMax speech models, you can specify a voice name with --voice:

8. generate complete parameters

Whether a parameter takes effect depends on the target model and upstream provider. The CLI maps general parameters to the corresponding endpoints; fields that cannot be expressed with general parameters should be passed through --params.

9. Pass model parameters with --params

Merge mode

When the JSON passed in --params contains no content or media array, the CLI merges the JSON fields into the request body:

Full request body mode

When --params directly contains a content or media array, the CLI treats it as the complete request body and adds the model field. You can omit -p in this case:
Wrap the entire JSON parameter in single quotes so Bash does not interpret the double quotes as shell syntax. On Windows PowerShell, adjust the quoting according to the shell’s rules.

10. Asset handling and provider differences

Local assets

--ref, --last-frame, --ref-video, and --ref-audio all accept local files. The CLI converts them automatically depending on the provider:
  • BytePlus Seedance first uploads assets to the asset library, then passes them to the model as asset://<id>. An asset:// path you provide directly is passed through unchanged.
  • MiniMax, Kling, Wan, Vidu, and HappyHorse typically convert local files to Base64 or a data URL; the exact encoding is determined by the provider adapter.
BytePlus Seedance asset uploads impose filename-length limits. The CLI automatically truncates filenames that are too long while preserving the extension, but we still recommend short filenames without special characters.

Main video parameter support

Provider fields not listed here should be passed through with --params. The table reflects the CLI’s current adapter support and does not represent the full capabilities of the upstream models.

11. Configuration

View and modify configuration

By default, the asset library address is derived automatically from the API Base URL. For example, when the API address is https://baze-api.powerbuyin.top, the asset library address is typically derived as https://powertokens.ai/api. Override it manually with -a only when you use a standalone asset service.

Local configuration file

The configuration file is located at:
File permissions default to 0600. Example structure:
Do not commit this file to version control or copy it to public environments.

Environment variables

Environment variables take precedence over the configuration file and are well suited to CI/CD, containers, and temporary tasks: Example:
Debug example:
Debug output may include request parameters and resource URLs. Do not keep debug output in shared logs.

12. Script automation

Bash

Node.js

Python

In scripts, explicitly check the process exit code and whether the target file exists. Do not rely on terminal logs to determine whether a task succeeded.

13. Frequently asked questions

13.1 “API key not configured” prompt

Run one of the following commands first:
or:
Then verify your login status with pt whoami.

13.2 Model not found or parameters not applied

Check the current model catalog first:
The model ID must match the returned result exactly, including case. Models differ in their support for sizes, aspect ratios, audio, seeds, and reference assets. When in doubt, check the corresponding provider’s model parameters and pass them with --params.

13.3 A local file cannot be used as a reference asset

Verify the file path and check the file type and size. We recommend an absolute path or a path relative to the current directory:
If the target is Seedance, also keep the filename short and confirm that the API key has permission to use the asset library.

13.4 --params JSON parsing failed

Check the quoting and JSON format. Bash example:
For complex requests, write the JSON to a file first and then read it into a shell variable to avoid nested-quote errors.

13.5 How to view the underlying request

Set PT_DEBUG=1:
The request body and task results are output to stderr, which helps diagnose parameter mapping, asset upload, and provider routing issues.

13.6 No output file was generated

Check that:
  1. The directory specified by -o exists, or create it first.
  2. The current model and input combination actually supports that task type.
  3. The task was not rejected by an upstream model.
  4. Your API key, API Base URL, and asset library address are configured correctly.
  5. Use PT_DEBUG=1 to view the task status and raw responses.

14. Command quick reference