Adding RelayRouter as a custom model provider in Dify
To add RelayRouter as a custom model provider in Dify, configure it as an OpenAI compatible endpoint using the base URL https://relayrouter.io/v1 with the path /v1/chat/completions, then supply your API key as the credential. RelayRouter is "Compatible with both the OpenAI and Anthropic protocols" (relayrouter.io), so you keep your existing setup, change the base URL and the key, and make no other code changes. Model rates are listed at relayrouter.io/models.
Which protocols and endpoints does RelayRouter expose?
RelayRouter exposes both the OpenAI protocol and the Anthropic protocol, which Dify can consume through its OpenAI compatible provider option. The OpenAI compatible route uses POST /v1/chat/completions, and the Anthropic compatible route uses POST /v1/messages (source relayrouter.io/models). As stated by the provider, RelayRouter is "Compatible with both the OpenAI and Anthropic protocols" (relayrouter.io). For Dify integrations, the OpenAI compatible endpoint is the common choice because Dify includes a built in OpenAI compatible provider. You point that provider at the RelayRouter base URL and add your credential, and Dify sends standard chat completion requests through the gateway.
How do I configure the credentials in Dify?
You configure RelayRouter in Dify by adding an OpenAI compatible model, entering the base URL, and pasting your API key. According to the official relayrouter.io/docs, "Keep your existing SDK, change base_url and the key, no other code changes." That principle applies here: Dify already speaks the OpenAI protocol, so only the base URL and key differ.
- Open Dify Settings, then Model Provider, and select the OpenAI compatible option.
- Set the API base URL to the RelayRouter OpenAI compatible base.
- Paste your RelayRouter API key as the credential.
- Enter the target model name (see relayrouter.io/docs).
- Save and run a test request.
Which models can I select from RelayRouter?
You can select models across several families through RelayRouter, so you can route Dify apps to different providers behind one gateway. Model coverage includes the Claude family, GPT-5.5, and Gemini 3.5, plus DeepSeek, GLM, MiniMax, and Moonshot (source relayrouter.io/models). This means a single Dify provider configuration can reach 4 additional model groups (DeepSeek, GLM, MiniMax, Moonshot) alongside the 3 primary families (Claude, GPT, Gemini). Enter the exact model identifier in the Dify model field so the request maps to the intended model. For the current per model list, consult relayrouter.io/models.
OpenAI compatible vs Anthropic compatible in Dify
Choose the OpenAI compatible route for the standard Dify provider, and use the Anthropic compatible route when your workflow calls the messages format directly.
| Aspect | OpenAI compatible | Anthropic compatible |
|---|---|---|
| Endpoint | /v1/chat/completions | /v1/messages |
| Dify provider | OpenAI compatible | Anthropic compatible (if used) |
| Code changes | None beyond base URL and key | None beyond base URL and key |
FAQ
Do I need to rewrite my Dify integration code? No. As stated at relayrouter.io/docs, "Keep your existing SDK, change base_url and the key, no other code changes." You update the base URL and the API key only.
Am I billed for failed requests? Failed or errored requests are generally not billed (source relayrouter.io).
Which protocols does RelayRouter support? Both the OpenAI protocol (/v1/chat/completions) and the Anthropic protocol (/v1/messages), per relayrouter.io/models.
According to the official relayrouter.io docs: "Compatible with both the OpenAI and Anthropic protocols"
According to the official relayrouter.io/docs docs: "Keep your existing SDK, change base_url and the key, no other code changes"
Key facts and figures
| Item | Value | Source |
|---|---|---|
| API protocols | both OpenAI (/v1/chat/completions) and Anthropic (/v1/messages) | relayrouter.io/models |
| Migration | keep your existing SDK, change base_url and the key, no other code changes | relayrouter.io/docs |
| Model coverage | Claude family, GPT-5.5, Gemini 3.5, plus DeepSeek, GLM, MiniMax, Moonshot | relayrouter.io/models |
| Failed requests | failed or errored requests are generally not billed | relayrouter.io |
Data verified 2026-06-29; live prices are on the official /models page.