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
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
Dify is an open-source platform for building LLM applications — chat assistants, agents, workflows, and RAG pipelines. The Ask Sage plugin plugs Ask Sage in as a model provider, so the entire Ask Sage model catalog appears in Dify's model selector with the same security boundary, logging, and policy controls you already get from Ask Sage. No model-by-model wiring and no separate per-model credentials.
Requirements
| Component | Version |
|---|---|
| Dify | 1.0+ with Plugin Daemon |
| Dify Plugin Daemon | 0.5.5+ (see Known Issues) |
Dify Plugin SDK (dify_plugin) | 0.5.x (must match the daemon) |
| Python | 3.12 (only for remote-debugging installs) |
| Ask Sage Account | With 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
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.
Register
Go to chat.asksage.com/register and fill in all required fields (first name, last name, company, email, phone, country).
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.
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
Open Account settings
Sign in at chat.asksage.com, click the Settings cog (bottom left), and select the Account tab.
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:
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-localThen restart the daemon:
cd C:\dify\docker
docker compose up -d plugin_daemonStep 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.
Option A — Install from the Dify Marketplace (recommended)
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.
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.
Download the package
Download the latest asksage-<version>.difypkg from the project's Releases page.
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.
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.txtCopy .env.example to .env and fill in your debug key. Find the key in the Dify UI under Plugins → the bug icon → Debug Key.
INSTALL_METHOD=remote
REMOTE_INSTALL_HOST=localhost
REMOTE_INSTALL_PORT=5003
REMOTE_INSTALL_KEY=your-debug-key-from-difyRun the plugin:
python -m mainStep 4 — Configure Credentials
After installing, go to Settings → Model Providers, find AskSage, click it, and enter:
| Field | Description |
|---|---|
| API Key | Your Ask Sage static API key from Settings → Account → Manage your API Keys in the Ask Sage app. |
| The email address associated with your Ask Sage account. | |
| API Base URL | Default: 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
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):
python generate_models.pyThis 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.
You must repackage and reinstall. The daemon rejects reinstalls at the same version, so bump the version in manifest.yaml first.
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:
400: Key: 'PluginUniqueIdentifier' Error: Field validation for 'PluginUniqueIdentifier' failed on the 'required' tagFix: Upgrade to daemon 0.5.5+ (see Step 2).
References:
- dify-plugin-daemon PR #593 — daemon-side fix (included in 0.5.5)
- dify PR #34720 — API-side backward-compatible fix
- dify issue #34274 — original bug report
Known Limitations
- No native streaming — Ask Sage's
/server/queryreturns 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
- Marketplace listing: marketplace.dify.ai/plugin/jlay2026/asksage
- Source & releases: github.com/JLay2026/asksage-dify-plugin
- Dify documentation: docs.dify.ai
- Ask Sage support: support@asksage.com