A Dify plugin that integrates AskSage as a model provider, giving you access to 47+ AI models (GPT, Claude, Gemini, Llama, Groq, and more) through AskSage's FedRAMP-authorized API.
- 47+ predefined models auto-generated from AskSage's model catalog
- Custom model support -- add any model your AskSage tenant provides
- Dynamic model discovery -- fetches available models from the API at runtime with 5-minute caching
- Token usage tracking -- reports prompt and completion tokens back to Dify
- Simulated streaming -- works with Dify's streaming UI even though AskSage uses synchronous responses
- Model generator script -- run
generate_models.pyto refresh model YAMLs when AskSage adds new models
This plugin uses the AskSage commercial tenant at chat.asksage.com.
- Go to chat.asksage.com/register
- Fill in all required fields (first name, last name, company, email, phone, country)
- Submit the form -- you will receive a verification code via email
- If you do not receive the code, email support@asksage.com to force-validate your account
- Log in at chat.asksage.com with your email and password
- New accounts receive a free 30-day trial with 200,000 inference tokens and 200,000 training tokens
| Plan | Price | Tokens/Month |
|---|---|---|
| Bring Your Own LLMs | From $15/mo/user | Unlimited |
| Standard | $30/mo/user | 500K |
| Plus | $50/mo/user | 1M |
| Enterprise | $90/mo or $990/yr | 2M |
Contact sales@asksage.com for enterprise pricing and volume discounts.
- Sign in at chat.asksage.com
- Click the Settings cog (bottom left)
- Select the Account tab
- Scroll to Manage your API Keys
- Generate a new key -- save it securely (you will need it for the plugin)
For MFA setup, we recommend Microsoft Authenticator or Google Authenticator. Configure it in the same Account settings page.
| 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 daemon) |
| Python | 3.12 |
| AskSage Account | With API key access |
Important: The dify_plugin SDK version must match your Plugin Daemon version. If your daemon is 0.5.3, install dify_plugin>=0.5.0,<0.6.0. A version mismatch (e.g., SDK 0.7.x with daemon 0.5.x) will cause silent connection failures.
The plugin is published to the Dify Marketplace. Marketplace packages are signed by Dify and install cleanly without any host-side configuration.
- In Dify, go to Plugins (top right)
- Click Explore Marketplace (or visit the listing directly)
- Search for AskSage and click Install
- Configure credentials (see below)
This is the path 99% of users want. Skip to Credential Setup below.
Use this path only when:
- Your Dify instance is air-gapped and can't reach the Marketplace
- You're testing an unreleased build of the plugin
- You need to install a version that's no longer on the Marketplace
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.
In your docker-compose.yaml (e.g. C:\dify\docker\docker-compose.yaml), find the plugin_daemon service and update the image:
plugin_daemon:
# IMPORTANT: Daemon 0.5.3 has a struct-tag bug that rejects
# plugin_unique_identifier on the /decode/from_identifier endpoint.
# This was fixed in 0.5.5 via dify-plugin-daemon PR #593.
# See: https://github.com/langgenius/dify-plugin-daemon/pull/593
image: langgenius/dify-plugin-daemon:0.5.5-localThen restart the daemon:
cd C:\dify\docker
docker compose up -d plugin_daemonDify rejects unsigned .difypkg files by default with the error: "plugin verification has been enabled, and the plugin you want to install has a bad signature". Local builds and GitHub Release downloads are unsigned from Dify's perspective.
To allow installation, append the following to your docker/.env:
FORCE_VERIFYING_SIGNATURE=false
Then restart Dify:
cd docker
docker compose down
docker compose up -d
Warning: This disables signature checks for all plugins on this Dify instance, not just AskSage. For shared or multi-tenant deployments, prefer Option A or set up third-party key allow-listing (
THIRD_PARTY_SIGNATURE_VERIFICATION_ENABLED+THIRD_PARTY_SIGNATURE_VERIFICATION_PUBLIC_KEYS) instead.
- Download
asksage-X.Y.Z.difypkgfrom the Releases page - In Dify, go to Plugins (top right)
- Click Install Plugin
- Upload the
.difypkgfile - Configure credentials (see below)
-
Clone this repo:
git clone https://github.com/JLay2026/asksage-dify-plugin.git cd asksage-dify-plugin -
Create a virtual environment:
py -3.12 -m venv .venv .\.venv\Scripts\Activate.ps1 # Windows source .venv/bin/activate # Linux/Mac -
Install dependencies:
pip install -r requirements.txt -
Copy
.env.exampleto.envand fill in your debug key:INSTALL_METHOD=remote REMOTE_INSTALL_HOST=localhost REMOTE_INSTALL_PORT=5003 REMOTE_INSTALL_KEY=your-debug-key-from-difyTo find your debug key: Dify UI > Plugins > click the bug icon > copy Debug Key.
-
Run the plugin:
python -m main
After installing the plugin, configure it in Dify:
- Go to Settings > Model Providers
- Find AskSage and click it
- Enter the following:
| Field | Description |
|---|---|
| API Key | Your AskSage static API key. Find it at Settings > Account > Manage your API Keys in the AskSage app. |
| The email address associated with your AskSage account. | |
| API Base URL | Default: https://api.asksage.ai. Only change if you use a custom AskSage deployment. |
- Click Save -- the plugin validates your credentials by calling AskSage's
/server/get-modelsendpoint.
When AskSage adds new models to your tenant:
python generate_models.py
This calls /server/get-models, generates a YAML file for each model, and updates _position.yaml. Image-generation models are automatically filtered out. Restart the plugin or reinstall the .difypkg to pick up the changes.
asksage/
├── _assets/ # Provider icons (SVG)
├── models/llm/
│ ├── _position.yaml # Model display order
│ ├── *.yaml # One file per predefined model
│ └── llm.py # LLM implementation (core logic)
├── provider/
│ ├── asksage.yaml # Provider config and credential schemas
│ └── asksage.py # Credential validation
├── manifest.yaml # Plugin manifest
├── main.py # Entry point
├── generate_models.py # Model YAML generator script
├── requirements.txt # Python dependencies
└── .env.example # Environment template
When the plugin code is updated (new features, model changes, bug fixes), the update process depends on how you installed the plugin.
If you installed via the Dify Marketplace, updates appear automatically in the Plugins page when a new version is published. Click Update to upgrade in place — credentials are preserved.
If you installed via a .difypkg upload, you must repackage and reinstall:
-
Pull the latest code:
cd C:\projects\asksage_plugin_dify\asksage git pull origin main
-
Bump the version in
manifest.yaml— the daemon rejects reinstalls at the same version:# Example: 0.1.0 → 0.2.0 (Get-Content manifest.yaml -Raw) -replace 'version: 0.1.0', 'version: 0.2.0' | Set-Content manifest.yaml -NoNewline -Encoding ([System.Text.UTF8Encoding]::new($false))
-
Repackage — run from the parent directory, not from inside the plugin folder:
cd C:\projects\asksage_plugin_dify & "$HOME\bin\dify.exe" plugin package .\asksage
This writes
asksage.difypkgtoC:\projects\asksage_plugin_dify\. If you get "Access is denied", you are likely in a directory you don't have write access to (e.g.C:\). -
Uninstall the old version in the Dify console: Plugins → find AskSage → delete/uninstall.
-
Upload the new
.difypkg: Plugins → Install Plugin → upload the new file. -
Re-enter credentials — API key and base URL do not carry over between installs. Go to the AskSage provider settings and re-enter them.
If you are running in debug mode (local Python process), updates are simpler:
-
Pull the latest code:
cd C:\projects\asksage_plugin_dify\asksage git pull origin main
-
Restart the plugin — stop the running process (Ctrl+C) and relaunch:
.\.venv\Scripts\Activate.ps1 python -m mainDify picks up updated model YAMLs and code on reconnect. No version bump or repackaging required.
Tip: Use debug mode during active development. Switch to
.difypkgfor production or team distribution.
Dify 1.13.3's default docker-compose.yaml pins langgenius/dify-plugin-daemon:0.5.3-local, which contains 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' tag
Fix: Upgrade to daemon 0.5.5+ (see installation instructions above).
References:
- dify-plugin-daemon PR #593 -- daemon-side fix (included in 0.5.5)
- dify PR #34720 -- API-side backward-compatible fix (merged to main, not yet released)
- dify issue #34274 -- original bug report
- No native streaming -- AskSage's
/server/queryreturns complete responses. The plugin simulates streaming by yielding the full response as a single chunk. - No stop sequences -- AskSage does not support stop sequence parameters.
- Token estimation -- Uses a 4-chars-per-token heuristic for pre-invocation estimates since AskSage does not expose a tokenizer endpoint. Actual usage from responses is reported accurately.
- No function/tool calling -- AskSage's tool calling support varies by underlying model and is not yet exposed through this plugin.
Apache 2.0