https://thapi.cloud

← All applications · Connect apps section on /docs

Anthropicconfigure claude

Claude Code

Also known as: Claude CLI · claude

Claude Code: configure the API key, model and provider in your terminal.

Published instructions · Checked version: 2.1.220 · Checked on:

The real application was run against a local mock API to check connection settings, authentication and streaming responses. Production, all features, plugins and operating systems have not been verified.

Chat, ping, invoke and content-generation examples may send real billable requests. Check the model, balance, rate and minimum before running them. GET /v1/models checks authentication and the catalogue only. Set up environment variables safely

Base URL to paste

OpenAI SDKs generally use a URL ending in /v1; Anthropic SDKs use the root URL. Avoid adding /v1 twice. Protocol compatibility does not guarantee every provider feature.

https://thapi.cloud

Prerequisites

  1. The `claude` command (Claude Code) is installed
  2. API key sk-thapi-…
  3. If previously signed in to Anthropic, run `/logout` in Claude Code first

Recommended model: claude-fable-5

Quick way — command / config

npm install -g API CLI@latest
api-cli configure claude -m claude-fable-5
api-cli doctor

Where to place file / fill Settings

Filemacos
~/.claude/settings.json
Create/edit the JSON file as shown in the settings.json tab. Back up before editing manually. Prefer `api-cli configure claude` (creates a timestamped backup).
Filelinux
~/.claude/settings.json
Check the base URL and model without printing the API key: `node -e 'const fs=require("node:fs"),os=require("node:os"); const s=JSON.parse(fs.readFileSync(os.homedir()+"/.claude/settings.json","utf8")); console.log({baseURL:s.env?.ANTHROPIC_BASE_URL,model:s.env?.ANTHROPIC_MODEL})'`.
Filewindows
%USERPROFILE%\.claude\settings.json
PowerShell: `notepad $env:USERPROFILE\.claude\settings.json`. Use ANTHROPIC_AUTH_TOKEN (not ANTHROPIC_API_KEY).
Fileany
.claude/settings.local.json (trong repo)
Applies to one project only. Add it to .gitignore if it contains a key.

Verify connection

  1. `claude` opens; send “ping”.
  2. `echo $ANTHROPIC_BASE_URL` (Unix) phải là https://thapi.cloud
  3. Dashboard → Usage shows a new request.

Troubleshooting

SymptomReasonHow to handle
Keeps asking for an Anthropic loginAn old OAuth session is still active.Run `/logout` in Claude Code, set ANTHROPIC_AUTH_TOKEN again, and open a new terminal.
404BASE_URL contains an extra /v1.Phải là https://thapi.cloud (không /v1).
401ANTHROPIC_API_KEY was used by mistake, or the key is incorrect.Use ANTHROPIC_AUTH_TOKEN=sk-thapi-…

Notes

  • A separate key for the Claude Code machine is recommended.
  • API CLI merges env more safely than manually editing the entire file.

Related

Claude Desktop · OpenClaw · API CLI · Hermes Agent

Zalo group