Diagnosing 404s from OpenAI-compatible API endpoints
The tutorial recommends inspecting the fully constructed request URL before changing the model when an OpenAI-compatible API returns a 404. It shows how a duplicated /v1 path can produce the error, then uses terminal and curl commands to distinguish routing problems from model IDs, HTML error pages, and configuration-loading issues.
Checking the final request path first can prevent developers from changing a valid model name while an incorrect API route remains the actual source of a 404.
假设配置文件里写着 API_BASE_URL=https://api.vsoui.com/v1,业务代码里写着 ${API_BASE_URL}/v1/chat/completions。分开看,两行都挺眼熟。拼在一起,问题就出来了:
https://api.vsoui.com/v1/v1/chat/completions
如果网关没有这条路由,请求就可能收到 404。这时候换模型名,只会带着新模型再走一遍同样的错路。
先把最终地址打印出来
如果服务商文档给的接口前缀已经以 /v1 结尾,手写 Chat Completions 请求时,只需要再拼上 /chat/completions。下面这两行可以直接在终端里跑,不需要 Key: