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

# Connect Kilo CLI and OpenCode

> Set up Kilo CLI or OpenCode with the Fortytwo API: add Fortytwo as an OpenAI-compatible provider, connect it with /connect and select qwen/qwen3.8-27b.

[Kilo CLI ](https://kilo.ai/docs/code-with-ai/platforms/cli) is a fork of [OpenCode ](https://opencode.ai/), so both connect to Fortytwo the same way. Only the commands and the config file differ.

> [!NOTE]
>
> **Before you start:** create a Fortytwo API key and buy credits — see [Quickstart, step 1](https://docs.fortytwo.network/docs/quickstart.md#1-create-an-api-key). Give each agent its own key with a **Spend limit**.
>
> | Setting | Value |
> | - | - |
> | Base URL | `https://api.fortytwo.network/v1` |
> | Model ID | `qwen/qwen3.8-27b` |

**Kilo CLI**

**1. Install Kilo CLI**

```bash theme={null}
npm install -g @kilocode/cli
```

**2. Add Fortytwo to the config**

Open `~/.config/kilo/kilo.jsonc` and add the `fortytwo` provider. For a new file:

> [!NOTE]
>
> `~` is your home folder. Folders that start with a dot, such as `.pi`, `.config` or `.codex`, are hidden. To show them: **Cmd+Shift+.** in Finder on macOS, **View** → **Show** → **Hidden items** in File Explorer on Windows, **Ctrl+H** in most Linux file managers.

```json ~/.config/kilo/kilo.jsonc theme={null}
{
  "$schema": "https://app.kilo.ai/config.json",
  "provider": {
    "fortytwo": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Fortytwo",
      "options": {
        "baseURL": "https://api.fortytwo.network/v1"
      },
      "models": {
        "qwen/qwen3.8-27b": {
          "name": "Qwen3.8 27B",
          "reasoning": true,
          "tool_call": true,
          "limit": { "context": 262144, "output": 16384 }
        }
      }
    }
  }
}
```

If the file has other settings, add `fortytwo` inside its `provider` object. If you set up [Kilo Code](https://docs.fortytwo.network/agents/kilo-code.md) in VS Code, Fortytwo is already in this file: skip this step.

**3. Connect Fortytwo**

1. Start Kilo in your project folder:

```bash theme={null}
kilo
```

2. Type `/connect`, search for `Fortytwo` and select it.

   ![Kilo CLI: Fortytwo in the Connect a provider list](https://mintcdn.com/fortytwo-f43ac997/HbC5gKcbcuN88RH4/resources/illustrations/agents/kilo-cli-1.png?fit=max\&auto=format\&n=HbC5gKcbcuN88RH4\&q=85\&s=1f00b4cba0da4ce796f1e6268aeead09)

3. Paste your API key and press **Enter**. The field shows the key as plain text, so do not share your screen at this moment.

4. Kilo opens the model list. Choose **Qwen3.8 27B**.

   ![Kilo CLI: Qwen3.8 27B under Fortytwo](https://mintcdn.com/fortytwo-f43ac997/HbC5gKcbcuN88RH4/resources/illustrations/agents/kilo-cli-2.png?fit=max\&auto=format\&n=HbC5gKcbcuN88RH4\&q=85\&s=05308966e691e7207f2b7b7bce20ff75)

5. In **Select variant**, choose **medium** to turn on reasoning. The prompt shows **Qwen3.8 27B Fortytwo · medium**.

   ![Kilo CLI: Select variant with medium selected](https://mintcdn.com/fortytwo-f43ac997/HbC5gKcbcuN88RH4/resources/illustrations/agents/kilo-cli-3.png?fit=max\&auto=format\&n=HbC5gKcbcuN88RH4\&q=85\&s=220595f9d300565cd47f98a0dd0c7b74)

**4. Start a task**

Type a task and press **Enter**. Kilo may ask before it runs a command; choose **Allow once** or **Allow always**. To change the model later, type `/models`; to change the reasoning level, type `/variants`.

![Kilo CLI: task done on Qwen3.8 27B Fortytwo with variant medium](https://mintcdn.com/fortytwo-f43ac997/HbC5gKcbcuN88RH4/resources/illustrations/agents/kilo-cli-4.png?fit=max\&auto=format\&n=HbC5gKcbcuN88RH4\&q=85\&s=3715308d35d3901ce1e007f55cad125d)

**OpenCode**

**1. Install OpenCode**

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

Open a new terminal window when the installer finishes: the `opencode` command works only there. Other install options: [OpenCode on GitHub ](https://github.com/anomalyco/opencode#installation).

**2. Add Fortytwo to the config**

Open `~/.config/opencode/opencode.json` and add the `fortytwo` provider. For a new file:

> [!NOTE]
>
> `~` is your home folder. Folders that start with a dot, such as `.pi`, `.config` or `.codex`, are hidden. To show them: **Cmd+Shift+.** in Finder on macOS, **View** → **Show** → **Hidden items** in File Explorer on Windows, **Ctrl+H** in most Linux file managers.

```json ~/.config/opencode/opencode.json theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "fortytwo": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Fortytwo",
      "options": {
        "baseURL": "https://api.fortytwo.network/v1"
      },
      "models": {
        "qwen/qwen3.8-27b": {
          "name": "Qwen3.8 27B",
          "reasoning": true,
          "tool_call": true,
          "limit": { "context": 262144, "output": 16384 }
        }
      }
    }
  }
}
```

If the file has other settings, add `fortytwo` inside its `provider` object.

**3. Connect Fortytwo**

1. Start OpenCode in your project folder:

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

2. Type `/connect`, search for `Fortytwo` and select it.

   ![OpenCode: Fortytwo in the Connect an integration list](https://mintcdn.com/fortytwo-f43ac997/HbC5gKcbcuN88RH4/resources/illustrations/agents/opencode-1.png?fit=max\&auto=format\&n=HbC5gKcbcuN88RH4\&q=85\&s=eee2d50e480ccffc21f38fe369df62ed)

3. Paste your API key and press **Enter**. OpenCode shows **Connected Fortytwo**.

4. OpenCode opens the model list. Choose **Qwen3.8 27B**.

   ![OpenCode: Qwen3.8 27B under Fortytwo, with the Connected Fortytwo message](https://mintcdn.com/fortytwo-f43ac997/HbC5gKcbcuN88RH4/resources/illustrations/agents/opencode-2.png?fit=max\&auto=format\&n=HbC5gKcbcuN88RH4\&q=85\&s=3540cdfb25834781708b604c59564f0b)

5. In **Select variant**, choose **medium** to turn on reasoning.

   ![OpenCode: Select variant with medium selected](https://mintcdn.com/fortytwo-f43ac997/HbC5gKcbcuN88RH4/resources/illustrations/agents/opencode-3.png?fit=max\&auto=format\&n=HbC5gKcbcuN88RH4\&q=85\&s=372d456dbba8cf61b5c909635a984fde)

The prompt shows **Qwen3.8 27B Fortytwo · medium**.

![OpenCode: prompt with Qwen3.8 27B Fortytwo and variant medium](https://mintcdn.com/fortytwo-f43ac997/HbC5gKcbcuN88RH4/resources/illustrations/agents/opencode-4.png?fit=max\&auto=format\&n=HbC5gKcbcuN88RH4\&q=85\&s=486dc38c335205d798e5e1517c14623d)

**4. Start a task**

Type a task and press **Enter**. To change the model later, type `/models`; to change the reasoning level, type `/variants`.

![OpenCode: task done on Qwen3.8 27B Fortytwo with variant medium](https://mintcdn.com/fortytwo-f43ac997/HbC5gKcbcuN88RH4/resources/illustrations/agents/opencode-5.png?fit=max\&auto=format\&n=HbC5gKcbcuN88RH4\&q=85\&s=45acadf4019246e1aabab5d8294022d9)

The model ID inside these tools is `fortytwo/qwen/qwen3.8-27b`: the provider ID, then the Fortytwo model ID. More options: [Kilo custom models ](https://kilo.ai/docs/code-with-ai/agents/custom-models), [OpenCode custom provider ](https://opencode.ai/docs/providers/#custom-provider).

***

Something not working with your agent, or using one we have not listed? Tell us in the platform: [Feedback](https://docs.fortytwo.network/docs/support.md#ideas-feedback-and-small-bugs) for ideas and small bugs, [Contact support](https://docs.fortytwo.network/docs/support.md#support-account-api-billing-credits-errors) if it blocks your work, or [Report a security issue](https://docs.fortytwo.network/docs/support.md#security-issue).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.