Dify Integration

Ask Sage Model Provider for Dify

Use Ask Sage as a model provider inside Dify — 47+ governed AI models through one FedRAMP-authorized API

The Ask Sage Model Provider Plugin registers Ask Sage as a native model provider in Dify, the open-source LLM app platform. Once installed, every Ask Sage model (GPT, Claude, Gemini, Llama, Groq, and more) becomes selectable in Dify's model picker for chatflows, agents, workflows, and datasets — using the same Ask Sage API key you already use for other integrations.


Table of Contents
  1. At a Glance
  2. Requirements
  3. Step 1 — Create an Ask Sage Account & API Key
    1. Getting Your API Key
  4. Step 2 — Verify Your Plugin Daemon Version
  5. Step 3 — Install the Plugin
    1. Option A — Install from the Dify Marketplace (recommended)
    2. Option B — Install from a .difypkg Package
    3. Option C — Remote Debugging (development)
  6. Step 4 — Configure Credentials
  7. Refreshing the Model List
  8. Updating the Plugin
  9. Known Issues — Daemon 0.5.3
  10. Known Limitations
  11. Resources & Support

Instance-Specific Base URL: The endpoints and configuration shown reflect the commercial instance at chat.asksage.ai, with an API base URL of https://api.asksage.ai. The api. prefix and path suffix stay the same across deployments — only the instance segment in the middle changes based on which Ask Sage instance you are logging into. Always use the instance approved by your organization and applicable regulatory requirements, and match the API Base URL in the plugin credentials to the instance you authenticate against.


At a Glance

47+ Predefined Models

Auto-generated from the Ask Sage catalog

Dynamic Model Discovery

Fetched at runtime with 5-minute caching

Custom Model Support

Add any model your tenant provides

Token Usage Tracking

Prompt + completion tokens reported to Dify

FedRAMP-Authorized API

Governed inference through Ask Sage

Streaming UI Support

Works with Dify's streaming chat surface

Perfect for: Teams who build chat assistants, agents, and RAG workflows in Dify and want every response routed through Ask Sage's governed, accredited model gateway instead of calling model vendors directly.

Requirements

Before you begin

ComponentVersion
Dify1.0+ with Plugin Daemon
Dify Plugin Daemon0.5.5+ (see Known Issues)
Dify Plugin SDK (dify_plugin)0.5.x (must match the daemon)
Python3.12 (only for remote-debugging installs)
Ask Sage AccountWith API key access

Match the SDK to the daemon. The dify_plugin SDK version must match your Plugin Daemon version. If your daemon is 0.5.x, install dify_plugin>=0.5.0,<0.6.0. A mismatch (for example SDK 0.7.x against a 0.5.x daemon) causes silent connection failures — the plugin appears installed but never connects.


Step 1 — Create an Ask Sage Account & API Key

Get access

This plugin authenticates against the Ask Sage commercial tenant. If you already have an Ask Sage account and API key, skip ahead to Getting Your API Key.

1

Register

Go to chat.asksage.com/register and fill in all required fields (first name, last name, company, email, phone, country).

2

Verify your email

Submit the form and enter the verification code emailed to you. If the code does not arrive, email support@asksage.com to force-validate your account.

3

Sign in

Log in at chat.asksage.com with your email and password. New accounts include a free 30-day trial with 200,000 inference tokens and 200,000 training tokens.

Getting Your API Key

1

Open Account settings

Sign in at chat.asksage.com, click the Settings cog (bottom left), and select the Account tab.

2

Generate a key

Scroll to Manage your API Keys and generate a new key. Save it securely — you will paste it into the plugin in Step 4.

MFA: For multi-factor authentication, we recommend Microsoft Authenticator or Google Authenticator. Configure it on the same Account settings page.


Step 2 — Verify Your Plugin Daemon Version

Check this before installing anything. Dify 1.13.3 ships with dify-plugin-daemon:0.5.3-local by default, which has a bug that breaks .difypkg installation. You must upgrade the daemon to 0.5.5+ before installing any local plugin package. (Installing directly from the Dify Marketplace — Option A below — is signed and not affected, but upgrading the daemon is still recommended.)

In your docker-compose.yaml (for example C:\dify\docker\docker-compose.yaml), find the plugin_daemon service and pin a fixed image:

docker-compose.yaml — plugin_daemon
  plugin_daemon:
    # Daemon 0.5.3 has a struct-tag bug that rejects plugin_unique_identifier
    # on the /decode/from_identifier endpoint. Fixed in 0.5.5 (PR #593).
    image: langgenius/dify-plugin-daemon:0.5.5-local

Then restart the daemon:

PowerShell
cd C:\dify\docker
docker compose up -d plugin_daemon

Step 3 — Install the Plugin

Choose the installation method that fits your environment. Option A (Marketplace) is the simplest for most users; Option B (.difypkg) suits air-gapped or restricted networks; Option C (Remote debugging) is for plugin development.

1

Open the Marketplace

In Dify, go to Plugins (top right) and open the Marketplace tab.

2

Find Ask Sage

Search for AskSage (or open the listing at marketplace.dify.ai/plugin/jlay2026/asksage) and click Install. The package is signed — no host configuration required.

3

