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 SDK bindings and a global command-line tool.
Typescript
npm install @trunkate-ai/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-ai/sdk";
// Initialize client using your API key
const client = new Trunkate({
apiKey: "tk_live_1234567890abcdef"
});
const prompt = "Your very long context...";
// Option A: Fixed token budget (integer)
const { text } = await client.optimize(prompt, "Summarize", 500);
// Option B: Proactive percentage budget (string)
const { text: optimized } = await client.optimize(prompt, "Summarize", "20%");
console.log(`Reduced token count by ${stats.reduction_percent}%`);Next Steps
Now that you’ve run your first optimization, learn how to refine the output further.
- Integration Methods: Dive deep into the specific SDK or tool for your stack.
- Authentication Guide: Learn how to manage your keys.
- Intent Normalization: See how we remove fluff.
- Web Playground: Test your optimized prompts.
Last updated on