Framework integration

Semantic Kernel compression

Semantic Kernel is Microsoft's AI orchestration framework. Add SuperCompress via the REST API as a prompt filter.

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

Semantic Kernel prompt filter

using Microsoft.SemanticKernel;

public class SuperCompressFilter : IPromptRenderFilter
{
    private readonly HttpClient _http;
    private readonly string _apiKey;

    public SuperCompressFilter(string apiKey)
    {
        _http = new HttpClient();
        _apiKey = apiKey;
    }

    public async Task OnPromptRenderAsync(
        PromptRenderContext context, Func next)
    {
        var prompt = context.RenderedPrompt;
        if (prompt.Length > 2000)
        {
            // Call SuperCompress API
            var compressed = await CompressAsync(prompt);
            context.RenderedPrompt = compressed;
        }
        await next(context);
    }
}

Frequently asked questions

Does it work with Semantic Kernel's planners?

Yes. The prompt filter applies to all prompts, including those generated by planners.

Can I use it with Azure OpenAI?

Yes. Compress prompts before they reach the Azure OpenAI connector.

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