Dify & n8n (no-code)
Wire Dify workflows and n8n automations to ToRouter via their OpenAI-compatible provider slots.
Both Dify and n8n ship an "OpenAI-compatible" provider that takes a custom base URL — point it at ToRouter and any model in the catalog becomes available inside your workflows and nodes.
Configuration
| Field | Value |
|---|---|
| API endpoint / Base URL | https://portal.torouter.ai/v1 |
| API key | sk-*** |
| Model name | gpt-5, claude-opus-4-7, gemini-2.5-pro, ... |
Dify
Open model providers
In Dify go to Settings → Model Provider (top-right avatar → Settings).
Add OpenAI-API-compatible
Find OpenAI-API-compatible in the provider list and click Setup.
Fill in ToRouter
- Model Name: paste a model id from the catalog, e.g.
claude-opus-4-7 - API Key:
sk-*** - API endpoint URL:
https://portal.torouter.ai/v1 - Completion mode:
Chat - Leave other fields at defaults
Click Save. Dify validates by issuing a small completion.
Use in workflows
Open any LLM node in a workflow / chatflow — the model you just added appears in the model picker.
n8n
Drop an OpenAI Chat Model node
In your n8n workflow add a OpenAI Chat Model node (under AI / LangChain nodes).
Create new credentials
Click Credentials → Create New. Choose OpenAI API.
- API Key:
sk-*** - Base URL:
https://portal.torouter.ai/v1
Save.
Pick a model
In the node's Model field type the model id (e.g. gpt-5). The dropdown won't auto-populate model lists for custom base URLs, so type it manually.
Gotchas
- In Dify, Model Name has to be added per model — each entry creates one usable slot. Re-open the provider config to add more.
- Dify caches model capability info on save; if a new model type errors out, re-save with the right Completion mode (
ChatvsCompletion). - n8n stores credentials per-workflow scope. If you have multiple environments, create separate credentials so prod / dev keys don't mix.
- Both tools default to OpenAI tool-calling schema. When using Claude models for tool-using nodes, validate that your function schemas don't rely on OpenAI-only fields.