Developer Documentation

Build Faster and cost‑efficient with YAVIQ.

Everything you need to authenticate, optimize payloads, track token savings, and integrate SDKs without locking into any one format.

How YAVIQ uses TOON

YAVIQ is a cost optimization platform first. Internally, it may use structured representations (including TOON-style formats) when they produce the best token savings. You are never required to adopt a specific format—use JSON, text, or RAG inputs, and YAVIQ will choose the right optimizer.

Latest Updates

What's New

Stay up to date with the latest features, improvements, and releases.

v2.0.0December 2024

Complete SDK Overhaul

Major update with 9 core features, comprehensive error handling, and production-ready SDKs

v1.5.0November 2024

Multi-Agent Support

Enhanced multi-agent features with improved compression and metrics

View Full Changelog

Quick Start

Get started in 2 minutes

Authenticate and make your first API call

1. Get Your API Key

Create an API key in your dashboard under API Keys & permissions.

Go to API Keys

2. Authenticate Requests

Send the API key as a Bearer token in the Authorization header on every request.

Authorization: Bearer YOUR_API_KEY

3. Make Your First Call

Try optimizing a prompt with our API.

curl -X POST https://yaviq.com/api/v1/optimize \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "userId": "user123",
    "input": "Explain quantum computing",
    "mode": "balanced",
    "format": "auto"
  }'

API reference

Endpoints.

Streaming support and deterministic receipts on every route.

POST/v1/optimize

Optimize input text/JSON/YAML to a compressed representation and return token savings.

Request

{
  "userId": "string",
  "input": "string",
  "format": "auto | json | yaml | csv | text",
  "mode": "low | medium | high"
}

Response

{
  "optimized": "string",
  "tokensSaved": 1234,
  "compression": 62.4,
  "mode": "medium"
}

Example (cURL)

curl -X POST https://yaviq.com/api/v1/optimize \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "userId": "string",
  "input": "string",
  "format": "auto | json | yaml | csv | text",
  "mode": "low | medium | high"
}'
POST/v1/optimize-run

Optimize input, call LLM, compress output, and return detailed cost/savings metrics.

Request

{
  "userId": "string",
  "input": "string",
  "format": "auto | json | yaml | csv | text",
  "model": "gpt-3.5-turbo",
  "mode": "low | medium | high"
}

Response

{
  "inputOptimized": "string",
  "llmOutputRaw": "string",
  "llmOutputOptimized": "string",
  "tokensSaved": 1234
}

Example (cURL)

curl -X POST https://yaviq.com/api/v1/optimize-run \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "userId": "string",
  "input": "string",
  "format": "auto | json | yaml | csv | text",
  "model": "gpt-3.5-turbo",
  "mode": "low | medium | high"
}'
POST/v1/convert-to-toon

Convert any format to TOON

Request

{
  "input": "string",
  "format": "auto | json | yaml | csv | text"
}

Response

{
  "toon": "string",
  "format": "json"
}

Example (cURL)

curl -X POST https://yaviq.com/api/v1/convert-to-toon \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "input": "string",
  "format": "auto | json | yaml | csv | text"
}'
POST/v1/convert-from-toon

Convert TOON back to JSON

Request

{
  "toon": "string"
}

Response

{
  "json": {}
}

Example (cURL)

curl -X POST https://yaviq.com/api/v1/convert-from-toon \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "toon": "string"
}'
POST/v1/detect-format

Automatically detect input format

Request

{
  "input": "string"
}

Response

{
  "format": "json | yaml | csv | text | nl",
  "confidence": "high | medium | low"
}

Example (cURL)

curl -X POST https://yaviq.com/api/v1/detect-format \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "input": "string"
}'

SDK Quick Examples

TypeScript & Python in sync.

Quick examples to get you started. For complete SDK documentation, see our dedicated SDK page.

View Full SDK Docs

Node.js / TypeScript

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

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

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

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

Python

from yaviq import YAVIQClient
import os

client = YAVIQClient(
    api_key=os.environ.get("YAVIQ_API_KEY")
)

result = client.optimize(
    "Your prompt",
    mode="balanced",
    format="auto"
)

print(result["optimized"])
print(f"Saved {result['tokensSaved']} tokens")

💡 Tip: Install the SDK to get started faster:

npm install @yaviq/sdk
pip install yaviq

Resources

Everything you need

Additional resources to help you build with YAVIQ