Installation
Install the LaikaTest SDK in your application
Package Manager Installation
NPM
Bash
npm install @laikatest/js-clientYarn
Bash
yarn add @laikatest/js-clientPNPM
Bash
pnpm add @laikatest/js-clientBasic Configuration
After installation, initialize the SDK with your API key:
TypeScript
import { LaikaTest } from '@laikatest/js-client';const client = new LaikaTest(process.env.LAIKATEST_API_KEY);Advanced Configuration
Customize the SDK behavior with optional configuration:
TypeScript
const client = new LaikaTest(apiKey, { baseUrl: 'https://api.laikatest.com', // Custom API endpoint timeout: 10000, // Request timeout in ms (default: 10000) cacheTTL: 1800000, // Cache duration in ms (default: 30 min) cacheEnabled: true // Enable caching (default: true)});Features
- Zero Dependencies: Lightweight SDK with no external dependencies
- Intelligent Caching: Built-in caching to reduce API calls and improve performance
- TypeScript Support: Full type definitions for type-safe development
- Version Management: Fetch specific prompt versions by ID
- Variable Compilation: Compile templates with variable substitution
- Error Handling: Comprehensive error classes for different failure scenarios
Environment Variables
Store your API key securely in environment variables:
Bash
# .envLAIKATEST_API_KEY=your_api_key_here# Access in Node.jsprocess.env.LAIKATEST_API_KEY# For Next.js client-side (prefix with NEXT_PUBLIC_)NEXT_PUBLIC_LAIKATEST_API_KEY=your_api_key_hereGet Your API Key: Navigate to your dashboard under Settings → API Keys to generate a new API key.
Security Warning: Never expose your API keys in client-side code or commit them to public repositories.