---
title: "Dify OpenAI-API-compatible provider setup (base URL)"
description: "Connect Dify to BroadNet Inference through the OpenAI-API-compatible model provider plugin, with exact field values, context sizes and function calling settings."
url: https://broadrouter.com/guides/dify-openai-api-compatible/
lang: en
updated: 2026-11-16
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# Add BroadNet Inference to Dify with the OpenAI-API-compatible plugin

Updated 2026-11-16

In Dify, install the OpenAI-API-compatible plugin from Integrations, Model Provider, then click Add Model. Choose type LLM, enter a BroadNet model ID such as broadnet/glm-5.3, your BroadNet key and API Base URL https://inference.broadnet.ai/v1. Set Completion mode to Chat, the real context size, an output limit with room for reasoning, and Tool Call only for GLM 5.3 or Qwen3.8 27B.

Dify is an open-source platform for building LLM apps and workflows. Providers that Dify doesn’t list by name are added through the **OpenAI-API-compatible** model provider plugin, published by Dify’s team (langgenius). BroadNet Inference serves standard chat completions at `https://inference.broadnet.ai/v1`, so it fits. BroadRouter is BroadNet’s own site; field names below come from version 0.0.83 of the plugin.

## Setup

1.  **Get a key.** Create a pay-as-you-go key in the BroadNet console.
    
