How to Use LongCat-2.0 with Claude Code
An independent third-party setup guide that summarizes the publisher-documented flow for pointing Claude Code at the LongCat API using the Anthropic-compatible endpoint.
- Category: Claude Code setup
- Published: 2026-07-17
Last reviewed: 2026-07-17
Independent third-party resource. Not affiliated with or endorsed by LongCat or Meituan.
This independent guide summarizes the publisher-documented flow for pointing the Claude Code CLI at the LongCat API through the Anthropic-compatible endpoint. The configuration values below are taken directly from the cited publisher documentation, and this site does not claim to have independently tested the configuration.
Before you begin
The cited publisher documentation lists two prerequisites before applying the Claude Code configuration. First, you need a LongCat API Platform account and an API key that you create manually on the platform. Second, you need the Claude Code CLI tool installed locally.
If you do not yet have a LongCat API key, follow the steps on the cited LongCat API Quick Start page to register an account and create one. The cited Quick Start also notes that the key is shown only once upon creation and must be stored securely.
- A LongCat API Platform account and an API key you created yourself on the platform (manual creation required).
- The Claude Code CLI tool installed locally and runnable from your shell.
- A secure local environment where the configuration file can be kept out of any public repository.
This site does not issue, manage, or bill for LongCat API keys. The cited publisher documentation is the source of truth for creating and revoking keys.
Documented configuration flow
The cited publisher documentation describes a single configuration file that Claude Code reads: ~/.claude/settings.json. The file shown below mirrors the configuration that the cited publisher page provides for using Claude Code with the LongCat API.
All field values below are taken from the cited publisher documentation. ANTHROPIC_AUTH_TOKEN is shown as a placeholder; do not paste a real API key into shared text, screenshots, or version control.
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "YOUR_LONGCAT_API_KEY",
"ANTHROPIC_BASE_URL": "https://api.longcat.chat/anthropic",
"ANTHROPIC_MODEL": "LongCat-2.0",
"ANTHROPIC_SMALL_FAST_MODEL": "LongCat-2.0",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "LongCat-2.0",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "LongCat-2.0",
"CLAUDE_CODE_MAX_OUTPUT_TOKENS": "131072",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1
},
"permissions": {
"allow": [],
"deny": []
}
}The variable names, the Anthropic-compatible base URL, the model ID, and the permissions structure above are taken from the cited publisher page. Do not add additional fields to this configuration without checking the cited publisher documentation first.
Test Claude Code
The cited publisher documentation describes the test step as running claude from the terminal, then sending a simple test message such as a short self-introduction request. The exact phrasing in the cited documentation is: “Hello, please introduce yourself.”
If the configuration is correct, the cited documentation states that Claude Code will respond through the LongCat model. This site has not run this test independently, and the cited publisher documentation is the source of truth for current behavior.
- Run claude from your terminal after saving ~/.claude/settings.json.
- Send a simple, non-sensitive test message such as: “Hello, please introduce yourself.”
- Confirm the response comes from the LongCat model before sending any real workload.
claudeSecurity checklist
The cited Quick Start reminds readers to keep API keys safe to avoid quota theft due to leakage. The same principle applies to the configuration file above, because it contains the API key in plain text.
Treat the configuration file and the API key it contains as the same kind of secret, and never publish the resolved contents alongside a real key value.
- Do not commit ~/.claude/settings.json, your API key, or any other secret to Git or a public repository.
- If a key is ever exposed, revoke or rotate it immediately through the publisher platform, then update the configuration file with the new value before sending further requests.
- Use the current publisher documentation to confirm the latest configuration, security, billing, and rate-limit guidance before relying on this configuration in production.
This site never asks for, stores, or transmits LongCat API keys.
Troubleshooting boundaries
The cited publisher documentation is the source of truth for current error messages, response codes, and configuration changes. This guide does not invent error-decoding steps or recommend workarounds that the cited documentation does not describe.
If a request fails, restrict yourself to verifying the documented configuration values against the cited publisher page before changing anything else, and consult the cited publisher support channels for any error the documentation does not cover.
- Verify that the Anthropic-compatible base URL in ANTHROPIC_BASE_URL is exactly https://api.longcat.chat/anthropic, as documented in the cited publisher page.
- Verify that ANTHROPIC_AUTH_TOKEN is loaded with your own current key, and rotate the key through the publisher platform if it has been exposed.
- Verify that the model identifiers (ANTHROPIC_MODEL, ANTHROPIC_SMALL_FAST_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_OPUS_MODEL) are all set to LongCat-2.0, as documented in the cited publisher page.
- For any error not covered above, consult the cited publisher documentation or the publisher's support channels rather than guessing.
Related pages
The pages linked below are independent third-party summaries on this site. They reuse the same source register as this guide and do not introduce new facts.
- LongCat-2.0 model profile
Verified source links and documented access options for the same model.
- LongCat API Quick Start
Independent summary of the documented OpenAI-compatible request flow and the underlying base URL.
- About this site
Background on how this independent third-party site sources, verifies, and discloses its content.
Independent third-party note
This guide is published by an independent third-party site. It is not affiliated with, endorsed by, sponsored by, or operated by Meituan, LongCat, Anthropic, or any of their affiliates. The configuration values and the test step above are taken from the cited publisher documentation and do not represent the views of any referenced organization.
No independent compatibility testing has been published by this site. The cited publisher documentation is the source of truth for current variable names, file paths, supported features, and the exact configuration required to use Claude Code with the LongCat API.
This site does not run Claude Code or the LongCat API as part of an automated independent test suite. The cited publisher documentation is the source of truth for current details.
FAQ
The questions below are limited to topics that the cited publisher documentation directly supports. This page does not embed FAQ structured data.
- Which configuration file does Claude Code read?
- The cited publisher documentation describes a single configuration file at ~/.claude/settings.json.
- Which base URL and model identifier does the documented configuration set?
- The cited publisher documentation sets ANTHROPIC_BASE_URL to https://api.longcat.chat/anthropic and the model identifiers to LongCat-2.0.
- Does using this configuration make Claude Code an official client of LongCat?
- No. This guide is published by an independent third-party site, and the configuration it summarizes is the publisher's documented integration, not an official endorsement.
Related model pages
- LongCat-2.0
A model documented in the meituan-longcat GitHub organization and exposed through the LongCat publisher API platform.
Sources
- LongCat Claude Code configuration
Publisher documentationAccessed 2026-07-17
Publisher documentation for configuring Claude Code to use the LongCat API through the Anthropic-compatible endpoint, including the documented model identifier for LongCat-2.0.
- LongCat API overview
Publisher documentationAccessed 2026-07-17
Publisher documentation for the production base URL, Bearer authentication, and the Anthropic-compatible endpoint used by this guide.
- LongCat API Quick Start
Publisher documentationAccessed 2026-07-17
Publisher quick start covering account creation, API key creation, supported API formats, and the documented LongCat-2.0 model identifier.
- LongCat-2.0 repository
Primary sourceAccessed 2026-07-17
Primary source repository associated with the LongCat-2.0 model, used to confirm that LongCat-2.0 is the documented model identifier in the publisher configuration.
Independent third-party disclosure
This page is published by an independent third-party site. It is not affiliated with, endorsed by, sponsored by, or operated by Meituan, LongCat, or any of their affiliates. The content summarizes publicly-available primary documentation and does not represent the views of any referenced organization.