Configure credentials

Continue to Step 4 to enter your API key and email.

Option B — Install from a .difypkg Package

Use this for air-gapped instances, test builds, or versions not published to the Marketplace. Requires daemon 0.5.5+ (see Step 2); some instances also require signature verification to be disabled (FORCE_VERIFYING_SIGNATURE=false) for unsigned local packages.

1

Download the package

Download the latest asksage-<version>.difypkg from the project's Releases page.

2

Upload it

In Dify, go to PluginsInstall Plugin and upload the .difypkg file.

3

Configure credentials

Continue to Step 4.

Option C — Remote Debugging (development)

For contributors working on the plugin itself. Run the plugin as a local Python process that connects to your Dify instance.

Clone & set up the environment
git clone https://github.com/JLay2026/asksage-dify-plugin.git
cd asksage-dify-plugin

# Create a Python 3.12 virtual environment
py -3.12 -m venv .venv
.\.venv\Scripts\Activate.ps1    # Windows
# source .venv/bin/activate     # Linux/Mac

pip install -r requirements.txt

Copy .env.example to .env and fill in your debug key. Find the key in the Dify UI under Plugins → the bug icon → Debug Key.

.env
INSTALL_METHOD=remote
REMOTE_INSTALL_HOST=localhost
REMOTE_INSTALL_PORT=5003
REMOTE_INSTALL_KEY=your-debug-key-from-dify

Run the plugin:

Run
python -m main

Step 4 — Configure Credentials

Connect the plugin to Ask Sage

After installing, go to Settings → Model Providers, find AskSage, click it, and enter:

FieldDescription
API KeyYour Ask Sage static API key from Settings → Account → Manage your API Keys in the Ask Sage app.
EmailThe email address associated with your Ask Sage account.
API Base URLDefault: https://api.asksage.ai. Change only if you use a custom or instance-specific Ask Sage deployment (see the callout at the top of this page).

Validation: Click Save. The plugin validates your credentials by calling Ask Sage's /server/get-models endpoint. If the save succeeds, the model list is populated and Ask Sage models are now available in the Dify model picker.

Credentials do not carry over between installs. API key and base URL are not preserved when you uninstall/reinstall or upgrade via .difypkg. Re-enter them after any reinstall.


Refreshing the Model List

Picking up new Ask Sage models

The plugin discovers models dynamically at runtime (cached for 5 minutes), so newly enabled models on your tenant generally appear automatically. To regenerate the bundled predefined-model YAMLs — for example after Ask Sage adds models to your tenant — run the generator script (remote-debugging / source installs):

Regenerate model YAMLs
python generate_models.py

This calls /server/get-models, writes one YAML per model, and updates _position.yaml. Image-generation models are filtered out automatically. Restart the plugin (debug mode) or reinstall the .difypkg to pick up the changes.


Updating the Plugin

How you update depends on how you installed.

Packaged install (.difypkg)

You must repackage and reinstall. The daemon rejects reinstalls at the same version, so bump the version in manifest.yaml first.

1

Pull the latest code & bump the version

Edit version: in manifest.yaml (e.g. 0.1.1 → 0.2.0).

2

Repackage

Run dify plugin package .\asksage from the parent directory (not inside the plugin folder). An "Access is denied" error usually means you are in a directory you cannot write to.

3

Uninstall the old version

In the Dify console: Plugins → find AskSage → uninstall.

4

Upload the new package & re-enter credentials

Install the new .difypkg, then re-enter your API key and base URL (they do not carry over).

Debug mode

Updates are simpler: pull the latest code, then stop the running process (Ctrl+C) and relaunch with python -m main. Dify picks up updated model YAMLs and code on reconnect — no version bump or repackaging required.

Tip: Use debug mode during active development; switch to a Marketplace or .difypkg install for production and team distribution.


Known Issues — Daemon 0.5.3

Dify 1.13.3's default docker-compose.yaml pins langgenius/dify-plugin-daemon:0.5.3-local, which has a bug in the DecodePluginFromIdentifier handler. The Go struct uses a json: tag instead of a form: tag, so Gin cannot bind the plugin_unique_identifier query parameter. The result is a 400 error on /decode/from_identifier immediately after a successful .difypkg upload:

Error
400: Key: 'PluginUniqueIdentifier' Error: Field validation for 'PluginUniqueIdentifier' failed on the 'required' tag

Fix: Upgrade to daemon 0.5.5+ (see Step 2).

References:


Known Limitations

  • No native streaming — Ask Sage's /server/query returns complete responses. The plugin simulates streaming by yielding the full response as a single chunk, so Dify's streaming UI still works.
  • No stop sequences — Ask Sage does not support stop-sequence parameters.
  • Token estimation — Pre-invocation estimates use a 4-characters-per-token heuristic since Ask Sage does not expose a tokenizer endpoint. Actual usage reported back from responses is accurate.
  • No function / tool calling — Tool-calling support varies by underlying model and is not yet exposed through this plugin.

Resources & Support

Feedback Welcome: Have a request or feedback on this integration? Reach out at support@asksage.ai.

Back to top

Copyright © 2026 Ask Sage Inc. All Rights Reserved. Ask Sage is a BigBear.ai company.