Command Line (CLI)
The trunkate CLI is the easiest way to integrate prompt optimization into CI/CD pipelines, shell scripts, or Makefile routines. It accepts direct flags and correctly handles STDOUT / STDERR routing to avoid breaking data pipes.
Installation
You can install the CLI globally via NPM:
npm install -g @trunkate-ai/cliAuthentication
Set your API token in your shell profile (~/.zshrc or ~/.bashrc), or pass it via the -k flag.
export TRUNKATE_API_KEY="tk_live_..."Usage (Universal Budget)
The --budget flag is Universal. It accepts both absolute token counts and proactive percentage buffers.
# OPTION A: Fixed Token Budget (Integer)
trunkate-ai --text "..." --budget 500
# OPTION B: Proactive Percentage Buffer (String)
trunkate-ai --text "..." --budget "20%"Global Flags
| Flag | Shorthand | Description |
|---|---|---|
--text | -t | Required. The actual long prompt to optimize. |
--task | Optional guidance for preservation ranking. | |
--budget | -b | Absolute tokens (e.g. 500) or percentage (e.g. "20%"). |
--model | -m | Target model architecture (default: gpt-4o). |
--api-key | -k | Override environment key. |
--url | -u | Override target endpoint for testing. |
Last updated on