Skip to main content

Prerequisites

  • A Tracia account (sign up)
  • Node.js 18 or later
  • An API key from a supported LLM provider (OpenAI, Anthropic, etc.)

Step 1: Get Your API Key

  1. Log in to tracia.io
  2. Navigate to Settings > API Keys
  3. Click Create API Key
  4. Copy your key (starts with tr_)
Store your API key securely. It provides full access to your Tracia account.

Step 2: Install the SDK

npm install tracia

Step 3: Configure Your LLM Provider

  1. Go to Settings > Providers in the Tracia dashboard
  2. Add your OpenAI, Anthropic, or other provider API key
  3. Tracia encrypts and stores your key securely

Step 4: Create Your First Prompt

  1. Go to Prompts in the dashboard
  2. Click New Prompt
  3. Enter a name (e.g., “Welcome Email”)
  4. Add your prompt messages:
System: You are a helpful assistant that writes professional emails.

User: Write a welcome email for {{name}} who just signed up for {{product}}.
  1. Click Save
Use {{variable}} syntax to create dynamic prompts. Variables are replaced at runtime.

Step 5: Run Your Prompt

import { Tracia } from 'tracia';

const tracia = new Tracia({
  apiKey: process.env.TRACIA_API_KEY
});

const result = await tracia.prompts.run('welcome-email', {
  name: 'Alice',
  product: 'Tracia'
});

console.log(result.text);
// Output: "Dear Alice, Welcome to Tracia!..."

console.log(result.usage);
// { inputTokens: 45, outputTokens: 120, totalTokens: 165 }

Step 6: View Traces

After running your prompt:
  1. Go to Traces in the dashboard
  2. See the full execution details including:
    • Input/output content
    • Token usage and cost
    • Latency metrics
    • Variables used

Next Steps