Skip to Content
Getting StartedQuickstart

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.

  1. Log in to the Trunkate AI Dashboard .
  2. Navigate to Settings > API Keys.
  3. Click “Generate New Key”.
  4. 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.

npm install @trunkate-ai/sdk

The “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.

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.

Last updated on