Claude Code Configuration
Overview
This guide provides detailed instructions on configuring the Claude Code CLI tool to use the services of the LongCat API Platform. The LongCat API Platform is fully compatible with the Anthropic Claude API format, allowing you to easily access LongCat series model capabilities within the Anthropic API ecosystem through simple configuration.
Prerequisites
1. Obtain an API Key
Before you begin the configuration, you need to:
- Visit the LongCat API Platform
- Register and complete your account creation
- After logging in, go to the API Keys page
- Obtain your API Key (a key named "default" is created automatically)
2. Confirm Claude Code is Installed
Ensure that you have the Claude Code CLI tool installed. If not, please refer to the official documentation for installation.
Configuration Method
Claude Code supports fine-grained control through a configuration file.
1. Create a Configuration File
Create or edit the Claude Code configuration file at ~/.claude/settings.json
:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "your_longcat_api_key",
"ANTHROPIC_BASE_URL": "https://api.longcat.chat/anthropic",
"ANTHROPIC_MODEL": "LongCat-Flash-Chat",
"ANTHROPIC_SMALL_FAST_MODEL": "LongCat-Flash-Chat",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "LongCat-Flash-Chat",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "LongCat-Flash-Chat",
"CLAUDE_CODE_MAX_OUTPUT_TOKENS": "6000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1
},
"permissions": {
"allow": [],
"deny": []
}
}
2. Supported Models
The LongCat API Platform currently offers the following models:
Model Name | API Format | Description |
---|---|---|
LongCat-Flash-Chat | OpenAI/Anthropic | High-performance, general-purpose conversational model |
LongCat-Flash-Thinking | OpenAI/Anthropic | Deep-thinking model |
Test Claude Code
Start Claude Code and send a simple test message:
claude
Then, enter a test message, such as: "Hello, please introduce yourself"
If the configuration is correct, you should receive a response from the LongCat model.