CLAUDE CODE
Claude Code ANTHROPIC_BASE_URL
Create an API key for Claude, set Anthropic’s base URL to Half API, and keep using Claude Code. Use model names from the console.
Quickstart
- 1. Create an accountSign up with email at app.halfapi.com.
- 2. Pay with USDTMinimum top-up is $1. Credits are added when the payment completes.
- 3. Create an API key for ClaudeIn the console, create a key that can call Claude. Copy the
sk-secret. - 4. Set the Anthropic base URLPut the key in your environment or project settings. Do not paste it into a chat.
Configure Claude Code
| Field | Value |
|---|---|
| Base URL | https://api.halfapi.com |
| API key | Console key starting with sk- |
| Model | A name from the console list |
In a terminal:
export ANTHROPIC_BASE_URL="https://api.halfapi.com"
export ANTHROPIC_API_KEY="sk-..."
claude
Or in the project env / Claude Code settings:
ANTHROPIC_BASE_URL=https://api.halfapi.com
ANTHROPIC_API_KEY=sk-...
Keep a USD balance before long cache-write sessions.
Try it
Restart Claude Code after changing the environment. Send a short prompt. If the request fails, confirm the key is for Claude, the base URL has no /v1, and the payment has completed.
Troubleshooting
- Base URL
- Set ANTHROPIC_BASE_URL to https://api.halfapi.com. Do not append /v1.
- Wrong key
- Claude Code needs a Claude key. A GPT or Codex key will not work here.
- USDT
- Payments are final once the gateway marks them complete. Credits have no cash value.
- Models
- Use the names listed in the console. Standard and Premium are console options; they do not change the model name.