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-aiConfigure LongCat API
- Run the authentication command
opencode auth login
- Select Provider
Select the provider as Other, and enter LongCat

- Enter API KEY
Enter any content; it will be configured later in the config file

- File Configuration
Open the OpenCode configuration directory
- macOS / Linux: ~/.config/opencode/
- Windows: Users\***\.config\opencodeCreate or edit the configuration file in that directory: opencode.json

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": {
"name": "LongCat-2.0",
"options": {
"thinking": {
"type": "disabled"
}
}
}
}
}
}
}💡 About thinking mode: When using
LongCat-2.0, the model supports controlling whether thinking is enabled via thethinkingfield in the request body, with values{"type":"enabled"}(thinking on) or{"type":"disabled"}(thinking off). It is disabled by default. In OpenCode, you can configure this field within the model'soptions, as shown in the example above—disabledturns thinking off, andenabledturns it on.
Supported Models
| Model Name | API Format | Description |
|---|---|---|
| LongCat-2.0 | OpenAI/Anthropic | High-performance Agentic model |
Test CodingCode
Go back to the command line interface and type opencode to start using it

Use /models to switch the model to LongCat-2.0

Then enter your question and start the conversation
