LongCat API Setup for LongCat-2.0 in OpenClaw

This page covers how to set up the LongCat API for LongCat-2.0, a reasoning model for coding and agent tasks. It includes installation, API key creation, and verification steps for OpenClaw users.

Read this when

  • You want to use LongCat-2.0 with OpenClaw
  • You need the LongCat API key or model limits

LongCat offers a hosted API for LongCat-2.0, a reasoning model designed for coding and agent tasks. OpenClaw ships the official longcat plugin for LongCat's OpenAI-compatible endpoint.

PropertyValue
Providerlongcat
AuthLONGCAT_API_KEY
APIOpenAI-compatible Chat Completions
Base URLhttps://api.longcat.chat/openai
Modellongcat/LongCat-2.0
Context1,048,576 tokens
Max output131,072 tokens
InputText

Install plugin

Install the official package, then restart Gateway:

openclaw plugins install @openclaw/longcat-provider
openclaw gateway restart

Getting started

Create an API key

Log into the LongCat API Platform and generate a key on the API Keys page.

Run onboarding

openclaw onboard --auth-choice longcat-api-key

Verify the model

openclaw models list --provider longcat

Onboarding adds the hosted catalog and picks longcat/LongCat-2.0 when no primary model is already set.

Non-interactive setup

openclaw onboard --non-interactive \
  --mode local \
  --auth-choice longcat-api-key \
  --longcat-api-key "$LONGCAT_API_KEY"

Reasoning behavior

LongCat exposes binary thinking control. OpenClaw maps enabled thinking levels to thinking: { type: "enabled" } and /think off to thinking: { type: "disabled" }. LongCat does not currently document reasoning_effort, so OpenClaw omits it.

LongCat returns reasoning in reasoning_content. OpenClaw keeps that field when replaying assistant tool-call turns so multi-turn agent sessions retain the provider's expected message shape.

Pricing

The built-in catalog uses LongCat's pay-as-you-go list prices in USD per million tokens: $0.75 uncached input, $0.015 cached input, and $2.95 output. LongCat may offer temporary discounts; the pricing page and your billing records are authoritative.

Self-hosted LongCat-2.0

The longcat provider targets LongCat's hosted API. For the open weights on Hugging Face, serve the model through an OpenAI-compatible runtime and use OpenClaw's existing vLLM or SGLang provider instead.

Keep the runtime's exact model identifier in the self-hosted provider catalog; do not route a local deployment through longcat/LongCat-2.0.

Troubleshooting

The key works in a shell but not in the Gateway

Daemon-managed Gateway processes do not inherit every interactive shell variable. Put LONGCAT_API_KEY in ~/.openclaw/.env, configure it through onboarding, or use an approved secret reference.

Requests fail with 402 or 429

402 means the account has insufficient token quota. 429 means the API key hit a rate limit. Check LongCat usage and retry rate-limited requests after the provider's backoff window.

The model does not appear

Run openclaw plugins list and confirm the longcat plugin is enabled, then run openclaw models list --provider longcat.

  • Model providers, Provider configuration, model refs, and failover behavior.

  • LongCat API docs, Hosted API endpoints, authentication, limits, and examples.

  • LongCat-2.0 model card, Architecture, deployment guidance, and model details.

  • Secrets, Store provider credentials without embedding plaintext in config.