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
Stay up to date with the latest features, improvements, and releases.
Major update with 9 core features, comprehensive error handling, and production-ready SDKs
Enhanced multi-agent features with improved compression and metrics
Quick Start
Authenticate and make your first API call
Send the API key as a Bearer token in the Authorization header on every request.
Authorization: Bearer YOUR_API_KEYTry 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
Streaming support and deterministic receipts on every route.
/v1/optimizeOptimize input text/JSON/YAML to a compressed representation and return token savings.
{
"userId": "string",
"input": "string",
"format": "auto | json | yaml | csv | text",
"mode": "low | medium | high"
}{
"optimized": "string",
"tokensSaved": 1234,
"compression": 62.4,
"mode": "medium"
}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"
}'/v1/optimize-runOptimize input, call LLM, compress output, and return detailed cost/savings metrics.
{
"userId": "string",
"input": "string",
"format": "auto | json | yaml | csv | text",
"model": "gpt-3.5-turbo",
"mode": "low | medium | high"
}{
"inputOptimized": "string",
"llmOutputRaw": "string",
"llmOutputOptimized": "string",
"tokensSaved": 1234
}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"
}'/v1/convert-to-toonConvert any format to TOON
{
"input": "string",
"format": "auto | json | yaml | csv | text"
}{
"toon": "string",
"format": "json"
}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"
}'/v1/convert-from-toonConvert TOON back to JSON
{
"toon": "string"
}{
"json": {}
}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"
}'/v1/detect-formatAutomatically detect input format
{
"input": "string"
}{
"format": "json | yaml | csv | text | nl",
"confidence": "high | medium | low"
}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
Quick examples to get you started. For complete SDK documentation, see our dedicated SDK page.
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`);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/sdkpip install yaviqResources
Additional resources to help you build with YAVIQ
Complete SDK reference with all 9 core features
10+ real-world examples with copy-paste code
Step-by-step tutorials and best practices
Central hub for all developer resources
Complete error reference with solutions
Latest updates, features, and improvements
SDK status, versions, and feature support matrix
Define schemas and generate validation code (Beta)