ScaleDown is a suite of task-specific small language models (SLMs) that reduce your AI token usage through context extraction — identifying and retaining only the information that matters for your task. You get the same quality responses while paying significantly less.
Here’s how to make your first API call to compress a prompt.
Python
TypeScript
JavaScript
import requestsimport json# ScaleDown API endpointurl = "https://api.scaledown.xyz/compress/raw/"# Your headers (replace YOUR_API_KEY with your actual key)headers = { 'x-api-key': 'YOUR_API_KEY', 'Content-Type': 'application/json'}
// ScaleDown API endpointconst url = "[https://api.scaledown.xyz/compress/raw/](https://api.scaledown.xyz/compress/raw/)";// Your headers (replace YOUR_API_KEY with your actual key)const headers = { 'x-api-key': 'YOUR_API_KEY', 'Content-Type': 'application/json'};
// ScaleDown API endpointconst url = "[https://api.scaledown.xyz/compress/raw/](https://api.scaledown.xyz/compress/raw/)";// Your headers (replace YOUR_API_KEY with your actual key)const headers = { 'x-api-key': 'YOUR_API_KEY', 'Content-Type': 'application/json'};
Separate your context from your main prompt and set the compression rate to "auto" for the best results.
Python
TypeScript
JavaScript
payload = { "context": "Context about your specific topic or instructions here", "prompt": "Your actual query or question here", "scaledown": { "rate": "auto" # Automatic compression rate optimization }}
interface CompressRequest { context: string; prompt: string; scaledown: { rate: string; };}const payload: CompressRequest = { context: "Context about your specific topic or instructions here", prompt: "Your actual query or question here", scaledown: { rate: "auto" // Automatic compression rate optimization }};
const payload = { context: "Context about your specific topic or instructions here", prompt: "Your actual query or question here", scaledown: { rate: "auto" // Automatic compression rate optimization }};
// Assuming you're using a fetch-like library (e.g., node-fetch)const response = await fetch(url, { method: 'POST', headers: headers, body: JSON.stringify(payload)});const result = await response.json();console.log(result);
// Using Fetch API in a browser or Node.js environmentfetch(url, { method: 'POST', headers: headers, body: JSON.stringify(payload)}).then(response => response.json()).then(result => { console.log(result);}).catch(error => console.error('Error:', error));
That’s it! Your prompt is now compressed and ready to be used with your AI model.