LongCat API Quick Start

A primary-source-based introduction to creating a LongCat API key and sending a basic chat completion request through the OpenAI-compatible endpoint.

  • Category: API setup
  • Published: 2026-07-17
  • Author: LongCat Community Hub editorial team
  • Last reviewed: 2026-07-17

Independent third-party resource. Not affiliated with or endorsed by LongCat or Meituan.

This independent guide summarizes the documented setup flow for sending a basic request to the LongCat API through its OpenAI-compatible interface. Always review the cited primary documentation before using an API in production.

Who this guide is for

This guide is written for developers and AI builders who want to send a first request to the LongCat API using the OpenAI-compatible chat completions endpoint. It only covers the flow that the cited primary documentation explicitly describes.

It does not cover advanced topics such as streaming, tool use, or production deployment. The cited primary documentation is the source of truth for those topics.

Before you begin

The LongCat API platform requires a registered account and a manually created API key. The cited Quick Start states that the API key is shown only once and must be stored securely.

Treat the API key as a secret. Do not place it in browser-side code, public repositories, or client-side mobile applications.

  • Create a LongCat API platform account through the platform sign-up page.
  • Sign in and open the API Keys page, then create a new key manually.
  • Copy and store the key securely when it is shown. If you lose it, you will need to create a new one.
  • In production code, load the key from an environment variable or a secure secret manager.

This site does not issue, manage, or bill for LongCat API keys.

Documented setup flow

The cited API overview documents a single production base URL for the platform, and the cited Quick Start documents two compatible API formats on top of that base URL: an OpenAI-compatible format and an Anthropic-compatible format.

The OpenAI-compatible format exposes a chat completions endpoint. The Anthropic-compatible format exposes a messages endpoint.

Textdocumented base URLs
https://api.longcat.chat
OpenAI-compatible base path: /openai
Anthropic-compatible base path: /anthropic

Send a basic chat completion request

The documented OpenAI-compatible chat completions path is /openai/v1/chat/completions. The model ID documented in the cited Quick Start model table is LongCat-2.0.

Replace YOUR_API_KEY with your own secret value. The example below mirrors the structure shown in the cited Quick Start.

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

API compatibility

The cited API overview states that the platform is compatible with the OpenAI Python SDK for the /openai/ endpoints and with the Anthropic Python SDK for the /anthropic/ endpoints. Any HTTP client that supports the corresponding format is also listed as supported.

The cited Quick Start also documents that LongCat-2.0 has a 1M-token context window with a maximum output length of 128K tokens. Rate limiting is enforced per API key, and exceeding the documented limits returns HTTP 429.

  • OpenAI-compatible chat completions: POST /openai/v1/chat/completions
  • Anthropic-compatible messages: POST /anthropic/v1/messages
  • Documented model ID: LongCat-2.0
  • Documented context window: up to 1,000,000 tokens, up to 128K output tokens

Security notes

API keys are sensitive credentials. The cited Quick Start explicitly recommends keeping API keys safe to avoid quota theft due to leakage.

Use the OpenAI-compatible base URL and Anthropic-compatible base URL documented in the cited primary documentation; do not embed keys in any browser-side or public code path. When integrating through a CLI tool such as Claude Code, prefer the configuration file or environment variables described in the corresponding publisher documentation page rather than ad-hoc shell scripts.

This site never asks for, stores, or transmits LongCat API keys.

Pricing note

LongCat-2.0 pricing is documented on a dedicated publisher pricing page and is expressed per 1M tokens. The cited Quick Start reminds readers that the prices shown on the platform and on the user’s billing records are authoritative.

This guide does not restate the current price numbers, because pricing may change. Review the cited pricing page for the latest values and last-reviewed date.

Pricing last reviewed against the cited publisher page on 2026-07-17. Confirm current pricing on the publisher page before quoting it.

Related model page

The LongCat-2.0 model profile on this site summarizes the documented access options and verified source links for the same model that this Quick Start calls.

See the LongCat-2.0 profile for a higher-level description of what the model is and where the underlying facts come from.

Next steps

After a basic request works, review the cited API overview for the full list of endpoints, error responses, and SDK options before deploying an integration.

For the documented context window, the documented pricing model, and the Claude Code configuration, follow the publisher documentation links in the Sources section of this page.

API availability, supported models, limits, and pricing can change. Always confirm current details in the cited primary documentation.

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 API Quick Start

    Publisher documentationAccessed 2026-07-17

    Publisher documentation for account creation, API key creation, supported API formats, endpoints, and request examples.

  • LongCat API overview

    Publisher documentationAccessed 2026-07-17

    Publisher documentation for the production base URL, Bearer authentication, and the supported OpenAI- and Anthropic-compatible endpoints.

  • LongCat Claude Code configuration

    Publisher documentationAccessed 2026-07-17

    Publisher documentation showing how the model is exposed through the Anthropic-compatible endpoint and which model ID is supported.

  • LongCat-2.0 API pricing

    Publisher documentationAccessed 2026-07-17

    Publisher pricing page for LongCat-2.0 pay-as-you-go, including input, cached input, and output prices.

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.