Base URL mistakes are one of the most common reasons Claude API integrations fail.
The API key can be correct. The model name can be correct. But if the client expects an OpenAI-compatible base URL and you forget /v1, the request may fail with a 404. If the client expects an Anthropic-style base host and you add /v1 in the wrong field, the client may generate a duplicated path.
This guide explains what to enter for Cursor, Cline, Dify, ChatBox, Cherry Studio, Open WebUI, Claude Desktop-style clients, and command-line verification.
The short rule
Start with this table. In most cases, it is all you need.
| Tool or client type | Base URL to enter | Reason |
|---|---|---|
| Cursor | https://gw.claudeapi.com/v1 |
OpenAI-compatible configuration |
| Cline | https://gw.claudeapi.com/v1 |
OpenAI-compatible provider |
| Dify | https://gw.claudeapi.com/v1 |
OpenAI-compatible model provider |
| ChatBox in OpenAI mode | https://gw.claudeapi.com/v1 |
OpenAI-compatible client |
| Cherry Studio with OpenAI Compatible provider | https://gw.claudeapi.com/v1 |
OpenAI-compatible client |
| Open WebUI OpenAI connection | https://gw.claudeapi.com/v1 |
OpenAI-compatible connection |
| Anthropic-compatible clients | https://gw.claudeapi.com |
Client usually appends /v1/messages itself |
The rule:
OpenAI-compatible tool -> https://gw.claudeapi.com/v1
Anthropic-compatible client -> https://gw.claudeapi.com
OpenAI-compatible tool -> https://gw.claudeapi.com/v1
Anthropic-compatible client -> https://gw.claudeapi.com
Do not add a trailing slash:
Correct: https://gw.claudeapi.com/v1
Avoid: https://gw.claudeapi.com/v1/
Correct: https://gw.claudeapi.com/v1
Avoid: https://gw.claudeapi.com/v1/
Some tools tolerate the trailing slash. Others concatenate paths poorly and produce double slashes or 404 errors.
Base URL is not the full endpoint
A Base URL field usually expects only the provider root plus API version:
https://gw.claudeapi.com/v1
https://gw.claudeapi.com/v1
The tool or SDK then appends the endpoint:
/chat/completions
/models
/chat/completions
/models
So the final OpenAI-compatible request becomes:
https://gw.claudeapi.com/v1/chat/completions
https://gw.claudeapi.com/v1/chat/completions
Do not paste this full endpoint into a field named Base URL, API Base, API Host, or API address:
Wrong for a Base URL field:
https://gw.claudeapi.com/v1/chat/completions
Wrong for a Base URL field:
https://gw.claudeapi.com/v1/chat/completions
That is the request endpoint, not the base.
Cursor
Use Cursor’s OpenAI-compatible or custom OpenAI base URL configuration if your Cursor version exposes it.
| Field | Value |
|---|---|
| API provider | OpenAI Compatible or custom OpenAI endpoint |
| Base URL / BaseURL | https://gw.claudeapi.com/v1 |
| API key | Your ClaudeAPI key |
| Model | claude-haiku-4-5-20251001, claude-sonnet-4-6, or another enabled model |
Typical setup:
- Open Cursor settings.
- Go to the Models or API provider section.
- Select OpenAI Compatible or enable the custom OpenAI Base URL option.
- Enter
https://gw.claudeapi.com/v1. - Paste your ClaudeAPI key.
- Enter the exact model ID.
- Run Verify if Cursor provides a verification button.
Common failures:
| Error | Likely cause | Fix |
|---|---|---|
401 Unauthorized |
Wrong key or extra whitespace | Copy the key again from the ClaudeAPI console |
404 Not Found |
Missing /v1 |
Use https://gw.claudeapi.com/v1 |
| Verification keeps spinning | Local proxy, firewall, or unsupported custom endpoint path | Test with curl from the same machine |
Cline
Cline documents an OpenAI Compatible provider mode. Use that mode for ClaudeAPI’s OpenAI-compatible gateway.
| Field | Value |
|---|---|
| API Provider | OpenAI Compatible |
| Base URL | https://gw.claudeapi.com/v1 |
| API key | Your ClaudeAPI key |
| Model ID | Full model ID, for example claude-haiku-4-5-20251001 |
Steps:
- Open the Cline panel in VS Code.
- Open Settings.
- Select OpenAI Compatible as the provider.
- Set Base URL to
https://gw.claudeapi.com/v1. - Paste your ClaudeAPI key.
- Enter the full model ID manually.
- Save and send a short test message.
If the status bar still shows an old model, reload VS Code and check the selected provider again.
If you use the Claude Code VS Code plugin
Do not confuse Cline with the Claude Code VS Code plugin.
If your workflow uses Claude Code and CC Switch, the cleaner path is usually to let CC Switch manage the active provider configuration, then enable the option that applies the selected provider to the Claude Code plugin.
Recommended check:
| Scenario | Configuration path |
|---|---|
| Cline plugin | Configure Cline directly with OpenAI Compatible, Base URL, API key, and model ID |
| Claude Code VS Code plugin | Use CC Switch and enable the setting that applies CC Switch to the Claude Code plugin |
| Terminal-only Claude Code | Switch the active Claude Code provider in CC Switch |
| Cursor or Continue | Configure those tools separately |

