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

# OpenCode

> Set up OpenCode with TrueFoundry AI Gateway using the setup wizard.

Connect OpenCode to your organization's gateway. The wizard configures its models and optional MCP servers and Skills.

## Run setup

With OpenCode installed, [install the setup tool](https://www.truefoundry.com/docs/ai-gateway/personal-setup.md#install-the-setup-tool), then run:

```bash theme={"dark"}
tfy-local-ai-setup personal opencode
```

Sign in to your organization, choose the models recommended by your administrator and any MCP servers or Skills you need, then review and approve the changes. You can skip MCP servers and Skills. See the [overview](https://www.truefoundry.com/docs/ai-gateway/personal-setup.md#connect-your-agents) for the shared wizard walkthrough.

## Choose models

Select the models OpenCode should offer, then choose the default for new sessions. Use the model IDs recommended by your administrator.

![OpenCode model list and default settings](https://mintcdn.com/truefoundry/6Os5PQcPcHaNsbQT/images/ai-gateway/personal-setup/opencode-models.png?fit=max\&auto=format\&n=6Os5PQcPcHaNsbQT\&q=85\&s=7576390db795d9a76817796f445ad00f)

Example available models and default model.

## Open OpenCode

Open a **new terminal** and launch OpenCode normally. If you use the desktop app, launch it from the new terminal so it receives the updated shell environment. Follow any remaining actions in the completion summary.

## Optional: authorize MCP servers

For servers requiring sign-in, run:

```bash theme={"dark"}
opencode mcp auth <server-name>
```

Replace `<server-name>` with the configured server's name.

## Verify the connection

Select your configured model in a new conversation and ask: `Reply exactly TFY-CHAT-OK. Do not use tools.` Confirm that a response arrives without an authentication or model error. Then [verify the request in the gateway](https://www.truefoundry.com/docs/ai-gateway/personal-setup.md#verify-the-connection).

For manual configuration and advanced options, see the [OpenCode integration guide](https://www.truefoundry.com/docs/ai-gateway/opencode.md).


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