When Dify will not save an OpenAI-API-compatible model for the gateway, the refusal comes from the credential check Dify runs on save, and it traces back to one of four places: API Base URL, API Key, Model Name, or the model type the entry is added under. This page is the troubleshooting companion to the Dify setup guide, which walks through the working form field by field; here you start from the failed save and find the field behind it. The base is https://api.uplinkswitch.com/v1.
Read the error Dify shows
Dify sends a short test request when you save a model, and a failed test is reported with its status code, often with the response body as well. Look for the status and the code in that text before you edit anything, because each code points at one field:
| Code in the error | Field to fix |
|---|---|
404 route_not_found | API Base URL carries a path after /v1 |
401 invalid_api_key | API Key is empty, mistyped or revoked |
403 scope_denied | The key's allowlist leaves out this model |
404 model_not_found | Model Name is not a catalog id |
| 402 | The balance or the key's budget is spent |
Other gateway statuses carry their own code in the body too: a 429 is a rate limit, and a 502 or 503 means the model side failed or was busy, so retry the save after a pause. A refused connection or a DNS failure points at the network between Dify and the gateway, while a timeout alone does not tell you whether the request arrived.
API Base URL ends at /v1
The provider appends the route for the mode you chose, so the field takes the gateway root and nothing after it. With /chat/completions pasted on the end, the test request lands on a doubled path and the gateway replies 404 route_not_found, which Dify reports as a failed validation that reads like a model problem. Enter https://api.uplinkswitch.com/v1 exactly, with no trailing slash.
On a self-hosted Dify the save is checked from the Dify server, not from your browser. A corporate proxy, or a container with no outbound access, fails the save even when the same URL answers from your laptop.
API Key and the 401
A 401 with invalid_api_key means the base resolved and the key did not. The message separates the two usual cases: No API key was sent. for an empty field, and The API key is not valid. for a wrong value. Paste a current sk-uplink-live-... key. A key restricted to other models still authenticates and fails with 403 scope_denied instead, so a 401 is never a permissions setting.
Model Name and model type
Model Name must be a catalog id spelled exactly, without a provider prefix, and the model type must be LLM for a chat id; an embedding or rerank type sends a test of the wrong kind. Check the id without a key:
curl https://api.uplinkswitch.com/v1/catalogWhen a model that saved before begins failing, read its availability in that reply. The 2026-11-23 snapshot showed deepseek-v4.1-flash as ok and gpt-6.1-sol as ok; a degraded id calls for adding a sibling entry, not for rebuilding the provider.
Calls that fail after a clean save
A save proves one short test request, not every call an app will send. The usual later failure is a size setting: a model context size or a max tokens bound larger than the id allows. Copy both from the catalog entry instead of guessing, so gpt-6.1-sol gets 1.1M of context and at most 128K of output. Each model is its own entry under the one provider; reaching another id never takes a second provider.