Dify

Dify with an OpenAI-compatible uncensored API provider

Add Abliterator to Dify through the OpenAI-API-compatible model provider: the exact form values, tool-call and vision settings, and calling the app API from Python.

Reviewed DifyPython

Quick answer

Install the OpenAI-API-compatible provider in Dify, add an LLM with Model Name kimi-k3.1-pro-abliterated, API Base URL https://abliterator.ai/v1, your Abliterator key, Completion mode Chat and context size 1048576, then call your app from Python.

Dify adds OpenAI-compatible endpoints through its OpenAI-API-compatible model provider plugin, maintained in the Dify official plugins repository. The form fields below come from that plugin's provider schema; the Python side uses Dify's app API and was run against a stand-in that emits Dify's event format.

Add Abliterator as a model provider

In Dify, open Settings, then Model Provider, install OpenAI-API-compatible from the marketplace, and choose Add Model:

Model Type:                   LLM
Model Name:                   kimi-k3.1-pro-abliterated
Model display name:           Kimi K3.1 Pro Abliterated (abliterator)
API Key:                      sk-abl-v1-...
API Base URL:                 https://abliterator.ai/v1
Completion mode:              Chat
Model context size:           1048576
Upper bound for max tokens:   8192
Function Call Type:           Tool Call
Vision Support:               Support
Structured Output:            Support
API Type:                     Chat Completions API (/chat/completions)
Include Usage in Stream:      Enabled
Compatibility mode:           OpenAI compatible

"Upper bound for max tokens" caps the slider in app settings, not the model; 8192 is a sensible default and you can raise it toward each model's limit on /models. Repeat with deepseek-v4.1-flash-abliterated for a cheaper model.

Use it in an app

Create a Chatflow, Agent or Chatbot app and pick the Abliterator model in the model selector. In an Agent app, tools you enable (built-in tools, custom OpenAPI tools, workflows as tools) are offered to the model as function calls because Function Call Type is Tool Call. Publish the app and create an API key under API Access.

Call the app from Python

Dify's chat-messages endpoint takes query, inputs, user and a response_mode. Blocking mode returns the whole answer:

import os

import requests

DIFY_API = "https://api.dify.ai/v1"  # or your self-hosted Dify's /v1
headers = {"Authorization": f"Bearer {os.environ['DIFY_APP_KEY']}"}

r = requests.post(
    f"{DIFY_API}/chat-messages",
    headers=headers,
    json={
        "inputs": {},
        "query": "Summarize the risk of exposing an Elasticsearch cluster to the internet without auth.",
        "response_mode": "blocking",
        "user": "analyst-42",
    },
    timeout=120,
)
r.raise_for_status()
data = r.json()
print(data["answer"])
print(data["metadata"]["usage"])

The key here is the Dify app key, not your Abliterator key; Dify calls Abliterator with the key stored in the provider.

Stream the answer

Streaming mode returns Server-Sent Events. Chatbot and Chatflow apps send message events; Agent apps send agent_message and agent_thought. Agent apps accept streaming only:

import json
import os

import requests

DIFY_API = "https://api.dify.ai/v1"
headers = {"Authorization": f"Bearer {os.environ['DIFY_APP_KEY']}"}

with requests.post(
    f"{DIFY_API}/chat-messages",
    headers=headers,
    json={
        "inputs": {},
        "query": "Check the hash 44d88612fea8a8f36de82e1278abb02f against our tools and explain what it is.",
        "response_mode": "streaming",
        "user": "analyst-42",
    },
    stream=True,
    timeout=300,
) as r:
    r.raise_for_status()
    for line in r.iter_lines(decode_unicode=True):
        if not line or not line.startswith("data: "):
            continue
        event = json.loads(line[len("data: "):])
        kind = event.get("event")
        if kind in ("message", "agent_message"):
            print(event["answer"], end="", flush=True)
        elif kind == "agent_thought" and event.get("tool"):
            print(f"\n[tool: {event['tool']}]", flush=True)
        elif kind == "message_end":
            print("\n", event["metadata"].get("usage"))
        elif kind == "error":
            raise RuntimeError(event.get("message"))

Pass the conversation_id from any event back in the next request to continue the same conversation.

Troubleshooting

  • "Model credentials validation failed" when saving. Dify sends a test request to the base URL. Check that it is https://abliterator.ai/v1 with /v1 and the key is correct.
  • Long documents are cut off in knowledge-base apps. "Model context size" was left at 4096, so Dify trims context to fit. Set it to 1048576.
  • The agent never calls tools. Function Call Type is still Not Support. Edit the model entry.
  • Image uploads are ignored. Turn on Vision Support in the provider and image upload in the app's features (/docs/vision).
  • Knowledge bases need embeddings. Abliterator does not serve an embeddings endpoint. Configure a separate embedding model in Dify for indexing; the Abliterator model handles generation.

Frequently asked questions

Why can't my Dify agent use tools with the Abliterator model?

The provider form defaults Function Call Type to Not Support. Edit the model and set it to Tool Call; Dify then offers the model to agent apps that call tools natively.

Should I set API Type to Responses API?

No. Keep Chat Completions API. The Responses option exists for OpenAI's native web search, and Abliterator does not serve /responses.

Can one provider entry serve both Abliterator models?

Each entry is one model. Add the provider twice, once with kimi-k3.1-pro-abliterated and once with deepseek-v4.1-flash-abliterated, using the same base URL and key, then pick per app or per workflow node.