Generate an API key after logging in, call the chat completions endpoint, and pay with the same credits used by the Playground.
API calls require a LongCat 2.0 Online API key. Anonymous API access is not available.
Calls are checked against your credit balance before generation and deducted after successful model output.
Use the OpenAI SDK by setting the base URL to https://longcat20.online/api/v1.
Input
900
credits / 1M uncached input tokens
Cached input
20
credits / 1M cached input tokens
Output
3,600
credits / 1M output tokens
curl -X POST https://longcat20.online/api/v1/chat/completions \
-H "Authorization: Bearer YOUR_LONGCAT20_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "LongCat-2.0",
"messages": [{"role": "user", "content": "Hello from the API"}],
"max_tokens": 1200
}'from openai import OpenAI
client = OpenAI(
api_key="YOUR_LONGCAT20_API_KEY",
base_url="https://longcat20.online/api/v1"
)
response = client.chat.completions.create(
model="LongCat-2.0",
messages=[{"role": "user", "content": "Hello from the API"}],
max_tokens=1200,
)
print(response.choices[0].message.content)New users can first try LongCat 2.0 in the online Playground. A free account receives starter credits, and successful generations use the same metering rules shown on this page. When you are ready to integrate, create a key and send it as a Bearer token. Failed authentication and rejected requests are not charged.