# Use i14 Models in OpenCode

> Add the i14 API to OpenCode as a custom provider and use Sugar Glider as your terminal coding agent model.

Source: https://i14.ai/docs/integrations/opencode/

[OpenCode](https://opencode.ai) is an open-source AI coding agent for the terminal. It supports any OpenAI-compatible endpoint as a custom provider, so you can add the i14 API in a few lines of config and use Sugar Glider (`i14-sugarglider-nemotron3-super-120b-v1`) for chat, file edits, and tool use.

1. **Install OpenCode**

   ```bash
   npm install -g opencode-ai
   ```

2. **Export your API key**

   Create an API key at [platform.i14.ai](https://platform.i14.ai/), then export it in the shell you run OpenCode from:

   * macOS and Linux

     bash or zsh

     ```bash
     export I14_API_KEY="your_api_key_here"
     ```

   * Windows

     PowerShell

     ```powershell
     $env:I14_API_KEY = "your_api_key_here"
     ```

3. **Add the i14 provider**

   Create `opencode.json` in your project directory:

   ```json
   {
     "$schema": "https://opencode.ai/config.json",
     "provider": {
       "i14": {
         "npm": "@ai-sdk/openai-compatible",
         "name": "i14",
         "options": {
           "baseURL": "https://api.i14.ai/v1",
           "apiKey": "{env:I14_API_KEY}"
         },
         "models": {
           "i14-sugarglider-nemotron3-super-120b-v1": {
             "name": "Sugar Glider",
             "limit": {
               "context": 32768,
               "output": 16384
             }
           }
         }
       }
     }
   }
   ```

   `{env:I14_API_KEY}` tells OpenCode to read the key from your environment, so the key never lands in the file.

4. **Run OpenCode**

   Confirm that OpenCode sees the model:

   ```bash
   opencode models i14
   ```

   Then send a one-off prompt:

   ```bash
   opencode run -m i14/i14-sugarglider-nemotron3-super-120b-v1 "Read README.md and summarize it."
   ```

> **Note**
>
> OpenCode sends `limit.output` as `max_tokens` on every request, so replies are not cut off at the API’s 100-token default.

## Troubleshooting

* **`403` with `model_not_allowed`** - check that the model key under `models` is exactly `i14-sugarglider-nemotron3-super-120b-v1`.
* **`401` with `missing_api_key`** - `I14_API_KEY` is not set in the shell that started OpenCode. See [API Key and Authentication](https://i14.ai/docs/authentication/) for the full list of error codes.
