Prerequisites
- A Dify workspace where you are an owner or admin.
- The Dify OpenAI-API-compatible model provider plugin installed or available from the marketplace.
- A NEAR AI Cloud API key from the NEAR AI Cloud Dashboard.
The context and output limits above come from the live NEAR AI Cloud
/v1/models metadata for z-ai/glm-5.2.
Install or Select the Plugin
In Dify, open Settings -> Model Providers. If OpenAI-API-compatible is not already listed, install it from the Dify marketplace. After installation, select OpenAI-API-compatible from the model provider list.Add the NEAR AI Cloud Model
Add a custom model with these values:
Keep the model name exactly as NEAR AI Cloud returns it. Do not rename it to
glm-5.2, GLM-5.2-FP8, or an OpenAI model name unless /v1/models lists that exact ID for the gateway.
The four capability fields below the limits default to “off” in the OpenAI-API-compatible plugin, so they must be set explicitly for GLM 5.2 (which advertises tools, structured_outputs, reasoning, and json_mode in /v1/models):
- Function Call Type defaults to
Not Support(no_call). With the default, the plugin does not send the OpenAItoolsarray to NEAR AI Cloud and marks the model non-tool-capable in agent apps. Set it toTool Callto enable tool/agent use. - Thinking Mode Support defaults to
Only Non-Thinking Mode(not_supported), which disables thinking and strips reasoning content from responses. Set it toBoth Modesto expose the thinking toggle and thereasoning_effortparameter. - Compatibility mode defaults to strict. Set it to
Enable extra settingsso the thinking toggle is actually transmitted to the backend; in strict mode theenable_thinkingparameter is not sent. - Structured Output defaults to
Not Support. Set it toSupportto expose the Response Format parameter (text/json_object/json_schema).
Refresh models
Dify custom providers do not necessarily receive the same automatic model updates that Dify system providers receive. Treat the OpenAI-API-compatible NEAR AI Cloud entry as a manual model list. When NEAR AI Cloud releases a new model:-
Fetch the live model metadata:
-
Copy the new model’s exact
id. - In Dify, open Settings -> Model Providers -> OpenAI-API-compatible.
-
Add a new custom model with the copied
id, the same URL, and the context/output limits from the live metadata. - Test and save the new model.