> ## Documentation Index
> Fetch the complete documentation index at: https://platform.kimi.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Using Kimi Models in OpenCode

> [OpenCode](https://opencode.ai/) 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.

```bash theme={null}
curl -fsSL https://opencode.ai/install | bash
```

You can also install it via npm:

```bash theme={null}
npm install -g opencode-ai
```

## Configure API Key

Run `opencode auth login` and select **Moonshot AI**.

```bash theme={null}
$ opencode auth login
┌  Add credentials
│
◆  Select provider
│  ● Moonshot AI
│  ...
└
```

Enter your Moonshot AI API key.

```bash theme={null}
$ opencode auth login
┌  Add credentials
│
◇  Select provider
│  Moonshot AI
│
◇  Enter your API key
│  _
└
```

Run `opencode` to start OpenCode.

```bash theme={null}
$ opencode
```

Use the `/models` command to select the Kimi K2.7 Code model.

```bash theme={null}
/models
```

For more information, please visit [opencode.ai/docs](https://opencode.ai/docs)
