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

# Connect OpenCode

> Connect your coding terminal with one command and a browser approval.

Connect OpenCode to the available **Limitless models**, including **DeepSeek V4.1 Flash Unrestricted**, without copying an API key or editing a configuration file.

Using another coding tool? Open [Connect your coding tool](https://trylimitless.ai/app/connect) to see the available setup options.

You need [OpenCode](https://opencode.ai/docs/) 1.x installed, **Node.js 22 or newer** available as `node`, and a Limitless account with owner or admin access to a workspace. Local integration testing used OpenCode **v1.18.21**; the integration contract was also checked against **v1.19.0**.

## Connect

Run this in your terminal:

```sh theme={null}
opencode auth login https://trylimitless.ai
```

1. Your browser opens Limitless. Sign in if needed. If it does not open, follow the link printed in your terminal.
2. Check that the browser shows the **same connection code** as your terminal. Only approve a connection you started yourself.
3. Select the workspace and active project that should pay for requests, then choose **Approve connection**.
4. Return to the terminal and wait for OpenCode to confirm the connection. Start a new OpenCode session to load the configuration.

Limitless supplies the endpoint and the same available-model catalog used by the API, including each model's capabilities and runtime token limits. Select **Limitless / deepseek-v4.1-flash-unrestricted** through `/models` to use DeepSeek. DeepSeek Flash is the default for new connections; existing user or project OpenCode settings take precedence.

Newly available models appear when you start a new OpenCode session. Existing connections do not need to reconnect or edit their configuration. Disabled models and models awaiting required pricing are excluded automatically. Coding-tool output budgets are capped at 32,768 tokens or the model's smaller runtime limit.

## Your key and usage

The connection creates a dedicated key named **OpenCode**, valid for **90 days**. It has the same inference permissions as a normal project API key; it is not restricted to GLM. Usage belongs to your selected project and uses the workspace’s available usage, spending caps and request limits.

Choose a monthly plan or buy prepaid API usage in [Billing](https://docs.otamd.com/billing.md) before making requests. If you reach your monthly limit, wait for the next reset, upgrade, or buy extra usage. Connecting OpenCode does not start a subscription or collect payment.

Manage or revoke the key in [API keys](https://trylimitless.ai/app/api-keys). After revoking or expiring a key, run the connection command again to create a replacement.

## If connection or inference fails

* **Expired code:** run the command again and use the new browser link. A request lasts ten minutes.
* **Interrupted connection:** check the terminal’s connection message; a zero exit code alone does not establish success. If the terminal stopped after your approval, inspect API keys and revoke any new unused **OpenCode** key before retrying. A key may have been issued before OpenCode saved it.
* **Insufficient permissions:** choose a workspace you own or administer and an active project.
* **Project policies:** GLM cannot evaluate published project policies. Choose a project without applicable policies.
* **Model unavailable:** a successful connection confirms your credentials. Model availability is separate; if the model is temporarily unavailable, try again later. Requests do not automatically fall back to another provider.
* **Different model or endpoint:** local OpenCode settings take precedence over the supplied defaults. Review user and project configuration before retrying.


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