Skip to content
Sign Up Free
Model calls

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 caseBase URL
Claude Code / Anthropic-compatiblehttps://bettertoken.ai
Codex CLI / OpenAI-compatiblehttps://bettertoken.ai/v1
Cursor, Cline, OpenCode, OpenClawhttps://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 typeCommon behavior
OpenAI-compatible SDKUsually calls resources such as chat completions or responses under /v1
Anthropic-compatible SDKUsually appends message endpoint paths itself, so you should not add /v1 again
Built-in tool providerMay 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

ToolRecommended setup
Claude Codehttps://bettertoken.ai, with a BetterToken API key
Claude Desktop GatewayFollow the Gateway page, including the auth scheme
Codex CLIhttps://bettertoken.ai/v1, with a BetterToken API key
Cursorhttps://bettertoken.ai/v1, with a BetterToken API key
Clinehttps://bettertoken.ai/v1, using an OpenAI Compatible provider
OpenCode / OpenClawhttps://bettertoken.ai/v1, with a BetterToken API key

Common errors

Error or symptomPossible cause
404 Not FoundThe Base URL path does not match the SDK’s expected path
model not foundCheck the exact Model ID in the model plaza and enter it in the client model settings.
invalid_api_keyThe API Key and Base URL are from different services
Authentication works, but the model is unavailableCheck the exact Model ID in the model plaza and enter it in the client model settings.
Requests keep failingAn Anthropic-compatible address was used in an OpenAI-compatible tool, or the reverse
  1. Confirm whether the tool expects OpenAI-compatible or Anthropic-compatible API.
  2. Check whether the Base URL matches that protocol.
  3. Check whether the API Key is from the same service.
  4. Copy the exact Model ID from the model plaza.
  5. 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.