Skip to main content
OpenCode is a terminal-based AI coding assistant with a rich TUI (text user interface). It provides an interactive coding experience with file management, reasoning visualization, and tool calling capabilities.
Verified working with MiniMax-M2.7 on Infercom.

Prerequisites

Installation

Verify installation:

Configuration

OpenCode requires a configuration file to define the Infercom provider.

Step 1: Create Config File

Create ~/.config/opencode/opencode.json:
For complex tasks, OpenCode supports separate plan/build agents. You can use a frontier model (Claude, GPT, Gemini) for planning and MiniMax-M2.7 for execution. See OpenCode documentation for multi-provider configuration.

Step 2: Add API Key

Run the auth login command:
Select the Infercom provider and paste your API key when prompted.
Credentials are stored in ~/.local/share/opencode/auth.json

Step 3: Verify Setup

Check that the provider is configured:
Expected output:
List available models:
Expected output:

Model

Use infercom/MiniMax-M2.7 - optimized for agentic coding with 192K context, reasoning, and tool calling.

Usage

Interactive TUI

Launch the TUI:
Use /models to switch models if needed.

Non-Interactive Mode

For scripts and CI:
Example:

Model Configuration Options

Customize model capabilities in opencode.json:

Troubleshooting

Tool/File Operations Return Empty

If tool or file operations return empty responses, ensure npm is set to @ai-sdk/openai-compatible, not @ai-sdk/openai. The @ai-sdk/openai package routes to an endpoint that has a known streaming issue with tool calls.

Read-Before-Write Errors

OpenCode requires reading files before overwriting them (safety feature):
This is expected behavior. OpenCode will automatically read the file and retry.

Provider Not Found

Ensure the config file is in the correct location:

Authentication Failed

Re-run the login command:
Or manually edit ~/.local/share/opencode/auth.json:

Performance

  • Token throughput: 400+ tokens/sec with MiniMax-M2.7
  • Context window: 192K tokens
  • Tool calling: Fully supported for file operations

Next Steps