> For the complete documentation index, see [llms.txt](https://docs.cortecs.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cortecs.ai/integration-examples/coding/opencode.md).

# Opencode

[**Opencode**](https://opencode.ai/) is a powerful, open-source AI coding agent built specifically for the terminal, featuring a native, responsive, and themeable terminal user interface. **Opencode** offers developers terminal-based coding assistance, debugging, file management, and command execution — all within the CLI.<br>

This guide will walk you through the setup process and show you how to combine **Opencode** with **Cortecs** for enhanced productivity.

{% hint style="info" %}
*Before you begin: Make sure you have generated your Cortecs API key. If not, check out our* [*QuickStart*](https://docs.cortecs.ai/quickstart) *guide.*
{% endhint %}

## 1. Install Opencode

Run the following command in your terminal to install Opencode:

```apache
curl -fsSL https://opencode.ai/install | bash
```

For additional installation options, refer to the [Opencode documentation](https://opencode.ai/docs#install).

## 2. Connect to cortecs

Cortecs provides a **native integration** for Opencode:

1. Run the authentication command:

```bash
opencode auth login
```

2. Select **Cortecs** as the provider:

<figure><img src="/files/ZUkbKWqLgeAoa2BZZzDo" alt="" width="563"><figcaption></figcaption></figure>

3. Enter your **Cortecs API key** and press Enter:

<figure><img src="/files/l0vS35VSN1UWUcxhvlh4" alt="" width="563"><figcaption></figcaption></figure>

Your authentication is now complete :white\_check\_mark:.

## 3. Start using Opencode

1. Launch Opencode by typing `opencode` in your console:

<figure><img src="/files/mwJoxsOxi49UYs0zMEFE" alt="" width="563"><figcaption></figcaption></figure>

2. Once the Opencode terminal opens, start a new session using `/new`, then use `/models` to view and select a model:

<figure><img src="/files/q5iPsmvBR5U4SM1FDmJ7" alt="" width="563"><figcaption></figcaption></figure>

Choose the model you want to use and press Enter ✅.

> 💡 **Tip:** If you’re looking for a specific model, you can either:
>
> * Join the [Discord](https://discord.com/invite/bPFEFcWBhp) community 💬 and request it, or
> * Add it directly to the [Models.dev](https://github.com/sst/models.dev/tree/dev/providers/cortecs/models) open-source database in the Cortecs provider folder.

**You’re all set!** 🎉

You can now start a discussion with your AI agent!

<figure><img src="/files/MtuAHhmc3s0giarae34Q" alt="" width="563"><figcaption></figcaption></figure>

Enjoy the power of **Cortecs** and **Opencode**, explore different models, and share feedback with the community on [Discord](https://discord.com/invite/bPFEFcWBhp) 👩‍💻👨‍💻.
