libra-ai-sdk
v1.0.2
Published
Official Libra AI SDK for JavaScript and TypeScript
Maintainers
Readme
@libra-ai/sdk
Official Libra AI SDK for JavaScript and TypeScript.
Installation
npm install libra-ai-sdk
# or
yarn add libra-ai-sdk
# or
pnpm add libra-ai-sdkQuick Start
import { LibraAI } from 'libra-ai-sdk';
const libra = new LibraAI('lak_your_api_key');
// Simple usage
const answer = await libra.ask('What is TypeScript?');
console.log(answer);
// With options
const response = await libra.chat('Explain React', {
temperature: 0.7,
maxTokens: 1000
});
console.log(response.data?.message);API Reference
Constructor
new LibraAI(apiKey: string, baseUrl?: string)apiKey- Your Libra API key (starts withlak_)baseUrl- Optional custom base URL (default:https://libra-ai.com)
Methods
chat(message, options?)
Send a message and get the full response object.
const response = await libra.chat('Hello!', {
model: 'default',
maxTokens: 2048,
temperature: 0.7,
systemPrompt: 'You are a helpful assistant'
});ask(message, options?)
Simple method that returns just the AI response as a string.
const answer = await libra.ask('What is AI?');getInfo()
Get API info and rate limits.
const info = await libra.getInfo();Rate Limits
| Tier | Requests/min | Requests/day | Max Tokens | |------|-------------|--------------|------------| | Basic | 10 | 100 | 2048 | | Pro | 60 | 1000 | 8192 |
License
MIT © IndoNusaCorp
