Skip to Content

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/cli

Authentication

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

FlagShorthandDescription
--text-tRequired. The actual long prompt to optimize.
--taskOptional guidance for preservation ranking.
--budget-bAbsolute tokens (e.g. 500) or percentage (e.g. "20%").
--model-mTarget model architecture (default: gpt-4o).
--api-key-kOverride environment key.
--url-uOverride target endpoint for testing.
Last updated on