API DocsAPI Docs
LongCat API Platform
  • English
  • 简体中文
LongCat API Platform
  • English
  • 简体中文
  • Quick Start
  • API Docs
  • Claude Code Configuration
  • Kilo Code Configuration
  • OpenCode Configuration
  • OpenClaw Configuration
  • FAQ
  • Change Log

OpenCode

Using LongCat Models for AI Programming in OpenCode

Overview

LongCat series models are supported for use in OpenCode. This document describes how to integrate OpenCode with the LongCat API Open Platform.

Prerequisites

Install OpenCode CLI

  • Install OpenCode using curl
curl -fsSL https://opencode.ai/install | bash
  • Install OpenCode using npm
npm i -g opencode-ai

Configure LongCat API

  1. Run the authentication command
opencode auth login

Authentication.png

  1. Select Provider

Select the provider as Other, and enter LongCat other.png

  1. Enter API KEY

Enter any content; it will be configured later in the config file apikey.png

  1. File Configuration

Open the OpenCode configuration directory

- macOS / Linux: ~/.config/opencode/

- Windows: Users\***\.config\opencode

Create or edit the configuration file in that directory: opencode.json

file.png

opencode.json content

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "LongCat": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "LongCat",
      "options": {
        "baseURL": "https://api.longcat.chat/openai",
        "apiKey": "YOUR_API_KEY"
      },
      "models": {
        "LongCat-2.0-Preview": {
          "name": "LongCat-2.0-Preview"
        }
      }
    }
  }
}

Supported Models

Model NameAPI FormatDescription
LongCat-Flash-ChatOpenAI/AnthropicHigh-performance general-purpose dialogue model
LongCat-Flash-ThinkingOpenAI/AnthropicDeep thinking model
LongCat-Flash-Thinking-2601OpenAI/AnthropicUpgraded deep thinking model
LongCat-Flash-LiteOpenAI/AnthropicEfficient lightweight MoE model
LongCat-2.0-PreviewOpenAI/AnthropicHigh-performance Agentic model

Test CodingCode

Go back to the command line interface and type opencode to start using it start.png

Use /models to switch the model to LongCat-2.0-Preview models.png

Then enter your question and start the conversation conversation.png

Last Updated: 4/25/26, 9:41 AM
Prev
Kilo Code Configuration
Next
OpenClaw Configuration