subtext
Back to Documentation

Quickstart Guide

Get started with Subtext in under 10 minutes. This guide will walk you through setting up the SDK and tracking your first conversation.

1

Install the SDK

Install the Subtext TypeScript SDK using your preferred package manager:

Installation
# npm
npm install subtext-ts
# yarn
yarn add subtext-ts
# pnpm
pnpm add subtext-ts
2

Get Your API Key

You'll need an API key to authenticate with Subtext. Get yours from the dashboard:

  1. Log in to your Subtext dashboard
  2. Navigate to Settings → API Keys
  3. Click "Create New API Key"
  4. Copy your API key and store it securely
3

Basic Usage

Here's a complete example showing how to track a conversation with your AI:

Example Code
TypeScript
import { SubtextClient } from 'subtext-ts';

// Initialize the client with your API key
const client = new SubtextClient({ 
  apiKey: process.env.SUBTEXT_API_KEY!
});

// Create a thread
const thread = await client.thread({ 
  threadId: "thread-123" 
});

// Create a message
const message = await client.message({
  threadId: thread.threadId,
  message: "Hello, world!",
  messageId: "msg-456"
});

// Record an LLM run
const run = await client.run({
  threadId: thread.threadId,
  runId: "run-789",
  response: "Hello! How can I help you today?",
});

console.log(message.id);

🎉 You're All Set!

Congratulations! You've successfully integrated Subtext into your application. Your conversations will now be tracked and analyzed automatically.

View Your Dashboard
Check out your analytics and insights in the Subtext dashboard.
Need Help?
Have questions or need assistance? We're here to help.