How should I fill in the Base URL?
Learn how Base URL, /v1 paths, API Key, and Model ID should match in Claude Code, Codex CLI, Cursor, Cline, and other tools. Includes examples and fixes.
Short answer
The Base URL must match the protocol expected by your tool. Claude Code usually uses the Anthropic-compatible root address. Codex CLI, Cursor, Cline, OpenCode, OpenClaw, and other external tools usually use the OpenAI-compatible /v1 address.
In BetterToken:
| Use case | Base URL |
|---|---|
| Claude Code / Anthropic-compatible | https://bettertoken.ai |
| Codex CLI / OpenAI-compatible | https://bettertoken.ai/v1 |
| Cursor, Cline, OpenCode, OpenClaw | https://bettertoken.ai/v1 |
Use https://bettertoken.ai for Claude Code and https://bettertoken.ai/v1 for Codex CLI and OpenAI-compatible tools. Choose the endpoint for the protocol your client uses.
Why there are different Base URLs
Different SDKs append paths in different ways.
| Protocol or tool type | Common behavior |
|---|---|
| OpenAI-compatible SDK | Usually calls resources such as chat completions or responses under /v1 |
| Anthropic-compatible SDK | Usually appends message endpoint paths itself, so you should not add /v1 again |
| Built-in tool provider | May append paths automatically, or may ask you for a complete Base URL |
Use https://bettertoken.ai for Claude Code and https://bettertoken.ai/v1 for Codex CLI and OpenAI-compatible tools. Choose the endpoint for the protocol your client uses.
Quick reference
| Tool | Recommended setup |
|---|---|
| Claude Code | https://bettertoken.ai, with a BetterToken API key |
| Claude Desktop Gateway | Follow the Gateway page, including the auth scheme |
| Codex CLI | https://bettertoken.ai/v1, with a BetterToken API key |
| Cursor | https://bettertoken.ai/v1, with a BetterToken API key |
| Cline | https://bettertoken.ai/v1, using an OpenAI Compatible provider |
| OpenCode / OpenClaw | https://bettertoken.ai/v1, with a BetterToken API key |
Common errors
| Error or symptom | Possible cause |
|---|---|
404 Not Found | The Base URL path does not match the SDK’s expected path |
model not found | Check the exact Model ID in the model plaza and enter it in the client model settings. |
invalid_api_key | The API Key and Base URL are from different services |
| Authentication works, but the model is unavailable | Check the exact Model ID in the model plaza and enter it in the client model settings. |
| Requests keep failing | An Anthropic-compatible address was used in an OpenAI-compatible tool, or the reverse |
Recommended troubleshooting order
- Confirm whether the tool expects OpenAI-compatible or Anthropic-compatible API.
- Check whether the Base URL matches that protocol.
- Check whether the API Key is from the same service.
- Copy the exact Model ID from the model plaza.
- Send a minimal test request, such as
hello.
Code examples
OpenAI-compatible tools usually use the /v1 address:
from openai import OpenAI
client = OpenAI( api_key="YOUR_API_KEY", base_url="https://bettertoken.ai/v1")
response = client.chat.completions.create( model="your-model-id", messages=[{"role": "user", "content": "hello"}])Claude / Anthropic-compatible setups usually use the root address:
import anthropic
client = anthropic.Anthropic( api_key="YOUR_API_KEY", base_url="https://bettertoken.ai")
message = client.messages.create( model="your-model-id", max_tokens=1024, messages=[{"role": "user", "content": "hello"}])About BetterToken
BetterToken provides both Anthropic-compatible and OpenAI-compatible access. You can manage API Keys, balance, and usage records in the same dashboard, but each client still needs the protocol address it supports.
Quick rule: Claude Code uses https://bettertoken.ai; Codex CLI, Cursor, Cline, OpenCode, and OpenClaw use https://bettertoken.ai/v1.

