This official documentation gets you an API key in five minutes, lets you connect LongCat-2.0 to any client using either OpenAI- or Anthropic-compatible formats, and explains the 1M context / 128K maximum output parameters and the pricing structure in which cache hits are not billed.
Suitable tasks: Connect LongCat-2.0 to a self-hosted application, script, IDE plugin, or Agent framework; evaluate costs; configure cache optimization for Agent loops
Unsuitable tasks: Multimodal input (the API accepts text only, and the official documentation explicitly says "Text input only"); model parameter tuning not publicly disclosed by the official source
Applicable model version: LongCat-2.0 (currently the only model sold on the API platform)
Applicable clients, Agents, or APIs: Any OpenAI-compatible client (base_url pointing to /openai), any Anthropic-compatible client (base_url pointing to /anthropic), OpenAI/Anthropic SDKs, cURL
Recommended reasoning tier and parameters: temperature 0~1; max_tokens capped at 131072 (128K); enable thinking with {"type":"enabled"} and disable it with {"type":"disabled"} (enabled by default); cached-input billing is far lower than uncached-input billing
Visit https://longcat.chat/platform and create an account.
After signing in, open the API Keys page and create a key manually (it is shown only once at creation, so save it immediately).
| Format | Endpoint | Compatible with |
|---|---|---|
| OpenAI format | https://api.longcat.chat/openai/v1/chat/completions | OpenAI SDK / compatible clients |
| Anthropic format | https://api.longcat.chat/anthropic/v1/messages | Anthropic SDK / compatible clients |
Model name: LongCat-2.0 (available in both OpenAI and Anthropic formats).
Limitations: Maximum context is 1M tokens and maximum output is 128K tokens (max_tokens capped at 131072). Requests beyond the limit return HTTP 429; clients should use exponential-backoff retries.
from openai import OpenAI
client = OpenAI(
api_key="YOUR_APP_KEY",
base_url="https://api.longcat.chat/openai"
)
response = client.chat.completions.create(
model="LongCat-2.0",
messages=[{"role": "user", "content": "Hello!"}],
max_tokens=1000
)
print(response.choices[0].message.content)from anthropic import Anthropic
client = Anthropic(
api_key="YOUR_APP_KEY",
base_url="https://api.longcat.chat/anthropic",
default_headers={
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_APP_KEY",
}
)
response = client.messages.create(
model="LongCat-2.0",
max_tokens=1000,
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.content[0].text)POST https://api.longcat.chat/openai/v1/chat/completions
Authorization: Bearer YOUR_API_KEY
body:
model: "LongCat-2.0"
messages: [{role: "system"|"user"|"assistant", content: "<plain text>"}]
stream: true|false # SSE streaming supported
max_tokens: 131072 # 128K limit
temperature: 0 ~ 1
top_p: <nucleus sampling parameter>
thinking: {"type": "enabled"} | {"type": "disabled"} # Explicitly toggle thinking modeThe response includes reasoning_content and usage.completion_tokens_details.reasoning_tokens (the number of reasoning tokens), which can be used to track reasoning overhead.
| Billing item | List price | Limited-time discounted price |
|---|---|---|
| Uncached input | ¥5 | ¥2 |
| Cached input | ¥0.10 | ¥0.04 |
| Output | ¥20 | ¥8 |
Note: The official source also sells token packages (a post from the official X account on 2026-08-03: 50 million tokens for $4.9, with a limited-time 67% discount; a $1.9 starter package for new users). Prices are subject to the platform invoice.
The endpoints, parameters, and pricing above were transcribed directly from the official documentation pages (collected on 2026-08-18).
Community testing (r/vibecoding) confirmed that "cached input is not billed; only uncached input and output are charged," consistent with the official pricing language. However, the actual OpenRouter (AtlasCloud) transaction price (weighted average input price of $0.03872/M) is significantly below the list price, showing that the cache discount has a substantial effect in real Agent loops.
An AlphaSignal article (2026-07-01) cited an earlier list price of $0.69/$2.78 per 1M, which differs from the current official ¥5/¥20 figures; pay attention to the version date when citing it.
This document covers only the official direct channel (api.longcat.chat). Model IDs, prices, and free quotas on third-party channels such as OpenRouter, Nous Portal, and opencode are subject to each platform.
The API accepts text only and does not support image, audio, or video input.
The thinking parameter has a significant effect on output token count (reasoning tokens are included in output billing). To control costs, use {"type":"disabled"}.
LongCat 2.0