After changing CC Switch settings, restart VS Code and send a test message from the Claude Code plugin.
Dify
In Dify, add ClaudeAPI as an OpenAI-compatible model provider.
| Field | Value |
|---|---|
| Provider | OpenAI-compatible |
| API Base URL | https://gw.claudeapi.com/v1 |
| API key | Your ClaudeAPI key |
| Model name | Add the full model ID manually |
Important details:
- Enter only
https://gw.claudeapi.com/v1. - Do not enter
/chat/completions. - Add model IDs manually if Dify does not auto-detect them.
- Enable the model before using it in a Dify app.
Successful setup means the model appears in Dify’s model list and can return a normal test response.
ChatBox
ChatBox can expose both native Claude/Anthropic and OpenAI-compatible modes. When using a ClaudeAPI key through the OpenAI-compatible gateway, choose the OpenAI mode.
| Field | Value |
|---|---|
| Provider / mode | OpenAI API or OpenAI Compatible |
| API Host | https://gw.claudeapi.com/v1 |
| API key | Your ClaudeAPI key |
| Model | Full ClaudeAPI model ID |
If you select a native Claude API mode while using an OpenAI-compatible ClaudeAPI key, authentication or endpoint errors are likely.
Cherry Studio
Use the OpenAI Compatible provider type.
| Field | Value |
|---|---|
| Provider type | OpenAI Compatible |
| API address | https://gw.claudeapi.com/v1 |
| API key | Your ClaudeAPI key |
| Model | Add the model manually if needed |
Typical setup:
- Open Settings.
- Go to model services or AI providers.
- Add a provider.
- Select OpenAI Compatible.
- Enter
https://gw.claudeapi.com/v1. - Paste your ClaudeAPI key.
- Add the model ID in model management.
- Return to chat and select the model.
Common issues:
| Error | Likely cause | Fix |
|---|---|---|
401 Unauthorized |
Wrong key or wrong provider type | Confirm the key and use OpenAI Compatible |
404 Not Found |
Full endpoint entered as API address | Use only https://gw.claudeapi.com/v1 |
| Empty model dropdown | Model was not added manually | Add the exact model ID |
Open WebUI
Open WebUI supports OpenAI-compatible connections through the admin settings.
| Field | Value |
|---|---|
| OpenAI API Base URL | https://gw.claudeapi.com/v1 |
| API key | Your ClaudeAPI key |
Steps:
- Log in as an administrator.
- Open Admin Settings.
- Go to Connections.
- Add or edit the OpenAI-compatible connection.
- Set the URL to
https://gw.claudeapi.com/v1. - Paste the ClaudeAPI key.
- Save and check whether models appear.
You can test model discovery with:
curl https://gw.claudeapi.com/v1/models \
-H "Authorization: Bearer YOUR_CLAUDEAPI_KEY"
curl https://gw.claudeapi.com/v1/models \
-H "Authorization: Bearer YOUR_CLAUDEAPI_KEY"
A successful response should contain an OpenAI-style model list:
{
"object": "list",
"data": [
{
"id": "claude-haiku-4-5-20251001",
"object": "model"
}
]
}
{
"object": "list",
"data": [
{
"id": "claude-haiku-4-5-20251001",
"object": "model"
}
]
}
If the model list is empty, check the Base URL, saved API key, model enablement, and admin permissions.
Claude Desktop and Anthropic-compatible clients
Claude Desktop requires extra caution because not every Claude Desktop version exposes a supported way to replace the inference endpoint. Some builds focus on Claude account sign-in and MCP server configuration rather than custom third-party model endpoints.
If your client or wrapper explicitly supports an Anthropic-compatible base URL, use the base host without /v1:
https://gw.claudeapi.com
https://gw.claudeapi.com
The client should append:
/v1/messages
/v1/messages
The final request becomes:
https://gw.claudeapi.com/v1/messages
https://gw.claudeapi.com/v1/messages
If you enter https://gw.claudeapi.com/v1 in a field where the client already appends /v1/messages, the final path may become malformed.
For Anthropic-compatible manual testing, use:
curl https://gw.claudeapi.com/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_CLAUDEAPI_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-haiku-4-5-20251001",
"max_tokens": 100,
"messages": [{"role": "user", "content": "Reply with OK only."}]
}'
curl https://gw.claudeapi.com/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_CLAUDEAPI_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-haiku-4-5-20251001",
"max_tokens": 100,
"messages": [{"role": "user", "content": "Reply with OK only."}]
}'
Expected result:
- The response contains a
contentarray. content[0].textcontains the model reply.
If your Claude Desktop build does not expose a custom API base field, do not force this configuration into unrelated MCP settings. Use ClaudeAPI with tools that explicitly support custom OpenAI-compatible or Anthropic-compatible endpoints.
Troubleshooting flow
When a tool fails, test the API outside the tool first. This separates provider, network, and model issues from UI configuration issues.
Step 1: Test OpenAI-compatible chat completions
Use this for Cursor, Cline, Dify, ChatBox, Cherry Studio, and Open WebUI:
curl https://gw.claudeapi.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_CLAUDEAPI_KEY" \
-d '{
"model": "claude-haiku-4-5-20251001",
"messages": [{"role": "user", "content": "Reply with OK only."}],
"max_tokens": 16
}'
curl https://gw.claudeapi.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_CLAUDEAPI_KEY" \
-d '{
"model": "claude-haiku-4-5-20251001",
"messages": [{"role": "user", "content": "Reply with OK only."}],
"max_tokens": 16
}'
Expected result:
- The response contains a
choicesarray. choices[0].message.contentcontains text.- The
usagefield may show token counts.
Step 2: Confirm the API key source
Use a key generated in the ClaudeAPI console. Keys from Anthropic or another provider are not interchangeable with ClaudeAPI keys.
Also check:
- No leading or trailing spaces
- No missing characters after copy/paste
- The key has available balance or quota
- The target model is enabled for the account
Step 3: Check the URL pattern
| Scenario | Correct URL | Common wrong value |
|---|---|---|
| Cursor / Cline / Dify / ChatBox / Cherry Studio / Open WebUI | https://gw.claudeapi.com/v1 |
https://gw.claudeapi.com |
| Anthropic-compatible base-host field | https://gw.claudeapi.com |
https://gw.claudeapi.com/v1 |
| Any Base URL field | No trailing slash | https://gw.claudeapi.com/v1/ |
| Any Base URL field | Base path only | https://gw.claudeapi.com/v1/chat/completions |
Error reference
| Error | Common cause | Fix |
|---|---|---|
401 Unauthorized |
Wrong key, expired key, provider key mismatch, or extra whitespace | Copy the key again from ClaudeAPI console |
404 Not Found |
Wrong Base URL or missing /v1 in OpenAI-compatible mode |
Use https://gw.claudeapi.com/v1 |
Model not found |
Model ID is incomplete, misspelled, or not enabled | Copy the exact model ID from the console |
| Empty model list | Tool cannot call /models or no models are enabled |
Test /v1/models with curl |
| Connection timeout | Proxy, DNS, firewall, or network issue | Test curl from the same machine |
| JSON parse error | Manual config file contains invalid JSON | Validate JSON before restarting the app |
FAQ
Should the Base URL end with a slash?
No. Use:
https://gw.claudeapi.com/v1
https://gw.claudeapi.com/v1
not:
https://gw.claudeapi.com/v1/
https://gw.claudeapi.com/v1/
Why do OpenAI-compatible tools need /v1?
OpenAI-compatible tools usually expect the base URL to include the API version. They then append paths such as /chat/completions or /models.
Why do Anthropic-compatible clients use the host without /v1?
Anthropic-style clients often append /v1/messages themselves. If you include /v1 in the base field, the final path may be duplicated or invalid.
Is a ClaudeAPI key the same as an Anthropic key?
No. Use the key generated in the ClaudeAPI console. Provider keys are not interchangeable.
Can I use the same ClaudeAPI key in multiple tools?
Yes. One key can be used in multiple clients, and usage is billed according to requests. For team environments, separate keys per tool, user, or environment make auditing easier.
Where do I find model names?
Check the ClaudeAPI model page or console and copy the exact model ID. Common examples include:
claude-haiku-4-5-20251001
claude-sonnet-4-6
claude-opus-4-8
claude-haiku-4-5-20251001
claude-sonnet-4-6
claude-opus-4-8
A tool says the connection succeeded, but chat still fails. Why?
Some connection checks only validate authentication or model discovery. A real chat request also depends on the selected model, enabled capabilities, quota, and request format. Run the curl chat completion test to isolate the issue.
Final checklist
Before debugging anything else, verify these items:
- [ ] You selected OpenAI Compatible mode for OpenAI-style tools.
- [ ] The Base URL is
https://gw.claudeapi.com/v1for OpenAI-compatible tools. - [ ] The Base URL is
https://gw.claudeapi.comonly for Anthropic-compatible base-host fields. - [ ] The field contains a base path, not
/chat/completionsor/messages. - [ ] The URL has no trailing slash.
- [ ] The key comes from ClaudeAPI.
- [ ] The model ID is copied exactly from the console.
- [ ] The model is enabled and the account has available quota.
Once you remember the rule, new tools are easier to configure: first identify whether the tool speaks OpenAI-compatible or Anthropic-compatible API, then choose the matching Base URL.
Related guides
- Migrate from OpenAI API to Claude API
- Continue VS Code Claude API setup guide
- Claude API pricing and model selection guide
- Claude API cost estimation and budget guide
Sources
- Cline Docs: OpenAI Compatible provider
- Dify Marketplace: OpenAI-API-compatible provider
- Open WebUI Docs: OpenAI-compatible provider connection
- Anthropic Docs: Messages API
- Vercel AI SDK: OpenAI Compatible Providers
Disclosure
This article was translated and adapted from a Chinese ClaudeAPI draft with AI assistance, then reviewed against public documentation available on July 14, 2026. ClaudeAPI is an independent third-party technical service provider. It is not affiliated with Anthropic and does not guarantee the availability of Anthropic services.



