Integrations
Connect Dify to bnrouter (OpenAI-compatible)
Set Dify’s OpenAI-API-compatible provider to bnrouter Base URL and an API key.
Updated: 2026-10-27 · Verification: docs_checked (vendor docs cross-check; UI not E2E lab-verified)
Answer
Point Dify’s OpenAI-API-compatible provider at https://console.bnrouter.com/v1 with a bnrouter API key and a model ID from GET /models. Chat-only workflows map to chat completions; image/video nodes need separate endpoints and are not covered by this chat setup.
https://console.bnrouter.com/v1
Prerequisites
Dify workspace with permission to add a model provider; bnrouter account + API key; model ID from the console or GET /models. Placeholder MODEL_ID is used below until you pick a live ID.
Checked versions: Dify Cloud / self-host OpenAI-API-compatible provider (docs checked 2026-10-27)
Protocols: OpenAI-compatible chat completions
Steps
- Create a bnrouter API key
Sign up or sign in, open API Keys, create a key. Do not paste the key into public repos or analytics events.
- Add OpenAI-API-compatible provider in Dify
Integrations → Model Provider → install OpenAI-API-compatible (marketplace/plugin). API Base URL: https://console.bnrouter.com/v1 (already includes /v1 — do not append another /v1). API Key: your bnrouter key. Field names follow the official plugin README (Type, Name, API Key, API Base URL).
- Register a model ID
Add a model whose name/ID matches a live gateway model (replace MODEL_ID). Completion URL used by the gateway is https://console.bnrouter.com/v1/chat/completions. Confirm availability via GET /models — do not invent IDs from marketing names.
- Smoke-test in a Dify chat app
Create or open a chat app, select the bnrouter model, send a short prompt. Success = streamed or non-stream reply without provider auth errors.
Expected success
Dify returns a model completion using your bnrouter key; gateway usage appears for that key (check console usage if available).
Troubleshooting
- 401: Invalid or missing API key; regenerate in console and update Dify secrets.
- 403: Key or account lacks access to that model/group; switch MODEL_ID or fix key permissions.
- 404: Wrong Base URL (extra /v1) or unknown model ID. Base must be exactly https://console.bnrouter.com/v1.
- 429: Rate limited or quota exhausted; retry with backoff or top up / wait.
- stream: If streaming stalls, disable stream in the Dify model config for a non-stream smoke test, then re-enable.
Sources
- Dify — Model Providers (workspace) (checked 2026-10-27)
- langgenius/dify-official-plugins — openai_api_compatible README (checked 2026-10-27)
Notes
Verification status: docs_checked against Dify public docs on 2026-10-27. UI labels may differ by Dify version; this is not a claim of full E2E lab verification on every release.