2.  **Install the plugin.** In Dify, go to **Integrations** > **Model Provider**, find **OpenAI-API-compatible** under the providers you can install (or open it in the [Marketplace](https://marketplace.dify.ai/plugin/langgenius/openai_api_compatible)), and install it. You need to be a workspace owner or admin.
    
3.  **Add a model.** Click **Add Model** on the provider card and fill in:
    
    | Field | Value |
    | --- | --- |
    | Model Type | LLM |
    | Model Name | `broadnet/glm-5.3` |
    | Model display name | GLM 5.3 (BroadNet) |
    | API Key | your BroadNet key |
    | API Base URL | `https://inference.broadnet.ai/v1` |
    | Completion mode | Chat |
    | Model context size | `1048576` |
    | Upper bound for max tokens | `16000` |
    | Function Call Type | Tool Call |
    | Vision Support | Not Support |
    | Structured Output | Support |
    | API Type | Chat Completions API (/chat/completions) |
    | Token parameter name | Use max\_tokens |
    
4.  **Save.** Dify checks the credentials before it adds the model.
    
5.  **Test it.** Create a Chatbot app, select **GLM 5.3 (BroadNet)** in the model picker and send a message in the preview pane.
    

Repeat **Add Model** for each BroadNet model you want. The model name must match BroadNet’s ID exactly, including the `broadnet/` prefix.

## Per-model values

| Model Name | Context size | Function Call Type | Vision Support |
| --- | --- | --- | --- |
| `broadnet/glm-5.3` | 1048576 | Tool Call | Not Support |
| `broadnet/qwen3.8-27b` | 262144 | Tool Call | Support |
| `broadnet/deepseek-v4.1-flash` | 1048576 | Not Support (untested) | Support |
| `broadnet/gemma-4-26b-a4b` | 32768 | Not Support | Support |

Why these choices:

-   **Context size** defaults to 4,096 in the plugin. Left there, Dify trims memory and retrieved context far below what the model accepts.
-   **Upper bound for max tokens** also defaults to 4,096. Three of the models reason before they answer, and the reasoning counts toward this limit, so give them room. 16,000 is our suggestion, not a BroadNet limit.
-   **Token parameter name** set to `max_tokens` matches the field in BroadNet’s API reference. The plugin’s default is to guess from the model name.
-   **API Type** stays on Chat Completions. BroadNet doesn’t list the Responses API.

## Transcription

The plugin can also add speech-to-text models. BroadNet serves `/v1/audio/transcriptions` with `broadnet/cohere-transcribe-arabic` for Arabic and `broadnet/cohere-transcribe` for 14 languages. The plugin’s README says that for speech-to-text it adds the version path itself, so its example uses the host without `/v1` (here, `https://inference.broadnet.ai`). We have not tested this path through Dify; check it with a short WAV file first. See the [Arabic speech-to-text guide](https://broadrouter.com/guides/arabic-speech-to-text-api/).

## Troubleshooting

-   **Credential check fails.** Check the key, the API Base URL (it ends in `/v1` for LLMs) and the model name. Paid models need a top-up; the $5 credit covers only `broadnet/gemma-4-26b-a4b` and the two Transcribe models.
-   **Empty replies in a workflow.** The LLM node’s max tokens is too low for a reasoning model. Raise it. [Why answers come back empty](https://broadrouter.com/guides/reasoning-tokens-empty-response/).
-   **Agent node never calls tools.** Use GLM 5.3 or Qwen3.8 27B with Function Call Type set to Tool Call.
-   **429 under load.** A pay-as-you-go key allows 30 requests a minute and 4 in flight. Parallel branches and iteration nodes can exceed that; lower their parallelism. See [errors and retries](https://broadrouter.com/guides/errors-and-retries/).

## Terms in this guide

[Token](https://broadrouter.com/glossary/token/)

A token is the unit of text a language model reads and writes: a word, part of a word, a punctuation mark or a byte sequence produced by the model's tokenizer. LLM APIs count, limit and usually bill usage in tokens.

[Base URL](https://broadrouter.com/glossary/base-url/)

A base URL is the fixed root address of an API, such as https://api.example.com/v1, that a client puts in front of every endpoint path, such as /chat/completions. In OpenAI-compatible SDKs, changing the base URL, together with the API key and model ID, points the same code at a different provider.

[Chat Completions API](https://broadrouter.com/glossary/chat-completions-api/)

The Chat Completions API is OpenAI's HTTP endpoint, POST /v1/chat/completions, that takes a model name and a list of role-tagged messages and returns the model's next message. Its request and response shape became the common format that OpenAI-compatible providers and SDKs reuse.

[Pay-as-you-go](https://broadrouter.com/glossary/pay-as-you-go/)

Pay-as-you-go is a pricing model in which you pay only for what you use, metered per unit such as tokens, requests or audio minutes, with no subscription or minimum commitment. Most LLM APIs bill this way, from a prepaid balance or a periodic invoice.

[Context window](https://broadrouter.com/glossary/context-window/)

A context window is the maximum number of tokens a language model can work with in a single request. It covers the prompt, conversation history, tool definitions, images and the generated output, including any reasoning tokens. Anything that does not fit must be cut, summarised or split across several requests.

[Speech-to-text](https://broadrouter.com/glossary/speech-to-text/)

Speech-to-text, also called automatic speech recognition (ASR), is technology that converts spoken audio into written text. A speech-to-text API accepts an audio file or stream and returns a transcript, usually priced per minute of audio. Accuracy is measured with word error rate and varies with accent, dialect and recording quality.

[WAV](https://broadrouter.com/glossary/wav/)

WAV (Waveform Audio File Format, or WAVE) is an audio container built on Microsoft and IBM's RIFF format. It usually holds uncompressed linear PCM samples, so its size is predictable: sample rate times bytes per sample times channels, per second.

[API key](https://broadrouter.com/glossary/api-key/)

An API key is a secret string that identifies and authorizes a client calling an API. LLM APIs usually expect it in an Authorization: Bearer header, and anyone who holds the key can make requests that are billed to the account that owns it.

## Questions

### Does BroadNet work on Dify Cloud as well as self-hosted Dify?

Yes. BroadNet Inference is a public HTTPS endpoint, so Dify Cloud can reach it. Dify's docs say only workspace owners and admins can manage model providers, and a key you add works across the whole workspace.

### Should the API Base URL include /v1?

Yes, for LLM models. The plugin's own examples use a base URL ending in /v1 for chat models, and its README warns that for some other model types it adds the version path itself.

### Which Function Call Type should I pick?

Tool Call for GLM 5.3 and Qwen3.8 27B, which BroadNet lists with tools. Choose Not Support for DeepSeek V4.1 Flash unless you have tested tool calls on it yourself.

### Do Dify AI credits apply to BroadNet models?

No. Dify's docs say AI credits don't apply to providers you run on your own account. BroadNet bills the key you enter.

## Related guides

-   [Use BroadNet Inference in n8n (OpenAI credential, Base URL)](https://broadrouter.com/guides/n8n-openai-compatible/)
-   [Connect Open WebUI to BroadNet Inference](https://broadrouter.com/guides/open-webui-openai-api/)
-   [Why a reasoning model returns an empty answer](https://broadrouter.com/guides/reasoning-tokens-empty-response/)
-   [BroadNet Inference error codes and when to retry](https://broadrouter.com/guides/errors-and-retries/)
-   [All tools that work with BroadNet Inference](https://broadrouter.com/integrations/): SDKs, coding agents, chat UIs and automation tools, with exact settings for each

Try it on your real workload. New accounts start with $5 of credit for Gemma and transcription. DeepSeek, GLM and Qwen3.8 need a top-up.

[Get started](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=guides-dify-openai-api-compatible&utm_content=page-cta) ·

**Sources**

-   [Dify docs, Model Providers (checked 2026-11-15)](https://docs.dify.ai/en/cloud/use-dify/workspace/model-providers)
-   [Dify Marketplace, OpenAI-API-compatible plugin by langgenius, version 0.0.83 (checked 2026-11-15)](https://marketplace.dify.ai/plugin/langgenius/openai_api_compatible)
-   [Plugin source, openai\_api\_compatible provider fields (checked 2026-11-15)](https://github.com/langgenius/dify-official-plugins/tree/main/models/openai_api_compatible)
-   [BroadNet Inference API reference (checked 2026-11-15)](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=guides-dify-openai-api-compatible&utm_content=sources)
