Dify integration
Dify prompt compression
Dify provides a visual platform for building AI applications. SuperCompress can be added as a custom tool or middleware to compress prompts before they reach your LLM.
Adding as a custom tool
In Dify, create a custom code node that calls SuperCompress before passing context to your LLM node:
import requests
def main(context: str, query: str) -> dict:
resp = requests.post(
"https://supercompress.dev/api/v1/compress",
headers={"X-API-Key": "YOUR_KEY"},
json={"context": context, "query": query}
)
data = resp.json()
return {
"compressed": data["compressed_text"],
"savings": data.get("original_tokens", 0) - data.get("kept_tokens", 0)
}
Frequently asked questions
Can I use SuperCompress in Dify workflows?
Yes. Add it as a code node between your knowledge retrieval and LLM nodes.
Does it require API configuration in Dify?
Yes. Add your SuperCompress API key as an environment variable in Dify.
Try it yourself
Paste your long prompt into the playground, ask a question, and see what SuperCompress keeps and removes. Free, no signup needed.