Dify
Connect Akto with Dify
Overview
Dify is an open-source platform for building LLM applications such as chatbots, agents, and workflows. This integration uses Dify's Moderation API Extension to route end-user inputs and LLM outputs through Akto guardrails before they reach (or leave) your Dify app.
The Akto Dify connector provides the following capabilities:
Validates Dify app inputs and outputs against security policies
Detects PII, prompt injection, and policy violations
Blocks violating content or redacts it inline (override) before it is shown
Ingests traffic into Akto, creating a per-app collection for monitoring and analysis
How It Works
Dify's Moderation API Extension sends each input/output to an external endpoint. Akto exposes that endpoint on your account's guardrails service host, which validates the content against guardrails, ingests it for monitoring, and returns Dify's moderation verdict:
Dify app --(app.moderation.input / app.moderation.output)--> https://<accountId>-guardrails-service.akto.io/api/http-proxy/dify --> guardrails + ingestion
^ |
|------------------------ { flagged, action, preset_response / text } --------------------------|app.moderation.input
Validates end-user input (request guardrails) and ingests it
app.moderation.output
Validates LLM output (response guardrails) and ingests it
ping
Health check ({ "result": "pong" })
Akto verdicts map to Dify responses as follows:
Blocked
{ flagged: true, action: "direct_output", preset_response: <reason> }
Allowed but modified
{ flagged: true, action: "overridden", inputs/query | text: <redacted> }
Allowed
{ flagged: false }
The endpoint is fail-open: if guardrails are unreachable or error, content is allowed through.
API Endpoint
Each Akto account has a dedicated guardrails service host:
Replace <accountId> with your Akto account ID. The Connectors → Dify setup guide in the dashboard shows the full URL for your account — copy it from there.
Prerequisites
Before integrating Akto with Dify, ensure the following are in place:
A running Dify instance (cloud or self-hosted) with workspace settings access
Network access from Dify to your Akto guardrails service (
https://<accountId>-guardrails-service.akto.io)A token generated from Akto Argus → Connectors → Dify
Steps to Connect
Get your token from Akto
In the Akto dashboard, go to Connectors → Dify, select a token expiry, and copy the generated token. You will use it as the API Key in Dify.
Add the API Extension in Dify
In Dify, go to Settings → API Extension → Add and fill in the fields as shown below:

Name: e.g.
Akto GuardrailsAPI Endpoint:
https://<accountId>-guardrails-service.akto.io/api/http-proxy/dify(copy the exact URL from Connectors → Dify in your dashboard)API-key: the token from step 1 (Dify sends it as
Authorization: Bearer <token>)
Enable Content Moderation per app
Open the app you want to protect → Content Moderation, choose the Akto Guardrails API extension, and enable Review Input Content and/or Review Output Content.
Verify Integration
Confirm the endpoint is reachable and the moderation contract works (replace <accountId> and <token>):
Verify in the Akto dashboard:
Log into the Akto dashboard
Navigate to the Collections section and confirm a
*.dify.agentcollection appearsConfirm guardrail activity is visible under Agentic Guardrails
Get Support for your Akto setup
There are multiple ways to request support from Akto. We are 24X7 available on the following:
In-app
intercomsupport. Message us with your query on intercom in Akto dashboard and someone will reply.Join our discord channel for community support.
Contact
help@akto.iofor email support.Contact us here.
Last updated