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.

Try it yourself

Paste your long prompt into the playground, ask a question, and see what SuperCompress keeps and removes. Free, no signup needed.

Open the Playground Embed the badge