ANTHROPIC_BASE_URL: Claude Code Setup and /v1 Fixes
For Claude Code connecting to LLMAPI, set ANTHROPIC_BASE_URL to https://llmapi.pro without /v1, then configure your LLMAPI credential. A complete HTTP request uses a different value: https://llmapi.pro/v1/messages. Mixing the client base URL with the full request endpoint is an easy way to send a request to the wrong path.
Base URL versus request endpoint
Use the value that matches the client and protocol:
| What you are configuring | LLMAPI URL | Where to check |
|---|---|---|
| Claude Code base URL | https://llmapi.pro |
Claude Code setup |
| An OpenAI-compatible client's base URL | https://llmapi.pro/v1 |
The specific client's setup page |
| A direct Anthropic-format HTTP request | https://llmapi.pro/v1/messages |
curl / HTTP examples |
The first two values configure a client that constructs requests. The third is the complete address for a request you construct yourself. Do not copy the OpenAI-compatible base URL into Claude Code merely because both clients use the same service.
These are LLMAPI's documented values. A different gateway can use a path prefix: follow that gateway's instructions instead of assuming that every base URL must be a bare hostname. See the Claude Code setup and HTTP examples.
Configure Claude Code on macOS or Linux
In the terminal where you will start Claude Code:
export ANTHROPIC_BASE_URL="https://llmapi.pro"
export ANTHROPIC_AUTH_TOKEN="YOUR_LLMAPI_KEY"
claude
Replace the placeholder locally with your own credential. Keep real credentials out of repositories, screenshots and support messages. These commands configure the current shell and programs started from it. If you maintain persistent settings, update the corresponding shell or client configuration as well.
The credential variable here follows LLMAPI's Claude Code instructions. An SDK or another client can use different credential settings; do not assume that setting one variable configures every application.
Configure Claude Code on Windows PowerShell
For the current PowerShell session:
$env:ANTHROPIC_BASE_URL = "https://llmapi.pro"
$env:ANTHROPIC_AUTH_TOKEN = "YOUR_LLMAPI_KEY"
claude
To persist the non-secret base URL for future terminals:
setx ANTHROPIC_BASE_URL "https://llmapi.pro"
Open a new terminal after using setx. It does not replace the environment inside an already-running terminal or IDE. Configure the credential in the environment used by the actual client. If the terminal works but an IDE does not, compare the two clients' effective settings before changing the server URL again.
Check the configuration without printing your key
Inspect just the base URL:
printf '%s\n' "$ANTHROPIC_BASE_URL"
$env:ANTHROPIC_BASE_URL
In Claude Code, use /status to inspect the active provider, base URL and proxy. This command is documented in the official deployment overview. A successful configuration check does not prove that a model request will succeed or that every account has access to every model.
For a direct request test, use the complete /v1/messages endpoint and the request headers and body in the HTTP guide. Select a model available to your account. A real generation request can consume usage; checking an environment variable does not make an API request.
Diagnose an error by its response
Start with the status and error message rather than treating every failure as a base URL problem:
- 404: compare the client protocol, base URL and final request path. An extra
/v1is one possible configuration problem, not proof of the cause of every 404. - 401: check whether the credential belongs to this service and is active. An expired or disabled key is different from a spelling mistake in the URL.
- 403 or 429: inspect the account's access, usage and rate-limit information. Repeatedly resending the same request will not correct a quota or permission issue.
- 5xx or a connection failure: retain the timestamp and any request ID, then follow the error troubleshooting guide. Avoid repeated rapid retries.
If you contact support, include the client name, base URL, status, timestamp and a redacted error message. Do not include the API key or a complete environment dump.
Switching away from a custom endpoint
Changing the URL and changing authentication are separate steps. Remove or replace the custom endpoint and the matching gateway credential in the configuration that actually launches your client, then restart it and confirm its status. Changing only the URL does not turn a gateway credential into an Anthropic credential.
Use the destination service's authentication and billing setup. LLMAPI is an independent service; an LLMAPI credential is not a claim of access to a separate Anthropic account or subscription.
Next step
Use the client-specific setup documentation to choose the right protocol before creating your configuration. If you already have a failing setup, correct one variable at a time and check the result so that a network, credential or quota problem is not hidden by repeated URL changes.