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.

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