Cline OpenAI Compatible 401 and 404 Errors: Fixing Base URL
When Cline throws an error after you select OpenAI Compatible, one of three fields is usually wrong. A 401 usually means the API key is wrong or picked up a stray space when you copied it. A 404 usually means the Base URL is missing /v1 or has one too many. A 400 is often a wrong model ID, or a model that is only exposed through the Responses API and not Chat Completions. The Cline OpenAI Compatible setup has only a few fields; the hard part is that the extension gives you very little error detail. The quickest approach is to verify the address and key with one curl command in a terminal first, then go back and fill in the extension. Roo Code's OpenAI Compatible provider uses the same fields, so everything below applies to both.
What do the OpenAI Compatible fields mean?
According to Cline's official docs, after you set API Provider to "OpenAI Compatible" you need to fill in the following:
| Field | Meaning | Typical value (example) |
|---|---|---|
| Base URL | Root address of the API; the extension appends /chat/completions | https://api.example.com/v1 |
| API Key | The key your provider issued, sent as the header Authorization: Bearer <Key> | sk-... |
| Model ID | The provider's model name; must match the id returned by /v1/models exactly | Use your provider's model list |
| Model Configuration (optional) | Context length, max output, image support, etc. | Leave the defaults if unsure |
The domain in the table is an example and does not correspond to any real service.
The first row is the one that matters. This provider in Cline and Roo Code works the way the OpenAI SDK does: the Base URL points at the version-prefix level, and /chat/completions is appended automatically. So the value you enter plus /chat/completions should equal the full request URL in your provider's docs.
Should the Base URL include /v1?
Work backward from the full URL in the provider's docs instead of going from memory:
- Find the full Chat Completions URL in the provider's docs, for example
https://api.example.com/v1/chat/completions. - Remove the trailing
/chat/completions. What remains,https://api.example.com/v1, is your Base URL. - Do not add a trailing
/, and do not include/chat/completionsin the field.
What common variations produce:
| Base URL you enter | URL the extension actually requests | Result |
|---|---|---|
https://api.example.com/v1 | .../v1/chat/completions | Works |
https://api.example.com | .../chat/completions | 404 on most services |
https://api.example.com/v1/v1 | .../v1/v1/chat/completions | 404 |
https://api.example.com/v1/chat/completions | .../chat/completions/chat/completions | 404 |
https://api.example.com/v1/ | Depends on how it is joined; may produce a double slash | 404 or a redirect on some services |
Some providers use a version path other than /v1, such as a prefix like /api/v3 or /compatible-mode/v1 (check each provider's docs). The rule stays the same: take the full URL and drop /chat/completions.
Why do OpenAI-format and Anthropic-format tools need different paths?
This is where people trip when switching between Claude Code and Cline, because the two SDK families build paths differently:
- OpenAI format (Cline and Roo Code's OpenAI Compatible, Cursor's Override OpenAI Base URL, Codex, etc.): the Base URL normally includes
/v1, and the SDK only appends/chat/completionsor/responses. - Anthropic format (
ANTHROPIC_BASE_URLin Claude Code, the custom address for the Anthropic provider in Cline): the Base URL normally does not include/v1, and the SDK appends/v1/messagesitself.
If a gateway supports both formats, you would enter https://api.example.com in Claude Code, but https://api.example.com/v1 in Cline's OpenAI Compatible. Copying the Claude Code value over unchanged gives you a 404. The exact syntax for Claude Code, Codex and OpenCode is covered one by one in Configuring a custom API endpoint. Cursor is a more special case; see Why Cursor's Override OpenAI Base URL doesn't work.
Before configuring, verify the address and key with curl
The extension's error is often just "401" or "404 status code (no body)", and you cannot see which URL it actually called. Making the request directly from a terminal separates URL problems from key problems.
Step one, request the model list (replace the example address with your Base URL):
export BASE_URL="https://api.example.com/v1"
export API_KEY="sk-your-key"
curl -sS -w "\nHTTP %{http_code} total time %{time_total}s\n" \
"$BASE_URL/models" \
-H "Authorization: Bearer $API_KEY"
How to read the result:
- HTTP 200 with a
dataarray: the address and key are both fine. Note theidof the model you want and copy it as-is into Cline's Model ID. - HTTP 401: the address is right (the request reached the service) and the key is the problem.
- HTTP 404: the path is wrong; check
/v1first. A few services do not offer/models, in which case go straight to step two. - Can't connect, timeout, TLS error: this is a network-layer problem unrelated to Cline's configuration; see the "Still can't connect" section below.
Step two, send one minimal chat request to verify the model ID:
curl -sS -w "\nHTTP %{http_code}\n" "$BASE_URL/chat/completions" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"put-your-model-id-here","messages":[{"role":"user","content":"ping"}],"max_tokens":16}'
If this returns 200, the three values are fine and entering them unchanged in Cline should normally work. If Cline still errors, the cause is most likely on the extension side (for example, the values went under a different provider, or a VS Code proxy setting) rather than the server.
In Windows PowerShell, curl may be an alias for Invoke-WebRequest. Use curl.exe, and either replace the \ line continuation with a backtick or put the command on one line.
Error code reference: what to check for 401, 404 and 400
| Symptom | Common causes | What to check |
|---|---|---|
| 401 Unauthorized / invalid api key | Key is wrong, expired or deleted; leading or trailing space or newline picked up when copying; another provider's key used here | Copy the key again and press End after pasting to see if there is trailing whitespace; test it alone with curl against /models |
| 401 but curl works | The key in Cline is not the one used in the terminal; the key was entered under another provider's settings | Select OpenAI Compatible again and confirm all three fields are in the same panel |
| 403 | The key is valid but lacks permission for this model or endpoint, or the account is restricted | Read the message in the response body; check permissions and balance in the provider's console |
| 404 Not Found | Base URL is missing /v1, has an extra /v1, or includes /chat/completions | Re-derive the Base URL using the backward method above |
| 404 with "model not found" | The path is right but the Model ID does not exist | Copy the id from the /models response instead of typing it |
| 400 Bad Request | Wrong Model ID; unsupported parameter; model only supports the Responses API | Read the message in the response body; see the next section |
| 429 | Rate limit hit or quota used up | Check Retry-After in the response headers and the quota in the console; see What to do about 429 Too Many Requests |
For the full meaning of each status code and which ones are worth retrying, see the LLM API error code cheatsheet.
What does a 400 saying "only supports /v1/responses" mean?
OpenAI now has two chat interfaces: the older Chat Completions (/v1/chat/completions) and the newer Responses (/v1/responses). Some models are only available on Responses. Cline's OpenAI Compatible uses Chat Completions, so when you pick such a model the server returns a 400 whose body says, roughly, that the model only supports v1/responses and not v1/chat/completions. Users have posted this error in Cline's GitHub issues.
To check: send the same model through the second curl request above. If the response body contains the word responses, this is your case. There are two fixes:
- Switch to a model that is available on Chat Completions.
- Switch to a tool or provider that supports the Responses API. For example, in Codex CLI you can use
wire_apito choose which API to call; see the Codex config.toml reference for syntax.
If you use a third-party gateway, the same model name may support different interfaces on different gateways. Follow the provider's docs.
Other common causes of 400
- Wrong capitalization in the Model ID, or an extra prefix (some services require
vendor/model-name, others do not). - Max output in Model Configuration set higher than the model's limit.
- "Supports images" is checked but the model does not accept image input, so sending a screenshot fails.
In these cases the message in the response body usually names the offending parameter, so do not rely on the status code alone.
Address and key are correct but you still can't connect
If curl reports Could not resolve host, Connection timed out or a TLS handshake failure, the request never reached the server and changing Cline's settings will not help. For a more detailed TLS breakdown, see curl SSL_ERROR_SYSCALL / TLS handshake timeout. Check in this order:
- Is the provider having an outage? Look at the API status page, for example /en/status/openai for OpenAI. The data there comes from cdnping probing the official API endpoints from Cloudflare edge nodes every 5 minutes.
- Can you reach the provider's host from your side? Open the cdnping online speed test and look at the target API's "first connection" (which includes DNS and the TLS handshake) and "round trip" figures. If the first connection fails or is unusually slow, the problem is most likely DNS, a proxy or your network route.
- Is VS Code going through a proxy? Cline runs inside VS Code's extension host, and the system proxy, the
http.proxysetting and the environment variables in your terminal are not necessarily the same. If terminal curl works but the extension doesn't, check this first.
For reference, cdnping ran 242 edge probes from the Cloudflare Denver node (DEN) between 08:40 and 10:05 UTC on 2026-10-17. The round-trip median and P95 for several API endpoints are below. These are edge-node-to-endpoint numbers and do not represent latency from your own network. They only confirm that the endpoints were reachable during that window:
| API endpoint | Host | Median | P95 |
|---|---|---|---|
| OpenAI API | api.openai.com | 96 ms | 194 ms |
| DeepSeek API | api.deepseek.com | 353 ms | 414 ms |
| Zhipu BigModel | open.bigmodel.cn | 395 ms | 674 ms |
| SiliconFlow | api.siliconflow.cn | 631 ms | 1030 ms |
Source: cdnping edge probes over the roughly 1.5-hour window above; collection had just started, so the sample is small. To measure latency from your own network, use the speed test on the homepage.
What else to watch for with third-party gateways
Many people use OpenAI Compatible to connect to a third-party gateway or relay service (common in China, where official APIs are often not directly reachable or payable). Beyond the configuration issues above, confirm two more things:
- Whether the model is really the one you selected: the same model name can be backed by a different provider or a quantized version. You can run a consistency check using the method in Verifying which model an API actually returns.
- Whether the service itself is reliable: availability, billing basis and data policy all matter, and 8 checks for choosing an API relay can serve as a checklist.
As an example, AGI Plan (AGI Plan is a commercial partner of cdnping; the site states it is not an officially authorized channel) is compatible with both the OpenAI and Anthropic API formats, and tools like Cline and Roo Code that accept an endpoint plus an API key can connect to it. Following this article's rules, what you enter under OpenAI Compatible should be its OpenAI-format address; the exact path and available models are as given in the docs at agiplan.dev and on the models page. Its public availability data is at /en/status/agiplan. With any third-party gateway, comply with the upstream providers' terms of service and local regulations.
Checklist
- Find the full Chat Completions URL in the provider's docs, remove
/chat/completionsto get the Base URL, and leave off any trailing slash. - In a terminal, run
curl $BASE_URL/models: on 200, continue; on 401, change the key; on 404, fix the path; if it can't connect, investigate the network. - Copy the model
idfrom the/modelsresponse and test/chat/completionsonce with a minimal request. - On a 400, read the
message; if it mentions responses, switch models or tools. - Enter the three values unchanged in Cline's or Roo Code's OpenAI Compatible provider, and keep Model Configuration at its defaults at first.
- If the terminal works but the extension doesn't, check VS Code's proxy settings.
- If the terminal fails too, check /en/status and the homepage speed test first, then decide whether to wait for the provider to recover or troubleshoot your own network.