Rust integration guide

Rust prompt compression

Rust is used for high-performance AI inference servers and edge computing. SuperCompress provides a simple REST API that integrates easily with any Rust HTTP client.

By Arjun Shah - Creator of SuperCompress - Updated 2026-07-03

Rust client with reqwest

use reqwest::Client;
use serde::{Serialize, Deserialize};

#[derive(Serialize)]
struct CompressRequest {
    context: String,
    query: String,
}

#[derive(Deserialize)]
struct CompressResponse {
    compressed_text: String,
}

pub async fn compress(api_key: &str, context: &str, query: &str)
    -> Result>
{
    let client = Client::new();
    let req = CompressRequest {
        context: context.to_string(),
        query: query.to_string(),
    };

    let resp = client
        .post("https://supercompress.dev/api/v1/compress")
        .header("X-API-Key", api_key)
        .json(&req)
        .send()
        .await?;

    let result: CompressResponse = resp.json().await?;
    Ok(result.compressed_text)
}

Frequently asked questions

Can Rust services call SuperCompress synchronously?

Use tokio::spawn_blocking for sync calls, or use the async reqwest client shown above.

Does the API support batch compression?

Batch compression is available for high-throughput Rust services. Contact the team for API details.

Build with less context

Put compression in front of your next LLM call.

Use the hosted API or run SuperCompress locally. Keep the evidence, drop the token waste, and measure the savings before it reaches your model.

Get an API keyRead the guide