Official Docs Claude CodeAnthropicCLI Tutorial 更新于 2026-11-18 · 约 4 分钟读完

Claude Code Complete guide to native access: environment variables and settings.json permanent configuration

It takes 30 seconds to connect the Anthropic official terminal programming assistant Claude Code to the Duohuo native gateway, fully retaining the Extended Thinking thinking chain and 90% of the Prompt Cache cache to save costs.

Why does Claude Code have to use the native Messages protocol?

When many developers use the ordinary OpenAI format conversion station driver Claude Code, they often encounter problems such as tool call interruption (Tool Use), thought chain (Extended Thinking) loss, or context failure to hit the cache, resulting in skyrocketing bills. This gateway provides 100% native /v1/messages route pass-through and session affinity and sticky scheduling, releasing full programming capabilities without any protocol downgrade.

Method 1: Quick startup of terminal environment variables (suitable for temporary testing)

First go to the Developer Console to create a binding Anthropic that supports grouping sk-... key, and then execute in the macOS/Linux terminal:

bash
export ANTHROPIC_BASE_URL="https://suptoken.ai"
export ANTHROPIC_AUTH_TOKEN="sk-替换为您的密钥"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"

# 进入您的代码仓库目录直接启动
cd your-project
claude

If you use Windows PowerShell, execute:

powershell
$env:ANTHROPIC_BASE_URL="https://suptoken.ai"
$env:ANTHROPIC_AUTH_TOKEN="sk-替换为您的密钥"
claude

To avoid the trouble of repeatedly entering environment variables every time you open a new terminal, it is recommended to edit or create ~/.claude/settings.json directly (the Windows path is %USERPROFILE%\.claude\settings.json):

json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://suptoken.ai",
    "ANTHROPIC_AUTH_TOKEN": "sk-替换为您的密钥",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  }
}
Tip: After logging into the console of this site, click the "One-click access" button to the right of any key to directly download the settings.json file with your key automatically filled in.

How to maximize hit Prompt Cache and save 85%?

  • Keep asking questions continuously in a single project session and avoid clearing the context frequently /clear. The gateway will automatically route the same session to the same healthy node to reuse the upstream cache.
  • Maintain a refined CLAUDE.md architecture description in the project root directory. The more stable the fixed prefix, the higher the cache read hit rate (the unit price of cache reads is only 10% of the standard input).

🚀 准备好在项目中极速接入了吗?

注册即可创建专属 API Key,原生直连 Claude 4.5、GPT-5 Codex 与 Gemini 2.5 Pro。

在线流式测试 免费获取 API Key →

相关推荐阅读