# 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="https://2211217319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYGsEKyV2Zq4Q8fEJQT40%2Fuploads%2FGv674BpNx4RShjhUu9Ar%2Fimage.png?alt=media&#x26;token=7b35181d-876b-4c7a-a33e-76c206fd8732" alt="" width="563"><figcaption></figcaption></figure>

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

<figure><img src="https://2211217319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYGsEKyV2Zq4Q8fEJQT40%2Fuploads%2FafAHX6A1QjFWG626KIoo%2Fimage.png?alt=media&#x26;token=c3c9407e-2d65-4a62-a21b-2c8ecc39cfb4" 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="https://2211217319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYGsEKyV2Zq4Q8fEJQT40%2Fuploads%2FLUOufp1yV6Y0wDP5A9K3%2Fimage.png?alt=media&#x26;token=07e35b5f-6ef7-4106-b0bb-107fb58e15a3" 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="https://2211217319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYGsEKyV2Zq4Q8fEJQT40%2Fuploads%2FOnTWnlUYJ1L3t0ux4tpo%2Fimage.png?alt=media&#x26;token=21eb7034-2654-4277-bbe3-c5c5d73e94a5" 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="https://2211217319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYGsEKyV2Zq4Q8fEJQT40%2Fuploads%2FPDyOWqqWFgV9XiWp8diQ%2Fimage.png?alt=media&#x26;token=47766fff-7bc9-4fc9-8f93-dc38255f2c0c" 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) 👩‍💻👨‍💻.
