Java integration guide

Java prompt compression

Java powers enterprise AI applications. SuperCompress provides a REST API that integrates seamlessly with Spring Boot, Quarkus, and other Java frameworks.

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

Spring Boot client

import org.springframework.web.client.RestClient;

public class SuperCompressClient {
    private final RestClient restClient;
    private final String apiKey;

    public SuperCompressClient(String apiKey) {
        this.apiKey = apiKey;
        this.restClient = RestClient.create();
    }

    public String compress(String context, String query) {
        var request = new CompressRequest(context, query);
        var response = restClient.post()
            .uri("https://supercompress.dev/api/v1/compress")
            .header("X-API-Key", apiKey)
            .body(request)
            .retrieve()
            .body(CompressResponse.class);
        return response.compressedText();
    }

    record CompressRequest(String context, String query) {}
    record CompressResponse(String compressed_text) {}
}

Frequently asked questions

Does it work with Spring AI?

Yes. Call compress() before passing context to Spring AI's template-based prompt builders.

Can I use it with Quarkus?

Yes. The REST API is framework-agnostic. Use Quarkus's REST Client reactive with the same endpoint.

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