SDK Documentation

YAVIQ SDK

Complete SDK with 9 core features. Get started in minutes with Node.js, Python, or CLI. Real savings: up to 78.6% on RAG, 42.7% on structured data, 52.3% on chat history.

Installation

Get started in 2 minutes

1. Install

npm install @yaviq/sdk

2. Set API Key

export YAVIQ_API_KEY="your_api_key_here"

Or create a .env file:

YAVIQ_API_KEY=your_api_key_here
YAVIQ_ENDPOINT=http://localhost:8080  # Optional

3. Quick Start

import { optimizeAndRun } from "@yaviq/sdk";

// Optimize + Run LLM in one step
const result = await optimizeAndRun({
  input: chatHistory,
  model: "gpt-4"
});

console.log(result.final_answer);
console.log(`Saved ${result.metrics.input_token_savings}`);

// You keep your LLM key. YAVIQ only optimizes context.

All Features

9 Core Features

Everything you need to optimize LLM costs

Optimize Prompt

Compress prompts with auto-format detection

Code Example

import { YAVIQClient } from '@yaviq/sdk';

const client = new YAVIQClient(process.env.YAVIQ_API_KEY);

const result = await client.optimize("Your prompt here", {
  mode: "balanced",
  format: "auto"
});

console.log(result.optimized);
console.log(`Saved ${result.tokensSaved} tokens (${result.compression}%)`);

Advanced Usage

Production-Ready Examples

Real-world examples for complex use cases

API Key Setup

Get your API key

1. Create API Key

Go to your dashboard and create an API key under API Keys

2. Store Securely

Never commit API keys to version control. Use environment variables or secrets managers.

Environment Variables

# .env file (never commit this!)
YAVIQ_API_KEY=your_api_key_here
YAVIQ_ENDPOINT=http://localhost:8080  # Optional

AWS Secrets Manager

import boto3

secrets = boto3.client('secretsmanager')
api_key = secrets.get_secret_value(
    SecretId='yaviq/api-key'
)['SecretString']

Vercel Environment Variables

# Set in Vercel dashboard under Settings > Environment Variables
# Access via process.env.YAVIQ_API_KEY

Ready to get started?

Start optimizing your LLM costs today. Get your API key and start saving tokens in minutes.