Quickstart
Welcome to Trunkate AI. This guide will get you from zero to your first prompt reduction in under 5 minutes.
Prerequisites
Before we begin, ensure you have the following:
- A GitHub or Google account (for Dashboard access).
- Node.js v18+ or Python 3.9+ installed.
Get your API Key
All interactions with the Trunkate AI API require a secure API key.
- Log in to the Trunkate AI Dashboard .
- Navigate to Settings > API Keys.
- Click “Generate New Key”.
- Copy the key immediately (it is only shown once).
WARNING
Your API key carries your financial identity. Never commit it to a public repository. Use .env files.
Install the SDK
We provide native bindings for TypeScript and Python.
npm
npm install @trunkate/sdkThe “Hello World” of Prompt Optimization
Let’s optimize a Prompt. Instead of sending verbose instructions to the LLM, we will use Trunkate AI to shrink it down.
TypeScript
import { Trunkate } from '@trunkate/sdk';
const client = new Trunkate({
apiKey: process.env.TRUNKATE_API_KEY,
budget: 500 // Target max token budget
});
async function main() {
// 1. Define your long prompt
const prompt = "Please kindly summarize the following article in order to help me understand the main core concepts in a very detailed manner...";
// 2. Optimize
const { text, stats } = await client.optimize(prompt);
console.log("⚡ Optimized Result:", text);
console.log("📉 Reduced by:", stats.reduction + "%");
}
main();Next Steps
Now that you’ve run your first optimization, learn how to refine the output further.
- Authentication Guide: Learn how to manage your keys.
- Intent Normalization: See how we remove fluff.
- Web Playground: Test your optimized prompts.
Last updated on