API DocsAPI Docs
LongCat API Platform
  • English
  • 简体中文
LongCat API Platform
  • English
  • 简体中文
  • Quick Start
  • API Docs
  • FAQ

LongCat API Platform Quick Start Guide

Welcome to the LongCat API Platform! This document will help you get started quickly and begin using our large model services.

1. How to Get an API Key?

Register an Account

  1. Visit LongCat API Platform
  2. Fill in the required information to complete account registration

Get the Default Key

  1. After successful registration, the system will automatically create an API Key named "default" for each account
  2. After logging in, go to the API Keys page to view:
    • Name: Unique identifier for the application
    • Key: Application secret (please keep it safe and do not disclose it)

2. Supported API Types

LongCat API Platform is compatible with two mainstream API formats. You can choose according to your needs:

OpenAI API Format

Fully compatible with the OpenAI API specification, supporting the following endpoints:

  • Chat Completion: /v1/chat/completions

Anthropic API Format

Compatible with the Anthropic Claude API specification, supporting the following endpoint:

  • Message Chat: /v1/messages

Endpoints

  • OpenAI Format: https://api.longcat.chat/openai
  • Anthropic Format: https://api.longcat.chat/anthropic

Supported Models

Model NameAPI FormatDescription
LongCat-Flash-ChatOpenAI/AnthropicHigh-performance general-purpose chat model

3. How to Get Usage Quota?

Daily Free Quota

  • Each account automatically receives 1,00,000 tokens free quota per day
  • The free quota is refreshed automatically at midnight (Beijing Time) every day
  • Unused quota from the previous day will be cleared and will not roll over to the next day

Quota Usage Instructions

  • Both input and output tokens are counted towards consumption
  • Streaming and non-streaming endpoints consume quota equally

Quota Inquiry

You can view your usage in real time at Usage Information

Note: The platform is currently in public beta and does not support paid quota purchases.

4. Rate Limiting Rules

Single Request Limit

  • Output text: Maximum 8K tokens

Over-limit Handling

When rate limiting is triggered, the API will return HTTP status code 429. Example response:

{
  "error": {
    "code": "rate_limit_exceeded",
    "message": "Request rate limit exceeded, please try again later",
    "type": "rate_limit_error",
    "retry_after": 60
  }
}

It is recommended to implement exponential backoff retry mechanism on the client side.

Quick Integration Examples

OpenAI API Format Example

Python Example

import requests

url = "https://api.longcat.chat/openai/chat/completions"
headers = {
    "Authorization": "Bearer YOUR_APP_KEY",
    "Content-Type": "application/json"
}

data = {
    "model": "LongCat-Flash-Chat",
    "messages": [
        {"role": "user", "content": "Hello, please introduce yourself."}
    ],
    "max_tokens": 1000,
    "temperature": 0.7
}

response = requests.post(url, headers=headers, json=data)
print(response.json())

Using OpenAI SDK

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-Flash-Chat",
    messages=[
        {"role": "user", "content": "Hello!"}
    ],
    max_tokens=1000
)

print(response.choices[0].message.content)

Anthropic API Format Example

Using Anthropic SDK

from anthropic import Anthropic

client = Anthropic(
    api_key="Authorization: Bearer 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-Flash-Chat",
    max_tokens=1000,
    messages=[
        {"role": "user", "content": "Hello!"}
    ]
)

print(response.content[0].text)

cURL Example

OpenAI Format

curl -X POST https://api.longcat.chat/openai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_APP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "LongCat-Flash-Chat",
    "messages": [{"role": "user", "content": "Hello!"}],
    "max_tokens": 1000
  }'

Anthropic Format

curl -X POST https://api.longcat.chat/anthropic/v1/messages \
  -H "Authorization: Bearer YOUR_APP_KEY" \
  -H "Content-Type: application/json" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "LongCat-Flash-Chat",
    "max_tokens": 1000,
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Important Reminders

  • Please use your daily free quota reasonably. Unused quota will not be retained for the next day
  • Please keep your API Key safe to avoid quota theft due to leakage

Now you have learned the basics of using the LongCat API Platform. Go ahead and try it out!

Last Updated:: 9/5/25, 10:13 PM
Contributors: zhuqi09
Next
API Docs