Skip to main content
OpenCode is a programming agent product. Its interface, configuration items, and supported capabilities may change with different OpenCode versions. This article demonstrates how to forward OpenCode model requests to the Kimi API through built-in authentication, based on the official Kimi API calling method.

Install OpenCode

The easiest way to install OpenCode is through the installation script.
curl -fsSL https://opencode.ai/install | bash
You can also install it via npm:
npm install -g opencode-ai

Configure API Key

Run opencode auth login and select Moonshot AI.
$ opencode auth login
  Add credentials

  Select provider
 Moonshot AI
  ...

Enter your Moonshot AI API key.
$ opencode auth login
  Add credentials

  Select provider
  Moonshot AI

  Enter your API key
  _

Run opencode to start OpenCode.
$ opencode
Use the /models command to select the Kimi K2.7 Code model.
/models
For more information, please visit opencode.ai/docs