A model name can work in one tool and fail in another if the surrounding configuration is not identical. Dify may use one Base URL, Cursor may store a different API Key, and a Node.js service may send a model name copied from an older route. When the failure shows up as model_not_found, the fastest useful response is a small canary that proves which part of the path is healthy.
This tutorial builds a Node.js canary for Vector Engine used as an OpenAI-compatible API gateway and LLM API provider layer. The canary sends one tiny chat completion request for each tool profile, records the response status, and prints a focused checklist for Dify, Cursor, and Node.js operators.
Use these settings in every profile:
Base URL: https://api.vectorengine.cn/v1
API Key: keep it in the tool secret store or environment variable
model name: keep one approved route name per profile
Create vector-engine-canary.mjs:
const profiles = [
{
name: "Dify workflow",
apiKey: process.env.DIFY_VECTOR_ENGINE_API_KEY,
model: process.env.DIFY_VECTOR_ENGINE_MODEL,
},
{
name: "Cursor workspace",
apiKey: process.env.CURSOR_VECTOR_ENGINE_API_KEY,
model: process.env.CURSOR_VECTOR_ENGINE_MODEL,
},
{
name: "Node.js service",
apiKey: process.env.VECTOR_ENGINE_API_KEY,
model: process.env.VECTOR_ENGINE_MODEL,
},
];
const baseUrl = "https://api.vectorengine.cn/v1";
async function runCanary(profile) {
if (!profile.apiKey || !profile.model) {
return {
name: profile.name,
ok: false,
category: "local_config",
detail: "API Key or model name is missing before the request is sent.",
};
}
const response = await fetch(`${baseUrl}/chat/completions`, {
method: "POST",
headers: {
Authorization: `Bearer ${profile.apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: profile.model,
messages: [
{
role: "user",
content: "Reply with the word ready.",
},
],
temperature: 0,
}),
});
const text = await response.text();
if (response.ok) {
return {
name: profile.name,
ok: true,
category: "healthy",
detail: "The route accepted a minimal chat completion request.",
};
}
if (text.includes("model_not_found")) {
return {
name: profile.name,
ok: false,
category: "model_not_found",
detail: "Check the model name, route enablement, and whether this tool is allowed to use that route.",
};
}
return {
name: profile.name,
ok: false,
category: `http_${response.status}`,
detail: text.slice(0, 300),
};
}
const results = [];
for (const profile of profiles) {
results.push(await runCanary(profile));
}
console.table(results.map(({ name, ok, category }) => ({ name, ok, category })));
for (const result of results.filter((item) => !item.ok)) {
console.log(`\n${result.name}`);
console.log(result.detail);
}
if (results.some((item) => !item.ok)) process.exit(1);
Run the canary before importing a shared model name into a Dify workflow or Cursor workspace:
node vector-engine-canary.mjs
The canary is intentionally small. It does not test prompt quality, token policy, or application behavior. It only answers one operational question: can this tool profile reach Vector Engine with the current Base URL, API Key, and model name?
When the result is local_config, fix environment variables before touching the provider route. When the result is model_not_found, avoid changing every client at once. Compare the model name used by Dify, Cursor, and Node.js, then check whether the Vector Engine route is enabled for that key.
Registration URL: https://api.vectorengine.cn/register?aff=Igym
This pattern keeps the debug conversation narrow. Instead of asking every team to describe its whole AI stack, each owner can paste the canary result and show whether Vector Engine accepted the same minimal request through the shared provider layer.
在工具团队复用模型名前,为向量引擎写一个聊天请求 Canary
同一个 model name 可能在一个工具里可用,在另一个工具里失败,原因通常不是模型本身,而是周边配置并不一致。Dify 可能使用一个 Base URL,Cursor 可能保存了不同的 API Key,Node.js 服务可能还在发送旧路由里的 model name。当错误表现为 model_not_found 时,更有效的做法是用一个小 canary 证明路径的哪一段是健康的。
这篇教程为作为 OpenAI 兼容网关和 LLM API provider layer 的向量引擎写一个 Node.js canary。它会针对每个工具配置发送一次很小的聊天补全请求,记录响应状态,并给 Dify、Cursor 和 Node.js 负责人输出聚焦的排查清单。这里的向量引擎也可以理解为向量引擎API中转站和向量引擎中转站所在的统一接入层。
每个配置都使用这些设置:
Base URL: https://api.vectorengine.cn/v1
API Key: 放在工具密钥存储或环境变量中
model name: 每个配置使用一个已批准的路由名
创建 vector-engine-canary.mjs:
const profiles = [
{
name: "Dify workflow",
apiKey: process.env.DIFY_VECTOR_ENGINE_API_KEY,
model: process.env.DIFY_VECTOR_ENGINE_MODEL,
},
{
name: "Cursor workspace",
apiKey: process.env.CURSOR_VECTOR_ENGINE_API_KEY,
model: process.env.CURSOR_VECTOR_ENGINE_MODEL,
},
{
name: "Node.js service",
apiKey: process.env.VECTOR_ENGINE_API_KEY,
model: process.env.VECTOR_ENGINE_MODEL,
},
];
const baseUrl = "https://api.vectorengine.cn/v1";
async function runCanary(profile) {
if (!profile.apiKey || !profile.model) {
return {
name: profile.name,
ok: false,
category: "local_config",
detail: "API Key or model name is missing before the request is sent.",
};
}
const response = await fetch(`${baseUrl}/chat/completions`, {
method: "POST",
headers: {
Authorization: `Bearer ${profile.apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: profile.model,
messages: [
{
role: "user",
content: "Reply with the word ready.",
},
],
temperature: 0,
}),
});
const text = await response.text();
if (response.ok) {
return {
name: profile.name,
ok: true,
category: "healthy",
detail: "The route accepted a minimal chat completion request.",
};
}
if (text.includes("model_not_found")) {
return {
name: profile.name,
ok: false,
category: "model_not_found",
detail: "Check the model name, route enablement, and whether this tool is allowed to use that route.",
};
}
return {
name: profile.name,
ok: false,
category: `http_${response.status}`,
detail: text.slice(0, 300),
};
}
const results = [];
for (const profile of profiles) {
results.push(await runCanary(profile));
}
console.table(results.map(({ name, ok, category }) => ({ name, ok, category })));
for (const result of results.filter((item) => !item.ok)) {
console.log(`\n${result.name}`);
console.log(result.detail);
}
if (results.some((item) => !item.ok)) process.exit(1);
在把共享 model name 写入 Dify 工作流或 Cursor 工作区前运行:
node vector-engine-canary.mjs
这个 canary 刻意保持很小。它不测试提示词质量、token 策略或业务行为,只回答一个运维问题:当前工具配置能否带着 Base URL、API Key 和 model name 访问向量引擎。
如果结果是 local_config,先修环境变量,不要急着改 provider route。如果结果是 model_not_found,不要一次性改动所有客户端。先比较 Dify、Cursor 和 Node.js 使用的 model name,再检查向量引擎路由是否对这个 key 开启。
注册地址:https://api.vectorengine.cn/register?aff=Igym
这种方式能让排查对话更窄。每个负责人不必描述完整 AI 栈,只要贴出 canary 结果,就能说明这个 API中转站是否接受了同一个最小请求。
Top comments (0)